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

public abstract Class PropertyNamingStrategies

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
com.fasterxml.jackson.databind.cfg.MapperConfig, com.fasterxml.jackson.databind.introspect.AnnotatedField, .AnnotatedMethod, .AnnotatedParameter

Container for standard PropertyNamingStrategy implementations and singleton instances.

Added in Jackson 2.12 to resolve issue databind#2715.

Since
2.12

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
PropertyNamingStrategies.KebabCaseStrategy

Naming strategy similar to PropertyNamingStrategies.SnakeCaseStrategy, but instead of underscores as separators, uses hyphens.

public static class
PropertyNamingStrategies.LowerCamelCaseStrategy

"No-operation" strategy that is equivalent to not specifying any strategy: will simply return suggested standard bean naming as-is.

public static class
PropertyNamingStrategies.LowerCaseStrategy

Simple strategy where external name simply only uses lower-case characters, and no separators.

public static class
PropertyNamingStrategies.LowerDotCaseStrategy

Naming strategy similar to PropertyNamingStrategies.KebabCaseStrategy, but instead of hyphens as separators, uses dots.

public abstract static class
PropertyNamingStrategies.NamingBase

Intermediate base class for simple implementations

public static class
PropertyNamingStrategies.SnakeCaseStrategy

A PropertyNamingStrategy that translates typical camel case Java property names to lower case JSON element names, separated by underscores.

public static class
PropertyNamingStrategies.UpperCamelCaseStrategy

A PropertyNamingStrategy that translates typical camelCase Java property names to PascalCase JSON element names (i.e., with a capital first letter).

public static class
PropertyNamingStrategies.UpperSnakeCaseStrategy

A PropertyNamingStrategy that translates an input to the equivalent upper case snake case.

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategy
KEBAB_CASE

Naming convention used in languages like Lisp, where words are in lower-case letters, separated by hyphens.

public static final PropertyNamingStrategy
LOWER_CAMEL_CASE

Naming convention used in Java, where words other than first are capitalized and no separator is used between words.

public static final PropertyNamingStrategy
LOWER_CASE

Naming convention in which all words of the logical name are in lower case, and no separator is used between words.

public static final PropertyNamingStrategy
LOWER_DOT_CASE

Naming convention widely used as configuration properties name, where words are in lower-case letters, separated by dots.

private static final long
public static final PropertyNamingStrategy
SNAKE_CASE

Naming convention used in languages like C, where words are in lower-case letters, separated by underscores.

public static final PropertyNamingStrategy
UPPER_CAMEL_CASE

Naming convention used in languages like Pascal, where all words are capitalized and no separator is used between words.

public static final PropertyNamingStrategy
UPPER_SNAKE_CASE

Naming convention in which the words are in upper-case letters, separated by underscores.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

KEBAB_CASEback to summary
public static final PropertyNamingStrategy KEBAB_CASE

Naming convention used in languages like Lisp, where words are in lower-case letters, separated by hyphens. See KebabCaseStrategy for details.

Example external property names would be "number-value", "naming-strategy", "the-definite-proof".

LOWER_CAMEL_CASEback to summary
public static final PropertyNamingStrategy LOWER_CAMEL_CASE

Naming convention used in Java, where words other than first are capitalized and no separator is used between words. Since this is the native Java naming convention, naming strategy will not do any transformation between names in data (JSON) and POJOS.

Example external property names would be "numberValue", "namingStrategy", "theDefiniteProof".

LOWER_CASEback to summary
public static final PropertyNamingStrategy LOWER_CASE

Naming convention in which all words of the logical name are in lower case, and no separator is used between words. See LowerCaseStrategy for details.

Example external property names would be "numbervalue", "namingstrategy", "thedefiniteproof".

LOWER_DOT_CASEback to summary
public static final PropertyNamingStrategy LOWER_DOT_CASE

Naming convention widely used as configuration properties name, where words are in lower-case letters, separated by dots. See LowerDotCaseStrategy for details.

Example external property names would be "number.value", "naming.strategy", "the.definite.proof".

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

Naming convention used in languages like C, where words are in lower-case letters, separated by underscores. See SnakeCaseStrategy for details.

Example external property names would be "number_value", "naming_strategy", "the_definite_proof".

UPPER_CAMEL_CASEback to summary
public static final PropertyNamingStrategy UPPER_CAMEL_CASE

Naming convention used in languages like Pascal, where all words are capitalized and no separator is used between words. See UpperCamelCaseStrategy for details.

Example external property names would be "NumberValue", "NamingStrategy", "TheDefiniteProof".

UPPER_SNAKE_CASEback to summary
public static final PropertyNamingStrategy UPPER_SNAKE_CASE

Naming convention in which the words are in upper-case letters, separated by underscores. See UpperSnakeCaseStrategy for details.

Since
2.13

Constructor Detail

PropertyNamingStrategiesback to summary
public PropertyNamingStrategies()
com.fasterxml.jackson.databind back to summary

public Class PropertyNamingStrategies.KebabCaseStrategy

extends NamingBase
Class Inheritance

Naming strategy similar to PropertyNamingStrategies.SnakeCaseStrategy, but instead of underscores as separators, uses hyphens. Naming convention traditionally used for languages like Lisp.

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategies.KebabCaseStrategy
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Field Detail

INSTANCEback to summary
public static final PropertyNamingStrategies.KebabCaseStrategy INSTANCE
Since
2.14
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.serialVersionUID.

Constructor Detail

KebabCaseStrategyback to summary
public KebabCaseStrategy()

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.translate.

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

public Class PropertyNamingStrategies.LowerCamelCaseStrategy

extends NamingBase
Class Inheritance

"No-operation" strategy that is equivalent to not specifying any strategy: will simply return suggested standard bean naming as-is.

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategies.LowerCamelCaseStrategy
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Field Detail

INSTANCEback to summary
public static final PropertyNamingStrategies.LowerCamelCaseStrategy INSTANCE
Since
2.14
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.serialVersionUID.

Constructor Detail

LowerCamelCaseStrategyback to summary
public LowerCamelCaseStrategy()

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.translate.

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

public Class PropertyNamingStrategies.LowerCaseStrategy

extends NamingBase
Class Inheritance

Simple strategy where external name simply only uses lower-case characters, and no separators. Conversion from internal name like "someOtherValue" would be into external name if "someothervalue".

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategies.LowerCaseStrategy
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Field Detail

INSTANCEback to summary
public static final PropertyNamingStrategies.LowerCaseStrategy INSTANCE
Since
2.14
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.serialVersionUID.

Constructor Detail

LowerCaseStrategyback to summary
public LowerCaseStrategy()

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.translate.

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

public Class PropertyNamingStrategies.LowerDotCaseStrategy

extends NamingBase
Class Inheritance

Naming strategy similar to PropertyNamingStrategies.KebabCaseStrategy, but instead of hyphens as separators, uses dots. Naming convention widely used as configuration properties name.

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategies.LowerDotCaseStrategy
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Field Detail

INSTANCEback to summary
public static final PropertyNamingStrategies.LowerDotCaseStrategy INSTANCE
Since
2.14
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.serialVersionUID.

Constructor Detail

LowerDotCaseStrategyback to summary
public LowerDotCaseStrategy()

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.translate.

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

public abstract Class PropertyNamingStrategies.NamingBase

extends PropertyNamingStrategy
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategies.LowerCamelCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategies.UpperCamelCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategies.LowerCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategies.KebabCaseStrategy, com.fasterxml.jackson.databind.PropertyNamingStrategies.LowerDotCaseStrategy

Intermediate base class for simple implementations

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategy:
KEBAB_CASELOWER_CAMEL_CASELOWER_CASELOWER_DOT_CASESNAKE_CASEUPPER_CAMEL_CASE

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
)

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 String
translateLowerCaseWithSeparator(final String input, final char separator)

Helper method to share implementation between snake and dotted case.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.PropertyNamingStrategy.serialVersionUID.

Constructor Detail

NamingBaseback to summary
public NamingBase()

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 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 PropertyNamingStrategies.SnakeCaseStrategy

extends NamingBase
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.databind.PropertyNamingStrategies.UpperSnakeCaseStrategy

A PropertyNamingStrategy that translates typical camel case Java property names to lower case JSON element names, separated by underscores. This implementation is somewhat lenient, in that it provides some additional translations beyond strictly translating from camel case only. In particular, the following translations are applied by this PropertyNamingStrategy.

These rules result in the following additional example translations from Java property names to JSON element names.

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategies.SnakeCaseStrategy
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Field Detail

INSTANCEback to summary
public static final PropertyNamingStrategies.SnakeCaseStrategy INSTANCE
Since
2.14
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.serialVersionUID.

Constructor Detail

SnakeCaseStrategyback to summary
public SnakeCaseStrategy()

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.translate.

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

public Class PropertyNamingStrategies.UpperCamelCaseStrategy

extends NamingBase
Class Inheritance

A PropertyNamingStrategy that translates typical camelCase Java property names to PascalCase JSON element names (i.e., with a capital first letter). In particular, the following translations are applied by this PropertyNamingStrategy. This rules result in the following example translation from Java property names to JSON element names.

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategies.UpperCamelCaseStrategy
private static final long

Constructor Summary

AccessConstructor and Description
public

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.PropertyNamingStrategies.NamingBase.translate.

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

Inherited from com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase:
nameForConstructorParameternameForFieldnameForGetterMethodnameForSetterMethodtranslateLowerCaseWithSeparator

Field Detail

INSTANCEback to summary
public static final PropertyNamingStrategies.UpperCamelCaseStrategy INSTANCE
Since
2.14
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.serialVersionUID.

Constructor Detail

UpperCamelCaseStrategyback to summary
public UpperCamelCaseStrategy()

Method Detail

translateback to summary
public String translate(String input)

Implements abstract com.fasterxml.jackson.databind.PropertyNamingStrategies.NamingBase.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
com.fasterxml.jackson.databind back to summary

public Class PropertyNamingStrategies.UpperSnakeCaseStrategy

extends SnakeCaseStrategy
Class Inheritance

A PropertyNamingStrategy that translates an input to the equivalent upper case snake case. The class extends PropertyNamingStrategies.SnakeCaseStrategy to retain the snake case conversion functionality offered by the strategy.
Since
2.13

Field Summary

Modifier and TypeField and Description
public static final PropertyNamingStrategies.UpperSnakeCaseStrategy
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Field Detail

INSTANCEback to summary
public static final PropertyNamingStrategies.UpperSnakeCaseStrategy INSTANCE

Hides com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy.INSTANCE.

Since
2.14
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy.serialVersionUID.

Constructor Detail

UpperSnakeCaseStrategyback to summary
public UpperSnakeCaseStrategy()

Method Detail

translateback to summary
public String translate(String input)

Overrides com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy.translate.

Annotations
@Override