Nonnull和TypeQualifierValidator,这是什么情况?

bigPig_ink 发布于 2016/12/20 14:37
阅读 242
收藏 0

package javax.annotation;


import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;


import javax.annotation.meta.TypeQualifier;
import javax.annotation.meta.TypeQualifierValidator;
import javax.annotation.meta.When;

@Documented

@TypeQualifier
@Retention(RetentionPolicy.RUNTIME)
public @interface Nonnull {
    When when() default When.ALWAYS;


    static class Checker implements TypeQualifierValidator<Nonnull> {


        public When forConstantValue(Nonnull qualifierqualifierArgument,
                Object value) {
            if (value == null)
                return When.NEVER;
            return When.ALWAYS;
        }
    }
}



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);
}




加载中
0
bigPig_ink
bigPig_ink
以上情况很正常,一时没转过来,本来想删掉问题,可没权限,不好意思,在此备注下
返回顶部
顶部