Initial commit
This commit is contained in:
26
resources/javax/annotation/meta/Exclusive.java
Normal file
26
resources/javax/annotation/meta/Exclusive.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* This annotation can be applied to the value() element of an annotation that
|
||||
* is annotated as a TypeQualifier.
|
||||
*
|
||||
* For example, the following defines a type qualifier such that if you know a
|
||||
* value is {@literal @Foo(1)}, then the value cannot be {@literal @Foo(2)} or {{@literal @Foo(3)}.
|
||||
*
|
||||
* <code>
|
||||
* @TypeQualifier @interface Foo {
|
||||
* @Exclusive int value();
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Exclusive {
|
||||
|
||||
}
|
33
resources/javax/annotation/meta/Exhaustive.java
Normal file
33
resources/javax/annotation/meta/Exhaustive.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* This annotation can be applied to the value() element of an annotation that
|
||||
* is annotated as a TypeQualifier. This is only appropriate if the value field
|
||||
* returns a value that is an Enumeration.
|
||||
*
|
||||
* Applications of the type qualifier with different values are exclusive, and
|
||||
* the enumeration is an exhaustive list of the possible values.
|
||||
*
|
||||
* For example, the following defines a type qualifier such that if you know a
|
||||
* value is neither {@literal @Foo(Color.Red)} or {@literal @Foo(Color.Blue)},
|
||||
* then the value must be {@literal @Foo(Color.Green)}. And if you know it is
|
||||
* {@literal @Foo(Color.Green)}, you know it cannot be
|
||||
* {@literal @Foo(Color.Red)} or {@literal @Foo(Color.Blue)}
|
||||
*
|
||||
* <code>
|
||||
* @TypeQualifier @interface Foo {
|
||||
* enum Color {RED, BLUE, GREEN};
|
||||
* @Exhaustive Color value();
|
||||
* }
|
||||
* </code>
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Exhaustive {
|
||||
|
||||
}
|
27
resources/javax/annotation/meta/TypeQualifier.java
Normal file
27
resources/javax/annotation/meta/TypeQualifier.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* This qualifier is applied to an annotation to denote that the annotation
|
||||
* should be treated as a type qualifier.
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TypeQualifier {
|
||||
|
||||
/**
|
||||
* Describes the kinds of values the qualifier can be applied to. If a
|
||||
* numeric class is provided (e.g., Number.class or Integer.class) then the
|
||||
* annotation can also be applied to the corresponding primitive numeric
|
||||
* types.
|
||||
*/
|
||||
Class<?> applicableTo() default Object.class;
|
||||
|
||||
}
|
20
resources/javax/annotation/meta/TypeQualifierDefault.java
Normal file
20
resources/javax/annotation/meta/TypeQualifierDefault.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* This qualifier is applied to an annotation to denote that the annotation
|
||||
* defines a default type qualifier that is visible within the scope of the
|
||||
* element it is applied to.
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TypeQualifierDefault {
|
||||
ElementType[] value() default {};
|
||||
}
|
33
resources/javax/annotation/meta/TypeQualifierNickname.java
Normal file
33
resources/javax/annotation/meta/TypeQualifierNickname.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* This annotation is applied to a annotation, and marks the annotation as being
|
||||
* a qualifier nickname. Applying a nickname annotation X to a element Y should
|
||||
* be interpreted as having the same meaning as applying all of annotations of X
|
||||
* (other than QualifierNickname) to Y.
|
||||
*
|
||||
* <p>
|
||||
* Thus, you might define a qualifier SocialSecurityNumber as follows:
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <code>
|
||||
@Documented
|
||||
@TypeQualifierNickname @Pattern("[0-9]{3}-[0-9]{2}-[0-9]{4}")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface SocialSecurityNumber {
|
||||
}
|
||||
</code>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
public @interface TypeQualifierNickname {
|
||||
|
||||
}
|
21
resources/javax/annotation/meta/TypeQualifierValidator.java
Normal file
21
resources/javax/annotation/meta/TypeQualifierValidator.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface TypeQualifierValidator<A extends Annotation> {
|
||||
/**
|
||||
* Given a type qualifier, check to see if a known specific constant value
|
||||
* is an instance of the set of values denoted by the qualifier.
|
||||
*
|
||||
* @param annotation
|
||||
* the type qualifier
|
||||
* @param value
|
||||
* the value to check
|
||||
* @return a value indicating whether or not the value is an member of the
|
||||
* values denoted by the type qualifier
|
||||
*/
|
||||
public @Nonnull
|
||||
When forConstantValue(@Nonnull A annotation, Object value);
|
||||
}
|
23
resources/javax/annotation/meta/When.java
Normal file
23
resources/javax/annotation/meta/When.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
/**
|
||||
* Used to describe the relationship between a qualifier T and the set of values
|
||||
* S possible on an annotated element.
|
||||
*
|
||||
* In particular, an issues should be reported if an ALWAYS or MAYBE value is
|
||||
* used where a NEVER value is required, or if a NEVER or MAYBE value is used
|
||||
* where an ALWAYS value is required.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum When {
|
||||
/** S is a subset of T */
|
||||
ALWAYS,
|
||||
/** nothing definitive is known about the relation between S and T */
|
||||
UNKNOWN,
|
||||
/** S intersection T is non empty and S - T is nonempty */
|
||||
MAYBE,
|
||||
/** S intersection T is empty */
|
||||
NEVER;
|
||||
|
||||
}
|
Reference in New Issue
Block a user