Top Description Inners Fields Constructors Methods
tools.jackson.databind

public Class EnumNamingStrategies

extends Object
Class Inheritance
Imports
java.util.Locale, tools.jackson.databind.cfg.MapperConfig, tools.jackson.databind.introspect.AnnotatedClass, tools.jackson.databind.util.NamingStrategyImpls

A container class for implementations of the EnumNamingStrategy interface.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
public static class
EnumNamingStrategies.KebabCaseStrategy

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format.

public static class
EnumNamingStrategies.LowerCamelCaseStrategy

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to lower camel case format.

public static class
EnumNamingStrategies.LowerCaseStrategy

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format.

public static class
EnumNamingStrategies.LowerDotCaseStrategy

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to lower dot case format.

public static class
EnumNamingStrategies.SnakeCaseStrategy

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format.

public static class
EnumNamingStrategies.UpperCamelCaseStrategy

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format.

public static class
EnumNamingStrategies.UpperSnakeCaseStrategy

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format.

Field Summary

Modifier and TypeField and Description
public static final EnumNamingStrategy
KEBAB_CASE

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

public static final EnumNamingStrategy
LOWER_CAMEL_CASE

Words other than first are capitalized and no separator is used between words.

public static final EnumNamingStrategy
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 EnumNamingStrategy
LOWER_DOT_CASE

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

public static final EnumNamingStrategy
SNAKE_CASE

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

public static final EnumNamingStrategy
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 EnumNamingStrategy
UPPER_SNAKE_CASE

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

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

KEBAB_CASEback to summary
public static final EnumNamingStrategy KEBAB_CASE

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

Example "ENUM_NAME" would be converted to "enum-name".

LOWER_CAMEL_CASEback to summary
public static final EnumNamingStrategy LOWER_CAMEL_CASE

Words other than first are capitalized and no separator is used between words. See EnumNamingStrategies.LowerCamelCaseStrategy for details.

Example "ENUM_NAME" would be converted to "enumName".

LOWER_CASEback to summary
public static final EnumNamingStrategy LOWER_CASE

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

Example "ENUM_NAME" would be converted to "enumname".

LOWER_DOT_CASEback to summary
public static final EnumNamingStrategy LOWER_DOT_CASE

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

Example "ENUM_NAME" would be converted to "enum.name".

SNAKE_CASEback to summary
public static final EnumNamingStrategy SNAKE_CASE

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

Example "ENUM_NAME" would be converted to "enum_name".

UPPER_CAMEL_CASEback to summary
public static final EnumNamingStrategy UPPER_CAMEL_CASE

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

Example "ENUM_NAME" would be converted to "EnumName".

UPPER_SNAKE_CASEback to summary
public static final EnumNamingStrategy UPPER_SNAKE_CASE

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

Example "ENUM_NAME" would be converted to "ENUM_NAME", but "__ENUM_NAME_" would also be converted to "ENUM_NAME".

Constructor Detail

EnumNamingStrategiesback to summary
private EnumNamingStrategies()
tools.jackson.databind back to summary

public abstract Class EnumNamingStrategies.DelegatingEnumNamingStrategy

extends Object
implements EnumNamingStrategy
Class Inheritance
  • java.lang.Object
  • tools.jackson.databind.EnumNamingStrategies.DelegatingEnumNamingStrategy
All Implemented Interfaces
tools.jackson.databind.EnumNamingStrategy
Known Direct Subclasses
tools.jackson.databind.EnumNamingStrategies.LowerCamelCaseStrategy, tools.jackson.databind.EnumNamingStrategies.UpperCamelCaseStrategy, tools.jackson.databind.EnumNamingStrategies.SnakeCaseStrategy, tools.jackson.databind.EnumNamingStrategies.UpperSnakeCaseStrategy, tools.jackson.databind.EnumNamingStrategies.LowerCaseStrategy, tools.jackson.databind.EnumNamingStrategies.KebabCaseStrategy, tools.jackson.databind.EnumNamingStrategies.LowerDotCaseStrategy

Field Summary

Modifier and TypeField and Description
private final NamingStrategyImpls

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public String
convertEnumToExternalName(MapperConfig<?> config, AnnotatedClass cls, String enumName)

Implements tools.jackson.databind.EnumNamingStrategy.convertEnumToExternalName.

Translates the given enumName into an external property name according to the implementation of this EnumNamingStrategy.

private static int
nextIndexOfUnderscore(CharSequence sequence, int start)

private static String
normalizeWord(String word)

Converts the first letter of the word to uppercase and the rest of the word to lowercase.

protected static String

Returns:

the normalized enum name
toBeanName
(String
the enum name to be normalized
enumName
)

Normalizes the enum name to lower camel case in order to be further processed by a NamingStrategies

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

strategyback to summary
private final NamingStrategyImpls strategy

Constructor Detail

DelegatingEnumNamingStrategyback to summary
protected DelegatingEnumNamingStrategy(NamingStrategyImpls strategy)

Method Detail

