diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2020-08-31 09:57:29 +0200 |
---|---|---|
committer | Rawi01 <Rawi01@users.noreply.github.com> | 2020-08-31 09:57:29 +0200 |
commit | 82ac8aad1d0e3e152db4ce328184c40c73700cee (patch) | |
tree | 3d5abb9072d43b87f19e5faf88a3d09b6c6da8e4 /src/utils/lombok/core/JavaIdentifiers.java | |
parent | 3d90a51163354930eeea0e26c2b0a567af8e96be (diff) | |
parent | 9148294f78a8e646ee131ca182a9b692bc028fdb (diff) | |
download | lombok-82ac8aad1d0e3e152db4ce328184c40c73700cee.tar.gz lombok-82ac8aad1d0e3e152db4ce328184c40c73700cee.tar.bz2 lombok-82ac8aad1d0e3e152db4ce328184c40c73700cee.zip |
Merge branch 'master' into extensionmethod
Conflicts:
build.xml
Diffstat (limited to 'src/utils/lombok/core/JavaIdentifiers.java')
-rw-r--r-- | src/utils/lombok/core/JavaIdentifiers.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils/lombok/core/JavaIdentifiers.java b/src/utils/lombok/core/JavaIdentifiers.java index cbe90eed..906ae0e1 100644 --- a/src/utils/lombok/core/JavaIdentifiers.java +++ b/src/utils/lombok/core/JavaIdentifiers.java @@ -21,6 +21,8 @@ */ package lombok.core; +import java.util.regex.Pattern; + /** * Utility functions for validating potential java verifiers. */ @@ -54,4 +56,13 @@ public class JavaIdentifiers { public static boolean isKeyword(String keyword) { return KEYWORDS.contains(keyword); } + + /** 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)$"); + + public static boolean isPrimitive(String typeName) { + return PRIMITIVE_TYPE_NAME_PATTERN.matcher(typeName).matches(); + } + + } |