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 Details

    • IDENTITY

      static final PropertyNamingStrategy IDENTITY
      Property name as is without changes.
    • UPPER_CAMEL_CASE_WITH_SPACES

      static final PropertyNamingStrategy UPPER_CAMEL_CASE_WITH_SPACES
      upper first letter, but camel case with a space between. Example: Foo Bar.
    • LOWER_CAMEL_CASE

      static final PropertyNamingStrategy LOWER_CAMEL_CASE
      lower first letter, but camel case. Example: fooBar.
    • UPPER_CAMEL_CASE

      static final PropertyNamingStrategy UPPER_CAMEL_CASE
      upper first letter, but camel case. Example: FooBar.
    • SNAKE_CASE

      static final PropertyNamingStrategy SNAKE_CASE
      Lowercase, separated by underscores. Example: foo_bar.
    • LOWER_DOT_CASE

      static final PropertyNamingStrategy LOWER_DOT_CASE
      Lowercase, separated by dots. Example: foo.bar.
    • KEBAB_CASE

      static final PropertyNamingStrategy KEBAB_CASE
      Lowercase, separated by hyphens. Example: foo-bar.
    • LOWER_CASE

      static final PropertyNamingStrategy 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

      static Optional<PropertyNamingStrategy> forName(String namingStrategy)
      Return an existing naming strategy for each name.
      Parameters:
      namingStrategy - The naming strategy name.
      Returns:
      The naming strategy