本文整理汇总了Java中javax.annotation.meta.TypeQualifierValidator类的典型用法代码示例。如果您正苦于以下问题:Java TypeQualifierValidator类的具体用法?Java TypeQualifierValidator怎么用?Java TypeQualifierValidator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeQualifierValidator类属于javax.annotation.meta包,在下文中一共展示了TypeQualifierValidator类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sandboxedValidation
import javax.annotation.meta.TypeQualifierValidator; //导入依赖的package包/类
public static <A extends Annotation> When sandboxedValidation(A proxy, TypeQualifierValidator<A> v, @CheckForNull
Object constantValue) {
if (performingValidation.get())
throw new IllegalStateException("recursive validation");
try {
performingValidation.set(Boolean.TRUE);
if (TypeQualifierValue.DEBUG_CLASSLOADING)
System.out.println("Performing validation in thread " + Thread.currentThread().getName());
try {
When result = v.forConstantValue(proxy, constantValue);
if (!performingValidation.get())
throw new IllegalStateException("performingValidation not set when validation completes");
return result;
} catch (ClassCastException e) {
Class<? extends Annotation> c = proxy.getClass();
System.out.println(c.getName() + " extends " + c.getSuperclass().getName());
for(Class<?> i : c.getInterfaces())
System.out.println(" " + i.getName());
throw e;
}
} finally {
performingValidation.set(Boolean.FALSE);
if (TypeQualifierValue.DEBUG_CLASSLOADING)
System.out.println("Validation finished in thread " + Thread.currentThread().getName());
}
}
示例2: inValidation
import javax.annotation.meta.TypeQualifierValidator; //导入依赖的package包/类
private boolean inValidation() {
for (Class<?> c : getClassContext()) {
if (TypeQualifierValidator.class.isAssignableFrom(c)
|| c.getClassLoader() == ValidatorClassLoader.INSTANCE)
return true;
}
return false;
}
示例3: getValidator
import javax.annotation.meta.TypeQualifierValidator; //导入依赖的package包/类
private static <A extends Annotation> TypeQualifierValidator<A> getValidator(
Class<? extends TypeQualifierValidator<A>> checkerClass)
throws InstantiationException, IllegalAccessException {
return checkerClass.newInstance();
}
示例4: getValidator
import javax.annotation.meta.TypeQualifierValidator; //导入依赖的package包/类
/**
* @param checkerClass
* @return
* @throws InstantiationException
* @throws IllegalAccessException
*/
@SuppressWarnings("unchecked")
private TypeQualifierValidator<A> getValidator(Class<? extends TypeQualifierValidator> checkerClass)
throws InstantiationException, IllegalAccessException {
return checkerClass.newInstance();
}