Module tools.jackson.databind
Class DefaultAccessorNamingStrategy.FirstCharBasedValidator
java.lang.Object
tools.jackson.databind.introspect.DefaultAccessorNamingStrategy.FirstCharBasedValidator
- All Implemented Interfaces:
Serializable,DefaultAccessorNamingStrategy.BaseNameValidator
- Enclosing class:
- DefaultAccessorNamingStrategy
public static class DefaultAccessorNamingStrategy.FirstCharBasedValidator
extends Object
implements DefaultAccessorNamingStrategy.BaseNameValidator, Serializable
Simple implementation of
DefaultAccessorNamingStrategy.BaseNameValidator that checks the
first character and nothing else if (and only if!) prefix is empty
(so offset passed is NOT zero).
Instances are to be constructed using method
forFirstNameRule(boolean, boolean).
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFirstCharBasedValidator(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar) -
Method Summary
Modifier and TypeMethodDescriptionbooleanMethod called to check whether given base name is acceptable: called for accessor method name after removing prefix.forFirstNameRule(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar) Factory method to use for getting an instance with specified first-character restrictions, if any; ornullif no checking is needed.
-
Constructor Details
-
FirstCharBasedValidator
protected FirstCharBasedValidator(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar)
-
-
Method Details
-
forFirstNameRule
public static DefaultAccessorNamingStrategy.BaseNameValidator forFirstNameRule(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar) Factory method to use for getting an instance with specified first-character restrictions, if any; ornullif no checking is needed.- Parameters:
allowLowerCaseFirstChar- Whether base names that start with lower-case letter (like"a"or"b") are accepted as valid or not: consider difference between "setter-methods"setValue()andsetvalue().allowNonLetterFirstChar- Whether base names that start with non-letter character (like"_"or number1) are accepted as valid or not: consider difference between "setter-methods"setValue()andset_value().- Returns:
- Validator instance to use, if any;
nullto indicate no additional rules applied (case when both arguments aretrue)
-
accept
Description copied from interface:DefaultAccessorNamingStrategy.BaseNameValidatorMethod called to check whether given base name is acceptable: called for accessor method name after removing prefix. NOTE: called even if "prefix" is empy (i.e. nothing really removed)- Specified by:
acceptin interfaceDefaultAccessorNamingStrategy.BaseNameValidator- Parameters:
firstChar- First character of the base namebasename- Full base name (after removing prefix)offset- Length of prefix removed- Returns:
trueif base name is acceptable;falseotherwise
-