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

public Class PropertyNamingStrategy

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase, com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase
Annotations
@SuppressWarnings:serial
Imports
com.fasterxml.jackson.databind.cfg.MapperConfig, com.fasterxml.jackson.databind.introspect.AnnotatedField, .AnnotatedMethod, .AnnotatedParameter, java.util.logging.Logger

Class that defines how names of JSON properties ("external names") are derived from names of POJO methods and fields ("internal names"), in cases where no explicit annotations exist for naming. Methods are passed information about POJO member for which name is needed, as well as default name that would be used if no custom strategy was used.

Default (empty) implementation returns suggested ("implicit" or "default") name unmodified

Note that the strategy is guaranteed to be called once per logical property (which may be represented by multiple members; such as pair of a getter and a setter), but may be called for each: implementations should not count on exact number of times, and should work for any member that represent a property. Also note that calls are made during construction of serializers and deserializers which are typically cached, and not for every time serializer or deserializer is called.

In absence of a registered custom strategy, the default Java property naming strategy is used, which leaves field names as is, and removes set/get/is prefix from methods (as well as lower-cases initial sequence of capitalized characters).

Note

Since 2.12 sub-classes defined here (as well as static singleton instances thereof) are deprecated due to databind#2715. Please use constants and classes in PropertyNamingStrategies instead.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
PropertyNamingStrategy.KebabCaseStrategy

