diff --git a/fieldgenerator/fieldgenerator-standard/src/main/java/com/speedment/jpastreamer/fieldgenerator/internal/InternalFieldGeneratorProcessor.java b/fieldgenerator/fieldgenerator-standard/src/main/java/com/speedment/jpastreamer/fieldgenerator/internal/InternalFieldGeneratorProcessor.java index 4cfe8449..ef9cb031 100644 --- a/fieldgenerator/fieldgenerator-standard/src/main/java/com/speedment/jpastreamer/fieldgenerator/internal/InternalFieldGeneratorProcessor.java +++ b/fieldgenerator/fieldgenerator-standard/src/main/java/com/speedment/jpastreamer/fieldgenerator/internal/InternalFieldGeneratorProcessor.java @@ -112,9 +112,6 @@ public boolean process(Set annotations, RoundEnvironment void generateFields(final Element annotatedElement, final Writer writer) throws IOException { - - - final String entityName = shortName(annotatedElement.asType().toString()); final String genEntityName = entityName + "$"; @@ -174,6 +171,7 @@ private String findGetter(final Element field, final Set isGetters, final String entityName, boolean lombokGetterAvailable) { + final String fieldName = field.getSimpleName().toString(); final String getterPrefix = isGetters.contains(fieldName) ? IS_PREFIX @@ -395,9 +393,15 @@ private Optional getterAccessLevel(final Element fieldElement) { return map.values().stream() .map(AnnotationValue::toString) - .filter(v -> v.contains("AccessLevel")) .map(v -> v.substring(v.lastIndexOf(".") + 1)) // Format as simple name + .filter(this::isAccessLevel) .findFirst(); } + private boolean isAccessLevel(String s) { + Set validAccessLevels = Stream.of("PACKAGE", "NONE", "PRIVATE", "MODULE", "PROTECTED", "PUBLIC") + .collect(Collectors.collectingAndThen(toSet(), Collections::unmodifiableSet)); + return validAccessLevels.contains(s); + } + }