Line data Source code
1 : // Copyright (C) 2018 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.common; 16 : 17 : import static java.lang.annotation.ElementType.CONSTRUCTOR; 18 : import static java.lang.annotation.ElementType.FIELD; 19 : import static java.lang.annotation.ElementType.METHOD; 20 : import static java.lang.annotation.ElementType.TYPE; 21 : import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 : 23 : import java.lang.annotation.ElementType; 24 : import java.lang.annotation.Repeatable; 25 : import java.lang.annotation.Retention; 26 : import java.lang.annotation.Target; 27 : 28 : /** 29 : * A marker to say a method/type/field/constructor is added or is increased to public solely because 30 : * it is called from inside a project or an organisation using Gerrit. 31 : */ 32 : @Target({METHOD, TYPE, FIELD, CONSTRUCTOR}) 33 : @Retention(RUNTIME) 34 : @Repeatable(UsedAt.Uses.class) 35 : public @interface UsedAt { 36 : /** Enumeration of projects that call a method/type/field. */ 37 153 : enum Project { 38 153 : COLLABNET, 39 153 : GOOGLE, 40 153 : PLUGINS_ALL, // Use this project if a method/type is generally made available to all plugins. 41 153 : PLUGIN_CHECKS, 42 153 : PLUGIN_CODE_OWNERS, 43 153 : PLUGIN_DELETE_PROJECT, 44 153 : PLUGIN_HIGH_AVAILABILITY, 45 153 : PLUGIN_MULTI_SITE, 46 153 : PLUGIN_SERVICEUSER, 47 153 : PLUGIN_WEBSESSION_FLATFILE, 48 : } 49 : 50 : /** Reference to the project that uses the method annotated with this annotation. */ 51 : Project value(); 52 : 53 : /** Allows to mark method/type/field with multiple UsedAt annotations. */ 54 : @Retention(RUNTIME) 55 : @Target(ElementType.TYPE) 56 : @interface Uses { 57 : UsedAt[] value(); 58 : } 59 : }