public class HandlerUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_EXCEPTION_FOR_NON_NULL |
static List<Class<? extends Annotation>> |
INVALID_ON_BUILDERS |
static Pattern |
NON_NULL_PATTERN
Matches the simple part of any annotation that lombok considers as indicative of NonNull status.
|
static 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 String |
autoSingularize(String plural) |
static String |
buildAccessorName(String prefix,
String suffix) |
static boolean |
checkName(String nameSpec,
String identifier,
LombokNode<?,?,?> errorNode)
Checks if the given name is a valid identifier.
|
static void |
handleExperimentalFlagUsage(LombokNode<?,?,?> node,
ConfigurationKey<FlagUsageType> key,
String featureName) |
static void |
handleFlagUsage(LombokNode<?,?,?> node,
ConfigurationKey<FlagUsageType> key,
String featureName) |
static void |
handleFlagUsage(LombokNode<?,?,?> node,
ConfigurationKey<FlagUsageType> key1,
String featureName1,
ConfigurationKey<FlagUsageType> key2,
String featureName2) |
static int |
primeForFalse() |
static int |
primeForHashcode() |
static int |
primeForNull() |
static int |
primeForTrue() |
static CharSequence |
removePrefix(CharSequence fieldName,
List<String> prefixes)
Given the name of a field, return the 'base name' of that field.
|
static boolean |
shouldAddGenerated(LombokNode<?,?,?> node) |
static boolean |
shouldReturnThis0(AnnotationValues<Accessors> accessors,
AST<?,?,?> ast) |
static List<String> |
toAllGetterNames(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
CharSequence fieldName,
boolean isBoolean)
Returns all names of methods that would represent the getter for a field with the provided name.
|
static List<String> |
toAllSetterNames(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
CharSequence fieldName,
boolean isBoolean)
Returns all names of methods that would represent the setter for a field with the provided name.
|
static List<String> |
toAllWitherNames(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
CharSequence fieldName,
boolean isBoolean)
Returns all names of methods that would represent the wither for a field with the provided name.
|
static String |
toGetterName(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
CharSequence fieldName,
boolean isBoolean)
Generates a getter name from a given field name.
|
static String |
toSetterName(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
CharSequence fieldName,
boolean isBoolean)
Generates a setter name from a given field name.
|
static String |
toWitherName(AST<?,?,?> ast,
AnnotationValues<Accessors> accessors,
CharSequence fieldName,
boolean isBoolean)
Generates a wither name from a given field name.
|
public static final List<Class<? extends Annotation>> INVALID_ON_BUILDERS
public static final Pattern NON_NULL_PATTERN
public static final Pattern NULLABLE_PATTERN
public static final 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(String nameSpec, 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 void handleFlagUsage(LombokNode<?,?,?> node, ConfigurationKey<FlagUsageType> key, String featureName)
public static boolean shouldAddGenerated(LombokNode<?,?,?> node)
public static void handleExperimentalFlagUsage(LombokNode<?,?,?> node, ConfigurationKey<FlagUsageType> key, String featureName)
public static void handleFlagUsage(LombokNode<?,?,?> node, ConfigurationKey<FlagUsageType> key1, String featureName1, ConfigurationKey<FlagUsageType> key2, String featureName2)
public static boolean shouldReturnThis0(AnnotationValues<Accessors> accessors, AST<?,?,?> ast)
public static CharSequence removePrefix(CharSequence fieldName, List<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 String toGetterName(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, 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 String toSetterName(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, 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 String toWitherName(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, 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 List<String> toAllGetterNames(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, 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 List<String> toAllSetterNames(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, 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 List<String> toAllWitherNames(AST<?,?,?> ast, AnnotationValues<Accessors> accessors, 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.Copyright © 2009-2015 The Project Lombok Authors, licensed under the MIT licence.