public static Spec parse(Element element, ProcessingEnvironment processingEnv) {
Messager messager = processingEnv.getMessager();
if (element.getKind() != ElementKind.INTERFACE) {
messager.printMessage(
Diagnostic.Kind.ERROR, "@DataEnum can only be used on interfaces.", element);
return null;
}
TypeElement dataEnum = (TypeElement) element;
List<TypeVariableName> typeVariableNames = new ArrayList<>();
for (TypeParameterElement typeParameterElement : dataEnum.getTypeParameters()) {
typeVariableNames.add(TypeVariableName.get(typeParameterElement));
}
List<Value> values = ValuesParser.parse(dataEnum, processingEnv);
if (values == null) {
return null;
}
ClassName enumInterface = ClassName.get(dataEnum);
return new Spec(enumInterface, typeVariableNames, values);
}
SpecParser.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:dataenum
作者:
评论列表
文章目录