Top Description Inners Fields Constructors Methods
com.fasterxml.jackson.databind.introspect

public Class DefaultAccessorNamingStrategy

extends AccessorNamingStrategy
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy.RecordNaming
Imports
java.util.Arrays, .Collections, .HashSet, .Set, java.util.concurrent.atomic.AtomicBoolean, com.fasterxml.jackson.databind.AnnotationIntrospector, .BeanDescription, .JavaType, .MapperFeature, com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder, com.fasterxml.jackson.databind.cfg.MapperConfig, com.fasterxml.jackson.databind.jdk14.JDK14Util

Default AccessorNamingStrategy used by Jackson: to be used either as-is, or as base-class with overrides.
Since
2.12

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
DefaultAccessorNamingStrategy.BaseNameValidator

Definition of a handler API to use for checking whether given base name (remainder of accessor method name after removing prefix) is acceptable based on various rules.

public static class
DefaultAccessorNamingStrategy.FirstCharBasedValidator

Simple implementation of BaseNameValidator that checks the first character and nothing else.

public static class
public static class
DefaultAccessorNamingStrategy.RecordNaming

Implementation used for supporting "non-prefix" naming convention of Java 14 java.lang.Record types, and in particular find default accessors for declared record fields.

Field Summary

Modifier and TypeField and Description
protected final DefaultAccessorNamingStrategy.BaseNameValidator
_baseNameValidator

Optional validator for checking that base name

protected final MapperConfig<?>
protected final AnnotatedClass
protected final String
protected final String
protected final boolean
protected final String
_mutatorPrefix

Prefix used by auto-detected mutators ("setters"): usually "set", but differs for builder objects ("with" by default).

protected final boolean

Constructor Summary

AccessConstructor and Description
protected
DefaultAccessorNamingStrategy(MapperConfig<?> config, AnnotatedClass forClass, String mutatorPrefix, String getterPrefix, String isGetterPrefix, DefaultAccessorNamingStrategy.BaseNameValidator baseNameValidator)

Method Summary

Modifier and TypeMethod and Description
private boolean
protected boolean
protected boolean
public String
findNameForIsGetter(AnnotatedMethod
Method to check
am
,
String
Name to check (usually same as AnnotatedMethod#getName()
name
)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForIsGetter.

Method called to find whether given method would be considered an "is-getter" getter method in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property)

Note that signature acceptability has already been checked (no arguments, has return value) but NOT the specific limitation that return type should be of boolean type -- implementation should apply latter check, if so desired (some languages may use different criteria).

public String
findNameForMutator(AnnotatedMethod
Method to check
am
,
String
Name to check (usually same as AnnotatedMethod#getName()
name
)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForMutator.

Method called to find whether given method would be considered a "mutator" (usually setter, but for builders "with-method" or similar) in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property)

Note that signature acceptability has already been checked (exactly one parameter) by caller.

public String
findNameForRegularGetter(AnnotatedMethod
Method to check
am
,
String
Name to check (usually same as AnnotatedMethod#getName()
name
)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForRegularGetter.

Method called to find whether given method would be considered a "regular" getter method in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property)

Note that signature acceptability has already been checked (no arguments, does have a return value) by caller.

protected String
legacyManglePropertyName(final String
Name of accessor/mutator method, not including prefix ("get"/"is"/"set")
basename
,
final int offset)

Method called to figure out name of the property, given corresponding suggested name based on a method or field name.

