• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.android.enterprise.connectedapps.annotations;
17 
18 import java.lang.annotation.ElementType;
19 import java.lang.annotation.Retention;
20 import java.lang.annotation.RetentionPolicy;
21 import java.lang.annotation.Target;
22 
23 /**
24  * Indicate something is accessible from a different profile.
25  *
26  * <p>Annotated methods must only return, or take as parameters, types supported by the Profile
27  * Aware SDK.
28  *
29  * <p>Annotated types must be provided by a {@link CrossProfileProvider} class.
30  */
31 @Target({ElementType.METHOD, ElementType.TYPE})
32 @Retention(RetentionPolicy.CLASS)
33 public @interface CrossProfile {
34 
35   /**
36    * The name of the Profile class generated for this cross-profile type.
37    *
38    * <p>This argument can only be passed when annotating types, not methods.
39    *
40    * <p>Defaults to this type name prefixed with "Profile".
41    */
profileClassName()42   String profileClassName() default "";
43 
44   /**
45    * The {@link CustomProfileConnector} used by this type.
46    *
47    * <p>Setting this option for a cross-profile type ensures the generated code provides a better
48    * API surface with more accurate Javadoc and stronger compile-time checking.
49    *
50    * <p>This argument can only be passed when annotating types, not methods.
51    *
52    * <p>Defaults to undefined, which allows any connector to be used.
53    */
connector()54   Class<?> connector() default CrossProfile.class;
55 
56   /**
57    * Custom parcelable wrappers to be accessible in this cross-profile type.
58    *
59    * <p>This argument can only be passed when annotating types, not methods.
60    */
parcelableWrappers()61   Class<?>[] parcelableWrappers() default {};
62 
63   /**
64    * Custom future wrappers to be accessible in this cross-profile type.
65    *
66    * <p>This argument can only be passed when annotating types, not methods.
67    */
futureWrappers()68   Class<?>[] futureWrappers() default {};
69 
70   /**
71    * Can this type contain only static {@link CrossProfile} annotated methods.
72    *
73    * <p>This argument can only be passed when annotating types, not methods.
74    */
isStatic()75   boolean isStatic() default false;
76 
77   /**
78    * The number of milliseconds to wait before timing out asynchronous calls to this method or type.
79    *
80    * <p>Defaults to {@link #DEFAULT_TIMEOUT_MILLIS}.
81    */
timeoutMillis()82   long timeoutMillis() default -1;
83 }
84