Package io.micronaut.serde.config.naming
Interface PropertyNamingStrategy
- All Known Implementing Classes:
IdentityStrategy,KebabCaseStrategy,LowerCamelCaseStrategy,LowerCaseStrategy,LowerDotCaseStrategy,SnakeCaseStrategy,UpperCamelCaseStrategy,UpperCamelCaseStrategyWithSpaces
public interface PropertyNamingStrategy
Allows defining a custom naming strategy for properties.
Note that implementations are used only at build time and not at runtime, therefore adding a new implementation entails ensuring the implementation exists on the annotation processor classpath
- Since:
- 1.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyNamingStrategyProperty name as is without changes.static final PropertyNamingStrategyLowercase, separated by hyphens.static final PropertyNamingStrategylower first letter, but camel case.static final PropertyNamingStrategyAll lower case.static final PropertyNamingStrategyLowercase, separated by dots.static final PropertyNamingStrategyLowercase, separated by underscores.static final PropertyNamingStrategyupper first letter, but camel case.static final PropertyNamingStrategyupper first letter, but camel case with a space between. -
Method Summary
-
Field Details
-
IDENTITY
Property name as is without changes. -
UPPER_CAMEL_CASE_WITH_SPACES
upper first letter, but camel case with a space between. Example:Foo Bar. -
LOWER_CAMEL_CASE
lower first letter, but camel case. Example:fooBar. -
UPPER_CAMEL_CASE
upper first letter, but camel case. Example:FooBar. -
SNAKE_CASE
Lowercase, separated by underscores. Example:foo_bar. -
LOWER_DOT_CASE
Lowercase, separated by dots. Example:foo.bar. -
KEBAB_CASE
Lowercase, separated by hyphens. Example:foo-bar. -
LOWER_CASE
All lower case. Example:foobar.
-
-
Method Details
-
translate
@NonNull @NonNull String translate(@NonNull @NonNull io.micronaut.core.annotation.AnnotatedElement element) Translate the given name into the desired format.- Parameters:
element- The annotated element to translate- Returns:
- The translated name
-
forName
Return an existing naming strategy for each name.- Parameters:
namingStrategy- The naming strategy name.- Returns:
- The naming strategy
-