EnumTypeDefinitionBuilder implements DeclaredTypeDefinitionBuilder { @Override public void build(ProcessingEnvironment processingEnv, DeclaredType type, TypeDefinition typeDefinition) { getDeclaredFields(type, FieldUtils::isEnumMemberField) .stream() .map(Element::getSimpleName) .map(Name::toString) .forEach(typeDefinition.getEnums()::add); }  @Override boolean accept(ProcessingEnvironment processingEnv, DeclaredType type); @Override void build(ProcessingEnvironment processingEnv, DeclaredType type, TypeDefinition typeDefinition); @Override int getPriority();  }
@Test public void testBuild() { TypeElement typeElement = getType(Color.class); TypeDefinition typeDefinition = build(processingEnv, typeElement); assertEquals(Color.class.getName(), typeDefinition.getType()); assertEquals(asList("RED", "YELLOW", "BLUE"), typeDefinition.getEnums()); }