public static class DefaultAccessorNamingStrategy.Provider extends AccessorNamingStrategy.Provider implements Serializable
DefaultAccessorNamingStrategy
.
Default instance will use following default prefixes:
DefaultAccessorNamingStrategy.BaseNameValidator
), allowing names like
"get_value()" and "getvalue()".Modifier and Type | Field and Description |
---|---|
protected DefaultAccessorNamingStrategy.BaseNameValidator |
_baseNameValidator |
protected String |
_getterPrefix |
protected String |
_isGetterPrefix |
protected String |
_setterPrefix |
protected String |
_withPrefix |
Modifier | Constructor and Description |
---|---|
|
Provider() |
protected |
Provider(DefaultAccessorNamingStrategy.Provider p,
DefaultAccessorNamingStrategy.BaseNameValidator vld) |
protected |
Provider(DefaultAccessorNamingStrategy.Provider p,
String setterPrefix,
String withPrefix,
String getterPrefix,
String isGetterPrefix) |
protected |
Provider(String setterPrefix,
String withPrefix,
String getterPrefix,
String isGetterPrefix,
DefaultAccessorNamingStrategy.BaseNameValidator vld) |
Modifier and Type | Method and Description |
---|---|
AccessorNamingStrategy |
forBuilder(MapperConfig<?> config,
AnnotatedClass builderClass,
BeanDescription valueTypeDesc)
Factory method for creating strategy instance for POJOs
that are deserialized using Builder type: in this case eventual
target (value) type is different from type of "builder" object that is
used by databinding to accumulate state.
|
AccessorNamingStrategy |
forPOJO(MapperConfig<?> config,
AnnotatedClass targetClass)
Factory method for creating strategy instance for a "regular" POJO,
called if none of the other factory methods is applicable.
|
AccessorNamingStrategy |
forRecord(MapperConfig<?> config,
AnnotatedClass recordClass)
Factory method for creating strategy instance for special
java.lang.Record
type (new in JDK 14). |
DefaultAccessorNamingStrategy.Provider |
withBaseNameValidator(DefaultAccessorNamingStrategy.BaseNameValidator vld)
Mutant factory for specifying validator that is used to further verify that
base name derived from accessor name is acceptable: this can be used to add
further restrictions such as limit that the first character of the base name
is an upper-case letter.
|
DefaultAccessorNamingStrategy.Provider |
withBuilderPrefix(String prefix)
Mutant factory for changing the prefix used for Builders
(from default
JsonPOJOBuilder.DEFAULT_WITH_PREFIX ) |
DefaultAccessorNamingStrategy.Provider |
withFirstCharAcceptance(boolean allowLowerCaseFirstChar,
boolean allowNonLetterFirstChar)
Mutant factory for changing the rules regarding which characters
are allowed as the first character of property base name, after
checking and removing prefix.
|
DefaultAccessorNamingStrategy.Provider |
withGetterPrefix(String prefix)
Mutant factory for changing the prefix used for "getter"
methods
|
DefaultAccessorNamingStrategy.Provider |
withIsGetterPrefix(String prefix)
Mutant factory for changing the prefix used for "is-getter"
methods (getters that return boolean/Boolean value).
|
DefaultAccessorNamingStrategy.Provider |
withSetterPrefix(String prefix)
Mutant factory for changing the prefix used for "setter"
methods
|
protected final String _setterPrefix
protected final String _withPrefix
protected final String _getterPrefix
protected final String _isGetterPrefix
protected final DefaultAccessorNamingStrategy.BaseNameValidator _baseNameValidator
public Provider()
protected Provider(DefaultAccessorNamingStrategy.Provider p, String setterPrefix, String withPrefix, String getterPrefix, String isGetterPrefix)
protected Provider(DefaultAccessorNamingStrategy.Provider p, DefaultAccessorNamingStrategy.BaseNameValidator vld)
protected Provider(String setterPrefix, String withPrefix, String getterPrefix, String isGetterPrefix, DefaultAccessorNamingStrategy.BaseNameValidator vld)
public DefaultAccessorNamingStrategy.Provider withSetterPrefix(String prefix)
prefix
- Prefix to use; or empty String ""
to not use
any prefix (meaning signature-compatible method name is used as
the property basename (and subject to name mangling)),
or null
to prevent name-based detection.public DefaultAccessorNamingStrategy.Provider withBuilderPrefix(String prefix)
JsonPOJOBuilder.DEFAULT_WITH_PREFIX
)prefix
- Prefix to use; or empty String ""
to not use
any prefix (meaning signature-compatible method name is used as
the property basename (and subject to name mangling)),
or null
to prevent name-based detection.public DefaultAccessorNamingStrategy.Provider withGetterPrefix(String prefix)
prefix
- Prefix to use; or empty String ""
to not use
any prefix (meaning signature-compatible method name is used as
the property basename (and subject to name mangling)),
or null
to prevent name-based detection.public DefaultAccessorNamingStrategy.Provider withIsGetterPrefix(String prefix)
prefix
- Prefix to use; or empty String ""
to not use
any prefix (meaning signature-compatible method name is used as
the property basename (and subject to name mangling)).
or null
to prevent name-based detection.public DefaultAccessorNamingStrategy.Provider withFirstCharAcceptance(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar)
For example, consider "getter" method candidate (no arguments, has return
type) named getValue()
is considered, with "getter-prefix"
defined as get
, then base name is Value
and the
first character to consider is V
. Upper-case letters are
always accepted so this is fine.
But with similar settings, method get_value()
would only be
recognized as getter if allowNonLetterFirstChar
is set to
true
: otherwise it will not be considered a getter-method.
Similarly "is-getter" candidate method with name island()
would only be considered if allowLowerCaseFirstChar
is set
to true
.
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()
and setvalue()
.allowNonLetterFirstChar
- Whether base names that start with non-letter
character (like "_"
or number 1
) are accepted as valid or not:
consider difference between "setter-methods" setValue()
and set_value()
.public DefaultAccessorNamingStrategy.Provider withBaseNameValidator(DefaultAccessorNamingStrategy.BaseNameValidator vld)
vld
- Validator to use, if any; null
to indicate no additional rulespublic AccessorNamingStrategy forPOJO(MapperConfig<?> config, AnnotatedClass targetClass)
AccessorNamingStrategy.Provider
forPOJO
in class AccessorNamingStrategy.Provider
config
- Current mapper configurationtargetClass
- Information about value typepublic AccessorNamingStrategy forBuilder(MapperConfig<?> config, AnnotatedClass builderClass, BeanDescription valueTypeDesc)
AccessorNamingStrategy.Provider
forBuilder
in class AccessorNamingStrategy.Provider
config
- Current mapper configurationbuilderClass
- Information about builder typevalueTypeDesc
- Information about the eventual target (value) typepublic AccessorNamingStrategy forRecord(MapperConfig<?> config, AnnotatedClass recordClass)
AccessorNamingStrategy.Provider
java.lang.Record
type (new in JDK 14).forRecord
in class AccessorNamingStrategy.Provider
config
- Current mapper configurationrecordClass
- Information about value type (of type java.lang.Record
)Copyright © 2008–2024 FasterXML. All rights reserved.