Class Naming.JavaBeanNaming

java.lang.Object
org.immutables.generator.Naming
org.immutables.generator.Naming.JavaBeanNaming
All Implemented Interfaces:
com.google.common.base.Function<String,String>, Function<String,String>
Enclosing class:
Naming

private static class Naming.JavaBeanNaming extends Naming
  • Field Details

    • prefix

      private final String prefix
  • Constructor Details

    • JavaBeanNaming

      JavaBeanNaming(String prefix)
  • Method Details

    • apply

      public String apply(String input)
      Description copied from class: Naming
      Applies naming to input identifier, converting it to desired naming.
      Specified by:
      apply in interface com.google.common.base.Function<String,String>
      Specified by:
      apply in interface Function<String,String>
      Specified by:
      apply in class Naming
      Parameters:
      input - the input identifier
      Returns:
      applied naming
    • detect

      public String detect(String identifier)
      Description copied from class: Naming
      Tries to extract source identifier name out of already applied naming.
      Specified by:
      detect in class Naming
      Parameters:
      identifier - to detect naming from
      Returns:
      empty string if nothing detected
    • isIdentity

      public boolean isIdentity()
      Description copied from class: Naming
      Checks if it's identity naming.
      Specified by:
      isIdentity in class Naming
      Returns:
      true, if is identity naming
      See Also:
    • isConstant

      public boolean isConstant()
      Description copied from class: Naming
      Checks if is constant naming. Verbatim naming convention do not use any supplied input name as base. Consider example factory method "from" constant naming, contrary to the factory method "newMyType" uses "MyType" as and input applying "new" prefix.
      Specified by:
      isConstant in class Naming
      Returns:
      true, if is constant
    • requireNonConstant

      public Naming requireNonConstant(Naming.Preference preference)
      Description copied from class: Naming
      Returns non-contant naming which is this. Sometimes context require naming should be non-contant, otherwise names will clash in shared identifier scope. If this naming is constant, then it is turned into corresponding prefix naming.
      Specified by:
      requireNonConstant in class Naming
      Parameters:
      preference - preference for prefix or suffix naming
      Returns:
      non-constant naming template or this if already non-constant
    • requireJavaBeanConvention

      public Naming requireJavaBeanConvention()
      Description copied from class: Naming
      Require naming to follow JavaBeam capitalization convention.

      See 8.8 Capitalization of inferred names

       Thus when we extract a property or event name from the middle of an existing Java name, we
       normally convert the first character to lower case. However to support the occasional use of all
       upper-case names, we check if the first two characters of the name are both upper case and if
       so leave it alone. So for example, "FooBah" becomes "fooBah", "Z" becomes "z", "URL" becomes "URL"
       
      Specified by:
      requireJavaBeanConvention in class Naming
      See Also: