Package org.immutables.generator
Class Naming.ConstantNaming
java.lang.Object
org.immutables.generator.Naming
org.immutables.generator.Naming.ConstantNaming
- Enclosing class:
Naming
-
Nested Class Summary
Nested classes/interfaces inherited from class org.immutables.generator.Naming
Naming.Preference, Naming.Usage -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApplies naming to input identifier, converting it to desired naming.Tries to extract source identifier name out of already applied naming.booleanChecks if is constant naming.booleanChecks if it's identity naming.Require naming to follow JavaBeam capitalization convention.requireNonConstant(Naming.Preference preference) Returns non-contant naming which is this.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.common.base.Function
equals
-
Field Details
-
name
-
-
Constructor Details
-
ConstantNaming
ConstantNaming(String name)
-
-
Method Details
-
apply
Description copied from class:NamingApplies naming to input identifier, converting it to desired naming. -
detect
Description copied from class:NamingTries to extract source identifier name out of already applied naming. -
isIdentity
public boolean isIdentity()Description copied from class:NamingChecks if it's identity naming.- Specified by:
isIdentityin classNaming- Returns:
- true, if is identity naming
- See Also:
-
isConstant
public boolean isConstant()Description copied from class:NamingChecks 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:
isConstantin classNaming- Returns:
- true, if is constant
-
requireNonConstant
Description copied from class:NamingReturns 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:
requireNonConstantin classNaming- Parameters:
preference- preference for prefix or suffix naming- Returns:
- non-constant naming template or
thisif already non-constant
-
requireJavaBeanConvention
Description copied from class:NamingRequire 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:
requireJavaBeanConventionin classNaming- See Also:
-
toString
-