本文整理汇总了Java中com.google.auto.common.SuperficialValidation.validateElements方法的典型用法代码示例。如果您正苦于以下问题:Java SuperficialValidation.validateElements方法的具体用法?Java SuperficialValidation.validateElements怎么用?Java SuperficialValidation.validateElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.auto.common.SuperficialValidation
的用法示例。
在下文中一共展示了SuperficialValidation.validateElements方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.google.auto.common.SuperficialValidation; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Set<? extends Element> builderTypes =
roundEnv.getElementsAnnotatedWith(RetroFacebook.Builder.class);
if (!SuperficialValidation.validateElements(builderTypes)) {
return false;
}
for (Element annotatedType : builderTypes) {
// Double-check that the annotation is there. Sometimes the compiler gets confused in case of
// erroneous source code. SuperficialValidation should protect us against this but it doesn't
// cost anything to check again.
if (isAnnotationPresent(annotatedType, RetroFacebook.Builder.class)) {
validate(
annotatedType,
"@RetroFacebook.Builder can only be applied to a class or interface inside an"
+ " @RetroFacebook class");
}
}
Set<? extends Element> validateMethods =
roundEnv.getElementsAnnotatedWith(RetroFacebook.Validate.class);
if (!SuperficialValidation.validateElements(validateMethods)) {
return false;
}
for (Element annotatedMethod : validateMethods) {
if (isAnnotationPresent(annotatedMethod, RetroFacebook.Validate.class)) {
validate(
annotatedMethod,
"@RetroFacebook.Validate can only be applied to a method inside an @RetroFacebook class");
}
}
return false;
}
示例2: process
import com.google.auto.common.SuperficialValidation; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Set<? extends Element> builderTypes =
roundEnv.getElementsAnnotatedWith(AutoCursor.Builder.class);
if (!SuperficialValidation.validateElements(builderTypes)) {
return false;
}
for (Element annotatedType : builderTypes) {
// Double-check that the annotation is there. Sometimes the compiler gets confused in case of
// erroneous source code. SuperficialValidation should protect us against this but it doesn't
// cost anything to check again.
if (isAnnotationPresent(annotatedType, AutoCursor.Builder.class)) {
validate(
annotatedType,
"@AutoCursor.Builder can only be applied to a class or interface inside an"
+ " @AutoCursor class");
}
}
Set<? extends Element> validateMethods =
roundEnv.getElementsAnnotatedWith(AutoCursor.Validate.class);
if (!SuperficialValidation.validateElements(validateMethods)) {
return false;
}
for (Element annotatedMethod : validateMethods) {
if (isAnnotationPresent(annotatedMethod, AutoCursor.Validate.class)) {
validate(
annotatedMethod,
"@AutoCursor.Validate can only be applied to a method inside an @AutoCursor class");
}
}
return false;
}
示例3: process
import com.google.auto.common.SuperficialValidation; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Set<? extends Element> builderTypes =
roundEnv.getElementsAnnotatedWith(Retrofit.Builder.class);
if (!SuperficialValidation.validateElements(builderTypes)) {
return false;
}
for (Element annotatedType : builderTypes) {
// Double-check that the annotation is there. Sometimes the compiler gets confused in case of
// erroneous source code. SuperficialValidation should protect us against this but it doesn't
// cost anything to check again.
if (isAnnotationPresent(annotatedType, Retrofit.Builder.class)) {
validate(
annotatedType,
"@Retrofit.Builder can only be applied to a class or interface inside an"
+ " @Retrofit class");
}
}
Set<? extends Element> validateMethods =
roundEnv.getElementsAnnotatedWith(Retrofit.Validate.class);
if (!SuperficialValidation.validateElements(validateMethods)) {
return false;
}
for (Element annotatedMethod : validateMethods) {
if (isAnnotationPresent(annotatedMethod, Retrofit.Validate.class)) {
validate(
annotatedMethod,
"@Retrofit.Validate can only be applied to a method inside an @Retrofit class");
}
}
return false;
}
示例4: process
import com.google.auto.common.SuperficialValidation; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Set<? extends Element> builderTypes =
roundEnv.getElementsAnnotatedWith(RetroWeibo.Builder.class);
if (!SuperficialValidation.validateElements(builderTypes)) {
return false;
}
for (Element annotatedType : builderTypes) {
// Double-check that the annotation is there. Sometimes the compiler gets confused in case of
// erroneous source code. SuperficialValidation should protect us against this but it doesn't
// cost anything to check again.
if (isAnnotationPresent(annotatedType, RetroWeibo.Builder.class)) {
validate(
annotatedType,
"@RetroWeibo.Builder can only be applied to a class or interface inside an"
+ " @RetroWeibo class");
}
}
Set<? extends Element> validateMethods =
roundEnv.getElementsAnnotatedWith(RetroWeibo.Validate.class);
if (!SuperficialValidation.validateElements(validateMethods)) {
return false;
}
for (Element annotatedMethod : validateMethods) {
if (isAnnotationPresent(annotatedMethod, RetroWeibo.Validate.class)) {
validate(
annotatedMethod,
"@RetroWeibo.Validate can only be applied to a method inside an @RetroWeibo class");
}
}
return false;
}
示例5: process
import com.google.auto.common.SuperficialValidation; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Set<? extends Element> builderTypes =
roundEnv.getElementsAnnotatedWith(AutoJson.Builder.class);
if (!SuperficialValidation.validateElements(builderTypes)) {
return false;
}
for (Element annotatedType : builderTypes) {
// Double-check that the annotation is there. Sometimes the compiler gets confused in case of
// erroneous source code. SuperficialValidation should protect us against this but it doesn't
// cost anything to check again.
if (isAnnotationPresent(annotatedType, AutoJson.Builder.class)) {
validate(
annotatedType,
"@AutoJson.Builder can only be applied to a class or interface inside an"
+ " @AutoJson class");
}
}
Set<? extends Element> validateMethods =
roundEnv.getElementsAnnotatedWith(AutoJson.Validate.class);
if (!SuperficialValidation.validateElements(validateMethods)) {
return false;
}
for (Element annotatedMethod : validateMethods) {
if (isAnnotationPresent(annotatedMethod, AutoJson.Validate.class)) {
validate(
annotatedMethod,
"@AutoJson.Validate can only be applied to a method inside an @AutoJson class");
}
}
return false;
}