/** * Annotation to inform users of a package, class or method's intended audience. */ public class InterfaceAudience { /** * Intended for use by any project or application. */ @Documented public @interface Public {}; /** * Intended only for the project(s) specified in the annotation */ @Documented public @interface LimitedPrivate { String[] value(); }; /** * Intended for use only within Hive itself. */ @Documented public @interface Private {}; private InterfaceAudience() {} // Audience can't exist on its own }
public void doit() { Documented d = Foo.class.getAnnotation(Documented.class); System.out.println(d.annotationType()); } }
/** * Annotation to inform users of how much to rely on a particular package, * class or method not changing over time. */ public class InterfaceStability { /** * Can evolve while retaining compatibility for minor release boundaries.; * can break compatibility only at major release (ie. at m.0). */ @Documented public @interface Stable {}; /** * Evolving, but can break compatibility at minor release (i.e. m.x) */ @Documented public @interface Evolving {}; /** * No guarantee is provided as to reliability or stability across any * level of release granularity. */ @Documented public @interface Unstable {}; }
@Documented @Retention(RetentionPolicy.RUNTIME) public @interface Stable { } @Documented @Retention(RetentionPolicy.RUNTIME) public @interface Evolving { } @Documented @Retention(RetentionPolicy.RUNTIME) public @interface Unstable { }
/** * Outer class that exists solely to let us write {@code Partially.GwtIncompatible} instead of plain * {@code GwtIncompatible}. This is more accurate for {@link Futures#catching}, which is available * under GWT but with a slightly different signature. * * <p>We can't use {@code PartiallyGwtIncompatible} because then the GWT compiler wouldn't recognize * it as a {@code GwtIncompatible} annotation. And for {@code Futures.catching}, we need the GWT * compiler to autostrip the normal server method in order to expose the special, inherited GWT * version. */ @GwtCompatible final class Partially { /** * The presence of this annotation on an API indicates that the method <i>may</i> be used with the * <a href="http://www.gwtproject.org/">Google Web Toolkit</a> (GWT) but that it has <i>some * restrictions</i>. */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) @Documented @interface GwtIncompatible { String value(); } private Partially() {} }
/** * Thrown when a {@link MergingMediaSource} cannot merge its sources. */ public static final class IllegalMergeException extends IOException { /** The reason the merge failed. One of {@link #REASON_PERIOD_COUNT_MISMATCH}. */ @Documented @Retention(RetentionPolicy.SOURCE) @IntDef({REASON_PERIOD_COUNT_MISMATCH}) public @interface Reason {} /** * The sources have different period counts. */ public static final int REASON_PERIOD_COUNT_MISMATCH = 0; /** * The reason the merge failed. */ @Reason public final int reason; /** * @param reason The reason the merge failed. */ public IllegalMergeException(@Reason int reason) { this.reason = reason; } }
@Documented @Retention(RetentionPolicy.RUNTIME) public @interface Stable { @Documented @Retention(RetentionPolicy.RUNTIME) public @interface Evolving { @Documented @Retention(RetentionPolicy.RUNTIME) public @interface Unstable {
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef({REASON_UNSUPPORTED_SCHEME, REASON_INSTANTIATION_ERROR})
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef({TYPE_OPEN, TYPE_READ, TYPE_CLOSE})
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef({REASON_INVALID_PERIOD_COUNT, REASON_NOT_SEEKABLE_TO_START, REASON_START_EXCEEDS_END})
/** * Outer class that exists solely to let us write {@code Partially.GwtIncompatible} instead of plain * {@code GwtIncompatible}. This is more accurate for {@link Futures#catching}, which is available * under GWT but with a slightly different signature. * * <p>We can't use {@code PartiallyGwtIncompatible} because then the GWT compiler wouldn't recognize * it as a {@code GwtIncompatible} annotation. And for {@code Futures.catching}, we need the GWT * compiler to autostrip the normal server method in order to expose the special, inherited GWT * version. */ @GwtCompatible final class Partially { /** * The presence of this annotation on an API indicates that the method <i>may</i> be used with the * <a href="http://www.gwtproject.org/">Google Web Toolkit</a> (GWT) but that it has <i>some * restrictions</i>. */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) @Documented @interface GwtIncompatible { String value(); } private Partially() {} }
@Documented @Target(ElementType.METHOD) public static @interface Require {
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef({TYPE_AD, TYPE_AD_GROUP, TYPE_ALL_ADS, TYPE_UNEXPECTED})
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef(
/** * Outer class that exists solely to let us write {@code Partially.GwtIncompatible} instead of plain * {@code GwtIncompatible}. This is more accurate for {@link Futures#catching}, which is available * under GWT but with a slightly different signature. * * <p>We can't use {@code PartiallyGwtIncompatible} because then the GWT compiler wouldn't recognize * it as a {@code GwtIncompatible} annotation. And for {@code Futures.catching}, we need the GWT * compiler to autostrip the normal server method in order to expose the special, inherited GWT * version. */ @GwtCompatible final class Partially { /** * The presence of this annotation on an API indicates that the method <i>may</i> be used with the * <a href="http://www.gwtproject.org/">Google Web Toolkit</a> (GWT) but that it has <i>some * restrictions</i>. */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) @Documented @interface GwtIncompatible { String value(); } private Partially() {} }
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef({STATE_QUEUED, STATE_STARTED, STATE_COMPLETED, STATE_CANCELED, STATE_FAILED})
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef({
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef(value = {RESULT_CONTINUE, RESULT_SEEK, RESULT_END_OF_INPUT})
private static final class TrackGroupInfo { @Documented @Retention(RetentionPolicy.SOURCE) @IntDef({CATEGORY_PRIMARY, CATEGORY_EMBEDDED, CATEGORY_MANIFEST_EVENTS})
@Documented @Retention(RetentionPolicy.SOURCE) @IntDef({