public static class DefaultAccessorNamingStrategy.Provider extends AccessorNamingStrategy.Provider implements java.io.Serializable
DefaultAccessorNamingStrategy.
Default instance will use following default prefixes:
DefaultAccessorNamingStrategy.BaseNameValidator), allowing names like
"get_value()" and "getvalue()".| Constructor and Description |
|---|
Provider() |
| 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(java.lang.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(java.lang.String prefix)
Mutant factory for changing the prefix used for "getter"
methods
|
DefaultAccessorNamingStrategy.Provider |
withIsGetterPrefix(java.lang.String prefix)
Mutant factory for changing the prefix used for "is-getter"
methods (getters that return boolean/Boolean value).
|
DefaultAccessorNamingStrategy.Provider |
withSetterPrefix(java.lang.String prefix)
Mutant factory for changing the prefix used for "setter"
methods
|
public DefaultAccessorNamingStrategy.Provider withSetterPrefix(java.lang.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(java.lang.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(java.lang.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(java.lang.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.ProviderforPOJO in class AccessorNamingStrategy.Providerconfig - Current mapper configurationtargetClass - Information about value typepublic AccessorNamingStrategy forBuilder(MapperConfig<?> config, AnnotatedClass builderClass, BeanDescription valueTypeDesc)
AccessorNamingStrategy.ProviderforBuilder in class AccessorNamingStrategy.Providerconfig - Current mapper configurationbuilderClass - Information about builder typevalueTypeDesc - Information about the eventual target (value) typepublic AccessorNamingStrategy forRecord(MapperConfig<?> config, AnnotatedClass recordClass)
AccessorNamingStrategy.Providerjava.lang.Record
type (new in JDK 14).forRecord in class AccessorNamingStrategy.Providerconfig - Current mapper configurationrecordClass - Information about value type (of type java.lang.Record)Copyright © 2010 - 2023 Adobe. All Rights Reserved