public class HandlerUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_EXCEPTION_FOR_NON_NULL |
static java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> |
INVALID_ON_BUILDERS |
static java.util.regex.Pattern |
NON_NULL_PATTERN
Matches the simple part of any annotation that lombok considers as indicative of NonNull status.
|
static java.util.regex.Pattern |
NULLABLE_PATTERN
Matches the simple part of any annotation that lombok considers as indicative of Nullable status.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
autoSingularize(java.lang.String plural) |
static java.lang.String |
buildAccessorName(java.lang.String prefix,
java.lang.String suffix) |
static boolean |
checkName(java.lang.String nameSpec,
java.lang.String identifier,
LombokNode<?,?,?> errorNode)
Checks if the given name is a valid identifier.
|
static void |
handleExperimentalFlagUsage(LombokNode<?,?,?> node,
ConfigurationKey<FlagUsageType> key,
java.lang.String featureName) |
static void |
handleFlagUsage(LombokNode<?,?,?> node,
ConfigurationKey<FlagUsageType> key,
java.lang.String featureName) |
static void |
handleFlagUsage(LombokNode<?,?,?> node,
ConfigurationKey<FlagUsageType> key1,
java.lang.String featureName1,
ConfigurationKey<FlagUsageType> key2,
java.lang.String featureName2) |
static int |
primeForFalse() |
static int |
primeForHashcode() |
static int |
primeForNull() |
static int |
primeForTrue() |
static java.lang.CharSequence |
removePrefix(java.lang.CharSequence fieldName,
java.util.List<java.lang.String> prefixes)
Given the name of a field, return the 'base name' of that field.
|
static boolean |
shouldReturnThis0(AnnotationValues<Accessors> accessors,
AST<?,?,?> ast) |
static java.util.List<java.lang.String> |
toAllGetterNames(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
java.lang.CharSequence fieldName,
boolean isBoolean)
Returns all names of methods that would represent the getter for a field with the provided name.
|
static java.util.List<java.lang.String> |
toAllSetterNames(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
java.lang.CharSequence fieldName,
boolean isBoolean)
Returns all names of methods that would represent the setter for a field with the provided name.
|
static java.util.List<java.lang.String> |
toAllWitherNames(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
java.lang.CharSequence fieldName,
boolean isBoolean)
Returns all names of methods that would represent the wither for a field with the provided name.
|
static java.lang.String |
toGetterName(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
java.lang.CharSequence fieldName,
boolean isBoolean)
Generates a getter name from a given field name.
|
static java.lang.String |
toSetterName(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
java.lang.CharSequence fieldName,
boolean isBoolean)
Generates a setter name from a given field name.
|
static java.lang.String |
toWitherName(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
java.lang.CharSequence fieldName,
boolean isBoolean)
Generates a wither name from a given field name.
|
public static final java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> INVALID_ON_BUILDERS
public static final java.util.regex.Pattern NON_NULL_PATTERN
public static final java.util.regex.Pattern NULLABLE_PATTERN
public static final java.lang.String DEFAULT_EXCEPTION_FOR_NON_NULL
public static int primeForHashcode()
public static int primeForTrue()
public static int primeForFalse()
public static int primeForNull()
public static boolean checkName(java.lang.String nameSpec, java.lang.String identifier, LombokNode<?,?,?> errorNode)
true
and does nothing else.
If it isn't, this returns false
and adds an error message to the supplied node.public static java.lang.String autoSingularize(java.lang.String plural)
public static void handleFlagUsage(LombokNode<?,?,?> node, ConfigurationKey<FlagUsageType> key, java.lang.String featureName)
public static void handleExperimentalFlagUsage(LombokNode<?,?,?> node, ConfigurationKey<FlagUsageType> key, java.lang.String featureName)
public static void handleFlagUsage(LombokNode<?,?,?> node, ConfigurationKey<FlagUsageType> key1, java.lang.String featureName1, ConfigurationKey<FlagUsageType> key2, java.lang.String featureName2)
public static boolean shouldReturnThis0(AnnotationValues<Accessors> accessors, AST<?,?,?> ast)
public static java.lang.CharSequence removePrefix(java.lang.CharSequence fieldName, java.util.List<java.lang.String> prefixes)
fFoobar
becomes foobar
if f
is in the prefix list.
For prefixes that end in a letter character, the next character must be a non-lowercase character (i.e. hashCode
is not ashCode
even if
h
is in the prefix list, but hAshcode
would become ashCode
). The first prefix that matches is used. If the prefix list is empty,
or the empty string is in the prefix list and no prefix before it matches, the fieldName will be returned verbatim.
If no prefix matches and the empty string is not in the prefix list and the prefix list is not empty, null
is returned.fieldName
- The full name of a field.prefixes
- A list of prefixes, usually provided by the Accessors
settings annotation, listing field prefixes.public static java.lang.String toGetterName(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, java.lang.CharSequence fieldName, boolean isBoolean)
Accessors
). If the field name does not fit
the prefix list, this method immediately returns null
.Accessors
has fluent=true
, then return the basename.isBoolean
is true.isBoolean
is true: Check if the field starts with is
followed by a non-lowercase character. If so, return the field name verbatim.accessors
- Accessors configuration.fieldName
- the name of the field.isBoolean
- if the field is of type 'boolean'. For fields of type java.lang.Boolean
, you should provide false
.null
if this field does not fit expected patterns and therefore cannot be turned into a getter name.public static java.lang.String toSetterName(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, java.lang.CharSequence fieldName, boolean isBoolean)
Accessors
). If the field name does not fit
the prefix list, this method immediately returns null
.Accessors
has fluent=true
, then return the basename.isBoolean
is true: Check if the field starts with is
followed by a non-lowercase character.
If so, replace is
with set
and return that."set"
plus the possibly title/uppercased first character, and the rest of the field name.accessors
- Accessors configuration.fieldName
- the name of the field.isBoolean
- if the field is of type 'boolean'. For fields of type java.lang.Boolean
, you should provide false
.null
if this field does not fit expected patterns and therefore cannot be turned into a getter name.public static java.lang.String toWitherName(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, java.lang.CharSequence fieldName, boolean isBoolean)
Accessors
). If the field name does not fit
the prefix list, this method immediately returns null
.isBoolean
is true: Check if the field starts with is
followed by a non-lowercase character.
If so, replace is
with with
and return that."with"
plus the possibly title/uppercased first character, and the rest of the field name.accessors
- Accessors configuration.fieldName
- the name of the field.isBoolean
- if the field is of type 'boolean'. For fields of type java.lang.Boolean
, you should provide false
.null
if this field does not fit expected patterns and therefore cannot be turned into a getter name.public static java.util.List<java.lang.String> toAllGetterNames(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, java.lang.CharSequence fieldName, boolean isBoolean)
isBoolean
is true, then a field named isRunning
would produce:[isRunning, getRunning, isIsRunning, getIsRunning]
accessors
- Accessors configuration.fieldName
- the name of the field.isBoolean
- if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide false
.public static java.util.List<java.lang.String> toAllSetterNames(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, java.lang.CharSequence fieldName, boolean isBoolean)
isBoolean
is true, then a field named isRunning
would produce:[setRunning, setIsRunning]
accessors
- Accessors configuration.fieldName
- the name of the field.isBoolean
- if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide false
.public static java.util.List<java.lang.String> toAllWitherNames(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, java.lang.CharSequence fieldName, boolean isBoolean)
isBoolean
is true, then a field named isRunning
would produce:[withRunning, withIsRunning]
accessors
- Accessors configuration.fieldName
- the name of the field.isBoolean
- if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide false
.public static java.lang.String buildAccessorName(java.lang.String prefix, java.lang.String suffix)
prefix
- Something like get
or set
or is
.suffix
- Something like running
.setRunning
.Copyright © 2009-2015 The Project Lombok Authors, licensed under the MIT licence.