diff options
author | Werner Dietl <wdietl@gmail.com> | 2018-08-27 18:36:13 -0400 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-09-11 01:59:19 +0200 |
commit | 79bfcc4f7ae4bcd61f7f942bfefb940c77927b71 (patch) | |
tree | 382b77e1806bd3513dc8f49b009e1aa23cc4dd2d /src/utils/lombok/eclipse/Eclipse.java | |
parent | 7a575e1e5d1c78fa5be1deca7fc308bd9eb390dd (diff) | |
download | lombok-79bfcc4f7ae4bcd61f7f942bfefb940c77927b71.tar.gz lombok-79bfcc4f7ae4bcd61f7f942bfefb940c77927b71.tar.bz2 lombok-79bfcc4f7ae4bcd61f7f942bfefb940c77927b71.zip |
Add configuration key, handle whereever NULLABLE is handled, support Eclipse.
Diffstat (limited to 'src/utils/lombok/eclipse/Eclipse.java')
-rw-r--r-- | src/utils/lombok/eclipse/Eclipse.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java index 5dbe3e2d..42adeeac 100644 --- a/src/utils/lombok/eclipse/Eclipse.java +++ b/src/utils/lombok/eclipse/Eclipse.java @@ -155,6 +155,24 @@ public class Eclipse { return result.toArray(EMPTY_ANNOTATIONS_ARRAY); } + /** + * Searches the given field node for annotations and returns each one that matches the provided list of names. + */ + public static Annotation[] findExactAnnotations(FieldDeclaration field, List<String> names) { + List<Annotation> result = new ArrayList<Annotation>(); + if (field.annotations == null) return EMPTY_ANNOTATIONS_ARRAY; + for (Annotation annotation : field.annotations) { + TypeReference typeRef = annotation.type; + if (typeRef != null && typeRef.getTypeName() != null) { + String annoname = toQualifiedName(typeRef.getTypeName()); + if (names.contains(annoname)) { + result.add(annotation); + } + } + } + return result.toArray(EMPTY_ANNOTATIONS_ARRAY); + } + /** Matches any of the 8 primitive names, such as {@code boolean}. */ private static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile( "^(boolean|byte|short|int|long|float|double|char)$"); |