Deprecated Since 2.12 use PropertyNamingStrategies.KebabCaseStrategy instead (see databind#2715 for reason for deprecation)
public static class
PropertyNamingStrategy.LowerCaseStrategy

Deprecated Since 2.12 use PropertyNamingStrategies.LowerCaseStrategy instead (see databind#2715 for reason for deprecation)
public static class
PropertyNamingStrategy.LowerDotCaseStrategy

Deprecated Since 2.12 use PropertyNamingStrategies.LowerDotCaseStrategy instead (see databind#2715 for reason for deprecation)
public abstract static class
PropertyNamingStrategy.PropertyNamingStrategyBase

Deprecated Since 2.12 deprecated. See databind#2715 for reasons for deprecation.
public static class
PropertyNamingStrategy.SnakeCaseStrategy

Deprecated Since 2.12 use PropertyNamingStrategies.SnakeCaseStrategy instead (see databind#2715 for reason for deprecation)
public static class
PropertyNamingStrategy.UpperCamelCaseStrategy

Deprecated Since 2.12 use PropertyNamingStrategies.UpperCamelCaseStrategy instead (see databind#2715 for reason for deprecation)

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategy
KEBAB_CASE

Deprecated Since 2.12 deprecated.
public static final PropertyNamingStrategy
LOWER_CAMEL_CASE

Deprecated Since 2.12 deprecated.
public static final PropertyNamingStrategy
LOWER_CASE

Deprecated Since 2.12 deprecated.
public static final PropertyNamingStrategy
LOWER_DOT_CASE

Deprecated Since 2.12 deprecated.
private static final long
public static final PropertyNamingStrategy
SNAKE_CASE

Deprecated Since 2.12 deprecated.
public static final PropertyNamingStrategy
UPPER_CAMEL_CASE

Deprecated Since 2.12 deprecated.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
nameForConstructorParameter(MapperConfig<?>
Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization
config
,
AnnotatedParameter
Constructor parameter used to pass property.
ctorParam
,
String
Default name that would be used for property in absence of custom strategy
defaultName
)

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given constructor parameter; typically called when building a deserializer (but not necessarily only then).

public String

Returns:

Logical name to use for property that the field represents
nameForField
(MapperConfig<?>
Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization
config
,
AnnotatedField
Field used to access property
field
,
String
Default name that would be used for property in absence of custom strategy
defaultName
)

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given field.

public String

Returns:

Logical name to use for property that the method represents
nameForGetterMethod
(MapperConfig<?>
Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization
config
,
AnnotatedMethod
Method used to access property.
method
,
String
Default name that would be used for property in absence of custom strategy
defaultName
)

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given getter method; typically called when building a serializer.

public String

Returns:

Logical name to use for property that the method represents
nameForSetterMethod
(MapperConfig<?>
Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization
config
,
AnnotatedMethod
Method used to access property.
method
,
String
Default name that would be used for property in absence of custom strategy
defaultName
)

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given setter method; typically called when building a deserializer (but not necessarily only then).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

KEBAB_CASEback to summary
public static final PropertyNamingStrategy KEBAB_CASE

Deprecated

Since 2.12 deprecated. Use PropertyNamingStrategies#KEBAB_CASE instead. See databind#2715 for reasons for deprecation.

Annotations
@Deprecated
LOWER_CAMEL_CASEback to summary
public static final PropertyNamingStrategy LOWER_CAMEL_CASE

Deprecated

Since 2.12 deprecated. Use PropertyNamingStrategies#LOWER_CAMEL_CASE instead. See databind#2715 for reasons for deprecation.

Annotations
@Deprecated
LOWER_CASEback to summary
public static final PropertyNamingStrategy LOWER_CASE

Deprecated

Since 2.12 deprecated. Use PropertyNamingStrategies#LOWER_CASE instead. See databind#2715 for reasons for deprecation.

Annotations
@Deprecated
LOWER_DOT_CASEback to summary
public static final PropertyNamingStrategy LOWER_DOT_CASE

Deprecated

Since 2.12 deprecated. Use PropertyNamingStrategies#LOWER_DOT_CASE instead. See databind#2715 for reasons for deprecation.

Annotations
@Deprecated
serialVersionUIDback to summary
private static final long serialVersionUID
SNAKE_CASEback to summary
public static final PropertyNamingStrategy SNAKE_CASE

Deprecated

Since 2.12 deprecated. Use PropertyNamingStrategies#SNAKE_CASE instead. See databind#2715 for reasons for deprecation.

Annotations
@Deprecated
UPPER_CAMEL_CASEback to summary
public static final PropertyNamingStrategy UPPER_CAMEL_CASE

Deprecated

Since 2.12 deprecated. Use PropertyNamingStrategies#UPPER_CAMEL_CASE instead. See databind#2715 for reasons for deprecation.

Annotations
@Deprecated

Constructor Detail

PropertyNamingStrategyback to summary
public PropertyNamingStrategy()

Method Detail

nameForConstructorParameterback to summary
public String nameForConstructorParameter(MapperConfig<?> config, AnnotatedParameter ctorParam, String defaultName)

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given constructor parameter; typically called when building a deserializer (but not necessarily only then).

Parameters
config:MapperConfig<?>

Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization

ctorParam:AnnotatedParameter

Constructor parameter used to pass property.

defaultName:String

Default name that would be used for property in absence of custom strategy

nameForFieldback to summary
public String nameForField(MapperConfig<?> config, AnnotatedField field, String defaultName)

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given field.

Parameters
config:MapperConfig<?>

Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization

field:AnnotatedField

Field used to access property

defaultName:String

Default name that would be used for property in absence of custom strategy

Returns:String

Logical name to use for property that the field represents

nameForGetterMethodback to summary
public String nameForGetterMethod(MapperConfig<?> config, AnnotatedMethod method, String defaultName)

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given getter method; typically called when building a serializer. (but not always -- when using "getter-as-setter", may be called during deserialization)

Parameters
config:MapperConfig<?>

Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization

method:AnnotatedMethod

Method used to access property.

defaultName:String

Default name that would be used for property in absence of custom strategy

Returns:String

Logical name to use for property that the method represents

nameForSetterMethodback to summary
public String nameForSetterMethod(MapperConfig<?> config, AnnotatedMethod method, String defaultName)

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given setter method; typically called when building a deserializer (but not necessarily only then).

Parameters
config:MapperConfig<?>

Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization

method:AnnotatedMethod

Method used to access property.

defaultName:String

Default name that would be used for property in absence of custom strategy

Returns:String

Logical name to use for property that the method represents

com.fasterxml.jackson.databind back to summary

public Class PropertyNamingStrategy.KebabCaseStrategy

extends PropertyNamingStrategyBase
Class Inheritance
Annotations
@Deprecated

Deprecated

Since 2.12 use PropertyNamingStrategies.KebabCaseStrategy instead (see databind#2715 for reason for deprecation)

Constructor Summary

AccessConstructor and Description
public
protected
KebabCaseStrategy(boolean logWarning)

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Constructor Detail

KebabCaseStrategyback to summary
public KebabCaseStrategy()
KebabCaseStrategyback to summary
protected KebabCaseStrategy(boolean logWarning)

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase.translate.

Annotations
@Override
com.fasterxml.jackson.databind back to summary

public Class PropertyNamingStrategy.LowerCaseStrategy

extends PropertyNamingStrategyBase
Class Inheritance
Annotations
@Deprecated

Deprecated

Since 2.12 use PropertyNamingStrategies.LowerCaseStrategy instead (see databind#2715 for reason for deprecation)

Constructor Summary

AccessConstructor and Description
public
protected
LowerCaseStrategy(boolean logWarning)

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Constructor Detail

LowerCaseStrategyback to summary
public LowerCaseStrategy()
LowerCaseStrategyback to summary
protected LowerCaseStrategy(boolean logWarning)

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase.translate.

Annotations
@Override
com.fasterxml.jackson.databind back to summary

public Class PropertyNamingStrategy.LowerDotCaseStrategy

extends PropertyNamingStrategyBase
Class Inheritance
Annotations
@Deprecated

Deprecated

Since 2.12 use PropertyNamingStrategies.LowerDotCaseStrategy instead (see databind#2715 for reason for deprecation)

Constructor Summary

AccessConstructor and Description
public
protected
LowerDotCaseStrategy(boolean logWarning)

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Constructor Detail

LowerDotCaseStrategyback to summary
public LowerDotCaseStrategy()
LowerDotCaseStrategyback to summary
protected LowerDotCaseStrategy(boolean logWarning)

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase.translate.

Annotations
@Override
com.fasterxml.jackson.databind back to summary

public abstract Class PropertyNamingStrategy.PropertyNamingStrategyBase

extends PropertyNamingStrategy
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategy.UpperCamelCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategy.KebabCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategy.LowerDotCaseStrategy
Annotations
@Deprecated

Deprecated

Since 2.12 deprecated. See databind#2715 for reasons for deprecation.

Field Summary

Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategy:
KEBAB_CASELOWER_CAMEL_CASELOWER_CASELOWER_DOT_CASESNAKE_CASEUPPER_CAMEL_CASE

Constructor Summary

AccessConstructor and Description
protected
protected
PropertyNamingStrategyBase(boolean logWarning)

Method Summary

Modifier and TypeMethod and Description
public String
nameForConstructorParameter(MapperConfig<?>
Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization
config
,
AnnotatedParameter
Constructor parameter used to pass property.
ctorParam
,
String
Default name that would be used for property in absence of custom strategy
defaultName
)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForConstructorParameter.

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given constructor parameter; typically called when building a deserializer (but not necessarily only then).

public String
nameForField(MapperConfig<?>
Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization
config
,
AnnotatedField
Field used to access property
field
,
String
Default name that would be used for property in absence of custom strategy
defaultName
)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForField.

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given field.

public String
nameForGetterMethod(MapperConfig<?>
Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization
config
,
AnnotatedMethod
Method used to access property.
method
,
String
Default name that would be used for property in absence of custom strategy
defaultName
)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForGetterMethod.

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given getter method; typically called when building a serializer.

public String
nameForSetterMethod(MapperConfig<?>
Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization
config
,
AnnotatedMethod
Method used to access property.
method
,
String
Default name that would be used for property in absence of custom strategy
defaultName
)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForSetterMethod.

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given setter method; typically called when building a deserializer (but not necessarily only then).

public abstract String
translate(String propertyName)

protected static String
translateLowerCaseWithSeparator(final String input, final char separator)

Helper method to share implementation between snake and dotted case.

Constructor Detail

PropertyNamingStrategyBaseback to summary
protected PropertyNamingStrategyBase()
PropertyNamingStrategyBaseback to summary
protected PropertyNamingStrategyBase(boolean logWarning)

Method Detail

nameForConstructorParameterback to summary
public String nameForConstructorParameter(MapperConfig<?> config, AnnotatedParameter ctorParam, String defaultName)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForConstructorParameter.

Doc from com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForConstructorParameter.

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given constructor parameter; typically called when building a deserializer (but not necessarily only then).

Parameters
config:MapperConfig<?>

Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization

ctorParam:AnnotatedParameter

Constructor parameter used to pass property.

defaultName:String

Default name that would be used for property in absence of custom strategy

Annotations
@Override
nameForFieldback to summary
public String nameForField(MapperConfig<?> config, AnnotatedField field, String defaultName)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForField.

Doc from com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForField.

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given field.

Parameters
config:MapperConfig<?>

Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization

field:AnnotatedField

Field used to access property

defaultName:String

Default name that would be used for property in absence of custom strategy

Returns:String

Logical name to use for property that the field represents

Annotations
@Override
nameForGetterMethodback to summary
public String nameForGetterMethod(MapperConfig<?> config, AnnotatedMethod method, String defaultName)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForGetterMethod.

Doc from com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForGetterMethod.

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given getter method; typically called when building a serializer. (but not always -- when using "getter-as-setter", may be called during deserialization)

Parameters
config:MapperConfig<?>

Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization

method:AnnotatedMethod

Method used to access property.

defaultName:String

Default name that would be used for property in absence of custom strategy

Returns:String

Logical name to use for property that the method represents

Annotations
@Override
nameForSetterMethodback to summary
public String nameForSetterMethod(MapperConfig<?> config, AnnotatedMethod method, String defaultName)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForSetterMethod.

Doc from com.fasterxml.jackson.databind.PropertyNamingStrategy.nameForSetterMethod.

Method called to find external name (name used in JSON) for given logical POJO property, as defined by given setter method; typically called when building a deserializer (but not necessarily only then).

Parameters
config:MapperConfig<?>

Configuration in used: either SerializationConfig or DeserializationConfig, depending on whether method is called during serialization or deserialization

method:AnnotatedMethod

Method used to access property.

defaultName:String

Default name that would be used for property in absence of custom strategy

Returns:String

Logical name to use for property that the method represents

Annotations
@Override
translateback to summary
public abstract String translate(String propertyName)
translateLowerCaseWithSeparatorback to summary
protected static String translateLowerCaseWithSeparator(final String input, final char separator)

Helper method to share implementation between snake and dotted case.

com.fasterxml.jackson.databind back to summary

public Class PropertyNamingStrategy.SnakeCaseStrategy

extends PropertyNamingStrategyBase
Class Inheritance
Annotations
@Deprecated

Deprecated

Since 2.12 use PropertyNamingStrategies.SnakeCaseStrategy instead (see databind#2715 for reason for deprecation)

Constructor Summary

AccessConstructor and Description
public
protected
SnakeCaseStrategy(boolean logWarning)

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Constructor Detail

SnakeCaseStrategyback to summary
public SnakeCaseStrategy()
SnakeCaseStrategyback to summary
protected SnakeCaseStrategy(boolean logWarning)

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase.translate.

Annotations
@Override
com.fasterxml.jackson.databind back to summary

public Class PropertyNamingStrategy.UpperCamelCaseStrategy

extends PropertyNamingStrategyBase
Class Inheritance
Annotations
@Deprecated

Deprecated

Since 2.12 use PropertyNamingStrategies.UpperCamelCaseStrategy instead (see databind#2715 for reason for deprecation)

Constructor Summary

AccessConstructor and Description
public
protected
UpperCamelCaseStrategy(boolean logWarning)

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

input converted to PascalCase format
translate
(String
formatted as camelCase string
input
)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase.translate.

Converts camelCase to PascalCase For example, "userName" would be converted to "UserName".

Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Constructor Detail

UpperCamelCaseStrategyback to summary
public UpperCamelCaseStrategy()
UpperCamelCaseStrategyback to summary
protected UpperCamelCaseStrategy(boolean logWarning)

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase.translate.

Converts camelCase to PascalCase For example, "userName" would be converted to "UserName".

Parameters
input:String

formatted as camelCase string

Returns:String

input converted to PascalCase format

Annotations
@Override