private List<AbstractPropertyInfo> processAbstractProperties(TypeElement type) { List<AbstractPropertyInfo> abstractProperties = new ArrayList<>(); ElementFilter.methodsIn(type.getEnclosedElements()).stream() .filter(method -> method.getModifiers().contains(Modifier.ABSTRACT)) .forEach(method -> { // verify method if (method.getReturnType().getKind() == TypeKind.VOID) { abortWithError(method, "Abstract classes in a @%s class must not return void", Templated.class.getSimpleName()); } if (!method.getParameters().isEmpty()) { abortWithError(method, "Abstract classes in a @%s class must not have parameters", Templated.class.getSimpleName()); } String typeName = TypeSimplifier.simpleTypeName(method.getReturnType()); String methodName = method.getSimpleName().toString(); String fieldName = (isGetter(method)) ? nameWithoutPrefix(methodName) : methodName; String modifier = getModifier(method); abstractProperties.add(new AbstractPropertyInfo(typeName, fieldName, methodName, modifier)); }); return abstractProperties; }
private List<AbstractPropertyInfo> processAbstractProperties(TypeElement type) { List<AbstractPropertyInfo> abstractProperties = new ArrayList<>(); ElementFilter.methodsIn(type.getEnclosedElements()).stream() .filter(method -> method.getModifiers().contains(Modifier.ABSTRACT)) .forEach(method -> { // verify method if (method.getReturnType().getKind() == TypeKind.VOID) { abortWithError(method, "Abstract classes in a @%s class must not return void", Templated.class.getSimpleName()); } if (!method.getParameters().isEmpty()) { abortWithError(method, "Abstract classes in a @%s class must not have parameters", Templated.class.getSimpleName()); } String typeName = TypeSimplifier.simpleTypeName(method.getReturnType()); String methodName = method.getSimpleName().toString(); String fieldName = (isGetter(method)) ? nameWithoutPrefix(methodName) : methodName; String modifier = getModifier(method); abstractProperties.add(new AbstractPropertyInfo(typeName, fieldName, methodName, modifier)); }); return abstractProperties; }
private List<AbstractPropertyInfo> processAbstractProperties(TypeElement type) { List<AbstractPropertyInfo> abstractProperties = new ArrayList<>(); ElementFilter.methodsIn(type.getEnclosedElements()).stream() .filter(method -> method.getModifiers().contains(Modifier.ABSTRACT)) .forEach(method -> { // verify method if (method.getReturnType().getKind() == TypeKind.VOID) { abortWithError(method, "Abstract classes in a @%s class must not return void", Templated.class.getSimpleName()); } if (!method.getParameters().isEmpty()) { abortWithError(method, "Abstract classes in a @%s class must not have parameters", Templated.class.getSimpleName()); } String typeName = TypeSimplifier.simpleTypeName(method.getReturnType()); String methodName = method.getSimpleName().toString(); String fieldName = (isGetter(method)) ? nameWithoutPrefix(methodName) : methodName; String modifier = getModifier(method); abstractProperties.add(new AbstractPropertyInfo(typeName, fieldName, methodName, modifier)); }); return abstractProperties; }