convertEnumToExternalNameback to summary
public String convertEnumToExternalName(MapperConfig<?> config, AnnotatedClass cls, String enumName)

Implements tools.jackson.databind.EnumNamingStrategy.convertEnumToExternalName.

Doc from tools.jackson.databind.EnumNamingStrategy.convertEnumToExternalName.

Translates the given enumName into an external property name according to the implementation of this EnumNamingStrategy.

Annotations
@Override
nextIndexOfUnderscoreback to summary
private static int nextIndexOfUnderscore(CharSequence sequence, int start)
normalizeWordback to summary
private static String normalizeWord(String word)

Converts the first letter of the word to uppercase and the rest of the word to lowercase.

toBeanNameback to summary
protected static String toBeanName(String enumName)

Normalizes the enum name to lower camel case in order to be further processed by a NamingStrategies

Parameters
enumName:String

the enum name to be normalized

Returns:String

the normalized enum name

tools.jackson.databind back to summary

public Class EnumNamingStrategies.KebabCaseStrategy

extends DelegatingEnumNamingStrategy
Class Inheritance

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format. This implementation first normalizes to lower camel case using (see LowerCamelCaseStrategy for details) and then uses PropertyNamingStrategies.KebabCaseStrategy to finish converting the name.

Warning

Naming conversion conflicts caused by underscore usage should be handled by client. e.g. Both PEANUT_BUTTER, PEANUT__BUTTER are converted into "peanut-butter". And "peanut-butter" will be deserialized into enum with smaller Enum.ordinal() value.

This results in the following example conversions:

Field Summary

Modifier and TypeField and Description
public static final EnumNamingStrategies.KebabCaseStrategy
INSTANCE

An instance of KebabCaseStrategy for reuse.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from tools.jackson.databind.EnumNamingStrategies.DelegatingEnumNamingStrategy:
convertEnumToExternalNametoBeanName

Field Detail

INSTANCEback to summary
public static final EnumNamingStrategies.KebabCaseStrategy INSTANCE

An instance of KebabCaseStrategy for reuse.

Since
2.19

Constructor Detail

KebabCaseStrategyback to summary
protected KebabCaseStrategy()
tools.jackson.databind back to summary

public Class EnumNamingStrategies.LowerCamelCaseStrategy

extends DelegatingEnumNamingStrategy
Class Inheritance

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to lower camel case format. This implementation follows three rules described below.

  1. converts any character preceded by an underscore into upper case character, regardless of its original case (upper or lower).
  2. converts any character NOT preceded by an underscore into a lower case character, regardless of its original case (upper or lower).
  3. removes all underscores.

Warning

Naming conversion conflicts caused by underscore usage should be handled by client. e.g. Both PEANUT_BUTTER, PEANUT__BUTTER are converted into "peanutButter". And "peanutButter" will be deserialized into enum with smaller Enum.ordinal() value.

This results in the following example conversions:

Field Summary

Modifier and TypeField and Description
public static final EnumNamingStrategies.LowerCamelCaseStrategy
INSTANCE

An instance of LowerCamelCaseStrategy for reuse.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from tools.jackson.databind.EnumNamingStrategies.DelegatingEnumNamingStrategy:
convertEnumToExternalNametoBeanName

Field Detail

INSTANCEback to summary
public static final EnumNamingStrategies.LowerCamelCaseStrategy INSTANCE

An instance of LowerCamelCaseStrategy for reuse.

Constructor Detail

LowerCamelCaseStrategyback to summary
protected LowerCamelCaseStrategy()
tools.jackson.databind back to summary

public Class EnumNamingStrategies.LowerCaseStrategy

extends DelegatingEnumNamingStrategy
Class Inheritance

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format. This implementation first normalizes to lower camel case using (see LowerCamelCaseStrategy for details) and then uses PropertyNamingStrategies.LowerCaseStrategy to finish converting the name.

Warning

Naming conversion conflicts caused by underscore usage should be handled by client. e.g. Both PEANUT_BUTTER, PEANUT__BUTTER are converted into "peanutbutter". And "peanutbutter" will be deserialized into enum with smaller Enum.ordinal() value.

This results in the following example conversions:

Field Summary

Modifier and TypeField and Description
public static final EnumNamingStrategies.LowerCaseStrategy
INSTANCE

An instance of LowerCaseStrategy for reuse.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from tools.jackson.databind.EnumNamingStrategies.DelegatingEnumNamingStrategy:
convertEnumToExternalNametoBeanName

Field Detail

INSTANCEback to summary
public static final EnumNamingStrategies.LowerCaseStrategy INSTANCE

An instance of LowerCaseStrategy for reuse.

Constructor Detail

LowerCaseStrategyback to summary
protected LowerCaseStrategy()
tools.jackson.databind back to summary

public Class EnumNamingStrategies.LowerDotCaseStrategy

extends DelegatingEnumNamingStrategy
Class Inheritance

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to lower dot case format. This implementation first normalizes to lower camel case using (see LowerCamelCaseStrategy for details) and then uses PropertyNamingStrategies.LowerDotCaseStrategy to finish converting the name.