public String
modifyFieldName(AnnotatedField
Field to check
field
,
String
Name to check (usually same as AnnotatedField#getName()
name
)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.modifyFieldName.

Method called to find the name of logical property that given field should be associated with, if any.

protected String
stdManglePropertyName(final String basename, final int offset)

Field Detail

_baseNameValidatorback to summary
protected final DefaultAccessorNamingStrategy.BaseNameValidator _baseNameValidator

Optional validator for checking that base name

_configback to summary
protected final MapperConfig<?> _config
_forClassback to summary
protected final AnnotatedClass _forClass
_getterPrefixback to summary
protected final String _getterPrefix
_isGetterPrefixback to summary
protected final String _isGetterPrefix
Since
2.14
_isGettersNonBooleanback to summary
protected final boolean _isGettersNonBoolean
_mutatorPrefixback to summary
protected final String _mutatorPrefix

Prefix used by auto-detected mutators ("setters"): usually "set", but differs for builder objects ("with" by default).

_stdBeanNamingback to summary
protected final boolean _stdBeanNaming

Constructor Detail

DefaultAccessorNamingStrategyback to summary
protected DefaultAccessorNamingStrategy(MapperConfig<?> config, AnnotatedClass forClass, String mutatorPrefix, String getterPrefix, String isGetterPrefix, DefaultAccessorNamingStrategy.BaseNameValidator baseNameValidator)

Method Detail

_booleanTypeback to summary
private boolean _booleanType(JavaType type)
_isCglibGetCallbacksback to summary
protected boolean _isCglibGetCallbacks(AnnotatedMethod am)
_isGroovyMetaClassGetterback to summary
protected boolean _isGroovyMetaClassGetter(AnnotatedMethod am)
findNameForIsGetterback to summary
public String findNameForIsGetter(AnnotatedMethod am, String name)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForIsGetter.

Doc from com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForIsGetter.

Method called to find whether given method would be considered an "is-getter" getter method in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property)

Note that signature acceptability has already been checked (no arguments, has return value) but NOT the specific limitation that return type should be of boolean type -- implementation should apply latter check, if so desired (some languages may use different criteria). It is also possible that some implementations allow different return types than boolean types.

Note that visibility checks are applied separately; strategy does not need to be concerned with that aspect.

Parameters
am:AnnotatedMethod

Method to check

name:String

Name to check (usually same as AnnotatedMethod#getName()

Returns:String

Implied property name for is-getter method, if match; null to indicate that the name does not conform to expected naming convention

Annotations
@Override
findNameForMutatorback to summary
public String findNameForMutator(AnnotatedMethod am, String name)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForMutator.

Doc from com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForMutator.

Method called to find whether given method would be considered a "mutator" (usually setter, but for builders "with-method" or similar) in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property)

Note that signature acceptability has already been checked (exactly one parameter) by caller.

Note that visibility checks are applied separately; strategy does not need to be concerned with that aspect.

Parameters
am:AnnotatedMethod

Method to check

name:String

Name to check (usually same as AnnotatedMethod#getName()

Returns:String

Implied property name for mutator method, if match; null to indicate that the name does not conform to expected naming convention

Annotations
@Override
findNameForRegularGetterback to summary
public String findNameForRegularGetter(AnnotatedMethod am, String name)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForRegularGetter.

Doc from com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForRegularGetter.

Method called to find whether given method would be considered a "regular" getter method in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property)

Note that signature acceptability has already been checked (no arguments, does have a return value) by caller.

Note that this method MAY be called for potential "is-getter" methods too (before findNameForIsGetter)

Note that visibility checks are applied separately; strategy does not need to be concerned with that aspect.

Parameters
am:AnnotatedMethod

Method to check

name:String