Warning

Naming conversion conflicts caused by underscore usage should be handled by client. e.g. Both PEANUT_BUTTER, PEANUT__BUTTER are converted into "peanut.butter". And "peanut.butter" will be deserialized into enum with smaller Enum.ordinal() value.

This results in the following example conversions:

Field Summary

Modifier and TypeField and Description
public static final EnumNamingStrategies.LowerDotCaseStrategy
INSTANCE

An instance of LowerDotCaseStrategy for reuse.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from tools.jackson.databind.EnumNamingStrategies.DelegatingEnumNamingStrategy:
convertEnumToExternalNametoBeanName

Field Detail

INSTANCEback to summary
public static final EnumNamingStrategies.LowerDotCaseStrategy INSTANCE

An instance of LowerDotCaseStrategy for reuse.

Constructor Detail

LowerDotCaseStrategyback to summary
protected LowerDotCaseStrategy()
tools.jackson.databind back to summary

public Class EnumNamingStrategies.SnakeCaseStrategy

extends DelegatingEnumNamingStrategy
Class Inheritance

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format. This implementation first normalizes to lower camel case using (see LowerCamelCaseStrategy for details) and then uses PropertyNamingStrategies.SnakeCaseStrategy to finish converting the name.

Warning

Naming conversion conflicts caused by underscore usage should be handled by client. e.g. Both PEANUT_BUTTER, PEANUT__BUTTER are converted into "peanut_butter". And "peanut_butter" will be deserialized into enum with smaller Enum.ordinal() value.

This results in the following example conversions:

Field Summary

Modifier and TypeField and Description
public static final EnumNamingStrategies.SnakeCaseStrategy
INSTANCE

An instance of SnakeCaseStrategy for reuse.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from tools.jackson.databind.EnumNamingStrategies.DelegatingEnumNamingStrategy:
convertEnumToExternalNametoBeanName

Field Detail

INSTANCEback to summary
public static final EnumNamingStrategies.SnakeCaseStrategy INSTANCE

An instance of SnakeCaseStrategy for reuse.

Constructor Detail

SnakeCaseStrategyback to summary
protected SnakeCaseStrategy()
tools.jackson.databind back to summary

public Class EnumNamingStrategies.UpperCamelCaseStrategy

extends DelegatingEnumNamingStrategy
Class Inheritance

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format. This implementation first normalizes to lower camel case using (see LowerCamelCaseStrategy for details) and then uses PropertyNamingStrategies.UpperCamelCaseStrategy to finish converting the name.

Warning

Naming conversion conflicts caused by underscore usage should be handled by client. e.g. Both PEANUT_BUTTER, PEANUT__BUTTER are converted into "PeanutButter". And "PeanutButter" will be deserialized into enum with smaller Enum.ordinal() value.

This results in the following example conversions:

Field Summary

Modifier and TypeField and Description
public static final EnumNamingStrategies.UpperCamelCaseStrategy
INSTANCE

An instance of LowerCamelCaseStrategy for reuse.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from tools.jackson.databind.EnumNamingStrategies.DelegatingEnumNamingStrategy:
convertEnumToExternalNametoBeanName

Field Detail

INSTANCEback to summary
public static final EnumNamingStrategies.UpperCamelCaseStrategy INSTANCE

An instance of LowerCamelCaseStrategy for reuse.

Constructor Detail

UpperCamelCaseStrategyback to summary
protected UpperCamelCaseStrategy()
tools.jackson.databind back to summary

public Class EnumNamingStrategies.UpperSnakeCaseStrategy

extends DelegatingEnumNamingStrategy
Class Inheritance

An implementation of EnumNamingStrategy that converts enum names in the typical upper snake case format to upper camel case format. This implementation first normalizes to lower camel case using (see LowerCamelCaseStrategy for details) and then uses PropertyNamingStrategies.UpperSnakeCaseStrategy to finish converting the name.

Warning

Naming conversion conflicts caused by underscore usage should be handled by client. e.g. Both PEANUT_BUTTER, PEANUT__BUTTER are converted into "PEANUT_BUTTER". And "PEANUT_BUTTER" will be deserialized into enum with smaller Enum.ordinal() value.

This results in the following example conversions:

Field Summary

Modifier and TypeField and Description
public static final EnumNamingStrategies.UpperSnakeCaseStrategy
INSTANCE

An instance of UpperSnakeCaseStrategy for reuse.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from tools.jackson.databind.EnumNamingStrategies.DelegatingEnumNamingStrategy:
convertEnumToExternalNametoBeanName

Field Detail

INSTANCEback to summary
public static final EnumNamingStrategies.UpperSnakeCaseStrategy INSTANCE

An instance of UpperSnakeCaseStrategy for reuse.

Since
2.19

Constructor Detail

UpperSnakeCaseStrategyback to summary
protected UpperSnakeCaseStrategy()