Name to check (usually same as AnnotatedMethod#getName()

Returns:String

Implied property name for getter method, if match; null to indicate that the name does not conform to expected naming convention

Annotations
@Override
legacyManglePropertyNameback to summary
protected String legacyManglePropertyName(final String basename, final int offset)

Method called to figure out name of the property, given corresponding suggested name based on a method or field name.

Parameters
basename:String

Name of accessor/mutator method, not including prefix ("get"/"is"/"set")

modifyFieldNameback to summary
public String modifyFieldName(AnnotatedField field, String name)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.modifyFieldName.

Doc from com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.modifyFieldName.

Method called to find the name of logical property that given field should be associated with, if any.

Note that visibility checks are applied separately; strategy does not need to be concerned with that aspect.

Parameters
field:AnnotatedField

Field to check

name:String

Name to check (usually same as AnnotatedField#getName()

Returns:String

Implied property name matching given field (often field name as-is) or null to indicate that the name does not conform to expected naming convention (and will not be considered for property access)

Annotations
@Override
stdManglePropertyNameback to summary
protected String stdManglePropertyName(final String basename, final int offset)
com.fasterxml.jackson.databind.introspect back to summary

public Interface DefaultAccessorNamingStrategy.BaseNameValidator

Known Direct Implementers
com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy.FirstCharBasedValidator

Definition of a handler API to use for checking whether given base name (remainder of accessor method name after removing prefix) is acceptable based on various rules.
Since
2.12

Method Summary

Modifier and TypeMethod and Description
public boolean
accept(char firstChar, String basename, int offset)

Method Detail

acceptback to summary
public boolean accept(char firstChar, String basename, int offset)
com.fasterxml.jackson.databind.introspect back to summary

public Class DefaultAccessorNamingStrategy.FirstCharBasedValidator

extends Object
implements BaseNameValidator
Class Inheritance
  • java.lang.Object
  • com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy.FirstCharBasedValidator
All Implemented Interfaces
com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy.BaseNameValidator

Simple implementation of BaseNameValidator that checks the first character and nothing else.

Instances are to be constructed using method FirstCharBasedValidator#forFirstNameRule.

Field Summary

Modifier and TypeField and Description
private final boolean
private final boolean

Constructor Summary

AccessConstructor and Description
protected
FirstCharBasedValidator(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar)

Method Summary

Modifier and TypeMethod and Description
public boolean
public static DefaultAccessorNamingStrategy.BaseNameValidator

Returns:

Validator instance to use, if any; null to indicate no additional rules applied (case when both arguments are false)
forFirstNameRule
(boolean
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().
allowLowerCaseFirstChar
,
boolean
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().
allowNonLetterFirstChar
)

Factory method to use for getting an instance with specified first-character restrictions, if any; or null if no checking is needed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_allowLowerCaseFirstCharback to summary
private final boolean _allowLowerCaseFirstChar
_allowNonLetterFirstCharback to summary
private final boolean _allowNonLetterFirstChar

Constructor Detail

FirstCharBasedValidatorback to summary
protected FirstCharBasedValidator(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar)

Method Detail

acceptback to summary
public boolean accept(char firstChar, String basename, int offset)

Implements com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy.BaseNameValidator.accept.

Annotations
@Override
forFirstNameRuleback to summary
public static DefaultAccessorNamingStrategy.BaseNameValidator forFirstNameRule(boolean allowLowerCaseFirstChar, boolean allowNonLetterFirstChar)

Factory method to use for getting an instance with specified first-character restrictions, if any; or null if no checking is needed.

Parameters
allowLowerCaseFirstChar:boolean

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:boolean

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().

Returns:DefaultAccessorNamingStrategy.BaseNameValidator

Validator instance to use, if any; null to indicate no additional rules applied (case when both arguments are false)

com.fasterxml.jackson.databind.introspect back to summary

public Class DefaultAccessorNamingStrategy.Provider

extends Provider
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Provider for DefaultAccessorNamingStrategy.

Default instance will use following default prefixes:

and no additional restrictions on base names accepted (configurable for limits using BaseNameValidator), allowing names like "get_value()" and "getvalue()".

Field Summary

Modifier and TypeField and Description
protected final DefaultAccessorNamingStrategy.BaseNameValidator
protected final String
protected final String
protected final String
protected final String
private static final long

Constructor Summary

AccessConstructor and Description
public
protected
Provider(DefaultAccessorNamingStrategy.Provider p, String setterPrefix, String withPrefix, String getterPrefix, String isGetterPrefix)

protected
protected
Provider(String setterPrefix, String withPrefix, String getterPrefix, String isGetterPrefix, DefaultAccessorNamingStrategy.BaseNameValidator vld)

Method Summary

Modifier and TypeMethod and Description
public AccessorNamingStrategy
forBuilder(MapperConfig<?>
Current mapper configuration
config
,
AnnotatedClass
Information about builder type
builderClass
,
BeanDescription
Information about the eventual target (value) type
valueTypeDesc
)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forBuilder.

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.

public AccessorNamingStrategy
forPOJO(MapperConfig<?>
Current mapper configuration
config
,
AnnotatedClass
Information about value type
targetClass
)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forPOJO.

Factory method for creating strategy instance for a "regular" POJO, called if none of the other factory methods is applicable.

public AccessorNamingStrategy
forRecord(MapperConfig<?>
Current mapper configuration
config
,
AnnotatedClass
Information about value type (of type java.lang.Record)
recordClass
)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forRecord.

Factory method for creating strategy instance for special java.lang.Record type (new in JDK 14).

public DefaultAccessorNamingStrategy.Provider

Returns:

Provider instance with specified base name validator to use, if any
withBaseNameValidator
(DefaultAccessorNamingStrategy.BaseNameValidator
Validator to use, if any; null to indicate no additional rules
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.

public DefaultAccessorNamingStrategy.Provider

Returns:

Provider instance with specified with-prefix
withBuilderPrefix
(String
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.
prefix
)

Mutant factory for changing the prefix used for Builders (from default JsonPOJOBuilder#DEFAULT_WITH_PREFIX)

public DefaultAccessorNamingStrategy.Provider

Returns:

Provider instance with specified validity rules
withFirstCharAcceptance
(boolean
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().
allowLowerCaseFirstChar
,
boolean
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().
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.

public DefaultAccessorNamingStrategy.Provider

Returns:

Provider instance with specified getter-prefix
withGetterPrefix
(String
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.
prefix
)

Mutant factory for changing the prefix used for "getter" methods

public DefaultAccessorNamingStrategy.Provider

Returns:

Provider instance with specified is-getter-prefix
withIsGetterPrefix
(String
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.
prefix
)

Mutant factory for changing the prefix used for "is-getter" methods (getters that return boolean/Boolean value).

public DefaultAccessorNamingStrategy.Provider

Returns:

Provider instance with specified setter-prefix
withSetterPrefix
(String
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.
prefix
)

Mutant factory for changing the prefix used for "setter" methods

Field Detail

_baseNameValidatorback to summary
protected final DefaultAccessorNamingStrategy.BaseNameValidator _baseNameValidator
_getterPrefixback to summary
protected final String _getterPrefix
_isGetterPrefixback to summary
protected final String _isGetterPrefix
_setterPrefixback to summary
protected final String _setterPrefix
_withPrefixback to summary
protected final String _withPrefix
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.serialVersionUID.

Constructor Detail

Providerback to summary
public Provider()
Providerback to summary
protected Provider(DefaultAccessorNamingStrategy.Provider p, String setterPrefix, String withPrefix, String getterPrefix, String isGetterPrefix)
Providerback to summary
protected Provider(DefaultAccessorNamingStrategy.Provider p, DefaultAccessorNamingStrategy.BaseNameValidator vld)
Providerback to summary
protected Provider(String setterPrefix, String withPrefix, String getterPrefix, String isGetterPrefix, DefaultAccessorNamingStrategy.BaseNameValidator vld)

Method Detail

forBuilderback to summary
public AccessorNamingStrategy forBuilder(MapperConfig<?> config, AnnotatedClass builderClass, BeanDescription valueTypeDesc)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forBuilder.

Doc from com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forBuilder.

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.

Parameters
config:MapperConfig<?>

Current mapper configuration

builderClass:AnnotatedClass

Information about builder type

valueTypeDesc:BeanDescription

Information about the eventual target (value) type

Returns:AccessorNamingStrategy

Naming strategy instance to use

Annotations
@Override
forPOJOback to summary
public AccessorNamingStrategy forPOJO(MapperConfig<?> config, AnnotatedClass targetClass)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forPOJO.

Doc from com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forPOJO.

Factory method for creating strategy instance for a "regular" POJO, called if none of the other factory methods is applicable.

Parameters
config:MapperConfig<?>

Current mapper configuration

targetClass:AnnotatedClass

Information about value type

Returns:AccessorNamingStrategy

Naming strategy instance to use

Annotations
@Override
forRecordback to summary
public AccessorNamingStrategy forRecord(MapperConfig<?> config, AnnotatedClass recordClass)

Implements abstract com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forRecord.

Doc from com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.Provider.forRecord.

Factory method for creating strategy instance for special java.lang.Record type (new in JDK 14).

Parameters
config:MapperConfig<?>

Current mapper configuration

recordClass:AnnotatedClass

Information about value type (of type java.lang.Record)

Returns:AccessorNamingStrategy

Naming strategy instance to use

Annotations
@Override
withBaseNameValidatorback to summary
public 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.

Parameters
vld:DefaultAccessorNamingStrategy.BaseNameValidator

Validator to use, if any; null to indicate no additional rules

Returns:DefaultAccessorNamingStrategy.Provider

Provider instance with specified base name validator to use, if any

withBuilderPrefixback to summary
public DefaultAccessorNamingStrategy.Provider withBuilderPrefix(String prefix)

Mutant factory for changing the prefix used for Builders (from default JsonPOJOBuilder#DEFAULT_WITH_PREFIX)

Parameters
prefix:String

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.

Returns:DefaultAccessorNamingStrategy.Provider

Provider instance with specified with-prefix

withFirstCharAcceptanceback to summary
public 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.

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.

Parameters
allowLowerCaseFirstChar:boolean

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:boolean

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().

Returns:DefaultAccessorNamingStrategy.Provider

Provider instance with specified validity rules

withGetterPrefixback to summary
public DefaultAccessorNamingStrategy.Provider withGetterPrefix(String prefix)

Mutant factory for changing the prefix used for "getter" methods

Parameters
prefix:String

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.

Returns:DefaultAccessorNamingStrategy.Provider

Provider instance with specified getter-prefix

withIsGetterPrefixback to summary
public DefaultAccessorNamingStrategy.Provider withIsGetterPrefix(String prefix)

Mutant factory for changing the prefix used for "is-getter" methods (getters that return boolean/Boolean value).

Parameters
prefix:String

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.

Returns:DefaultAccessorNamingStrategy.Provider

Provider instance with specified is-getter-prefix

withSetterPrefixback to summary
public DefaultAccessorNamingStrategy.Provider withSetterPrefix(String prefix)

Mutant factory for changing the prefix used for "setter" methods

Parameters
prefix:String

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.

Returns:DefaultAccessorNamingStrategy.Provider

Provider instance with specified setter-prefix

com.fasterxml.jackson.databind.introspect back to summary

public Class DefaultAccessorNamingStrategy.RecordNaming

extends DefaultAccessorNamingStrategy
Class Inheritance

Implementation used for supporting "non-prefix" naming convention of Java 14 java.lang.Record types, and in particular find default accessors for declared record fields.

Current / initial implementation will also recognize additional "normal" getters ("get"-prefix) and is-getters ("is"-prefix and boolean return value) by name.

Field Summary

Modifier and TypeField and Description
protected final Set<String>
_fieldNames

Names of actual Record fields from definition; auto-detected.

Inherited from com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy:
_baseNameValidator_config_forClass_getterPrefix_isGetterPrefix_isGettersNonBoolean_mutatorPrefix_stdBeanNaming

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
findNameForRegularGetter(AnnotatedMethod
Method to check
am
,
String
Name to check (usually same as AnnotatedMethod#getName()
name
)

Overrides com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy.findNameForRegularGetter.

Method called to find whether given method would be considered a "regular" getter method in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property)

Note that signature acceptability has already been checked (no arguments, does have a return value) by caller.

Inherited from com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy:
_isCglibGetCallbacks_isGroovyMetaClassGetterfindNameForIsGetterfindNameForMutatorlegacyManglePropertyNamemodifyFieldNamestdManglePropertyName

Field Detail

_fieldNamesback to summary
protected final Set<String> _fieldNames

Names of actual Record fields from definition; auto-detected.

Constructor Detail

RecordNamingback to summary
public RecordNaming(MapperConfig<?> config, AnnotatedClass forClass)

Method Detail

findNameForRegularGetterback to summary
public String findNameForRegularGetter(AnnotatedMethod am, String name)

Overrides com.fasterxml.jackson.databind.introspect.DefaultAccessorNamingStrategy.findNameForRegularGetter.

Doc from com.fasterxml.jackson.databind.introspect.AccessorNamingStrategy.findNameForRegularGetter.

Method called to find whether given method would be considered a "regular" getter method in context of type introspected, and if so, what is the logical property it is associated with (which in turn suggest external name for property)

Note that signature acceptability has already been checked (no arguments, does have a return value) by caller.

Note that this method MAY be called for potential "is-getter" methods too (before findNameForIsGetter)

Note that visibility checks are applied separately; strategy does not need to be concerned with that aspect.

Parameters
am:AnnotatedMethod

Method to check

name:String

Name to check (usually same as AnnotatedMethod#getName()

Returns:String

Implied property name for getter method, if match; null to indicate that the name does not conform to expected naming convention

Annotations
@Override