Package org.immutables.generator
Class Naming.PrefixSuffixNaming
- java.lang.Object
-
- org.immutables.generator.Naming
-
- org.immutables.generator.Naming.PrefixSuffixNaming
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.immutables.generator.Naming
Naming.Preference, Naming.Usage
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intlengthsOfPrefixAndSuffix(package private) java.lang.Stringprefix(package private) java.lang.Stringsuffix
-
Constructor Summary
Constructors Constructor Description PrefixSuffixNaming(java.lang.String prefix, java.lang.String suffix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringapply(java.lang.String input)Applies naming to input identifier, converting it to desired naming.java.lang.Stringdetect(java.lang.String identifier)Tries to extract source identifier name out of already applied naming.booleanisConstant()Checks if is constant naming.booleanisIdentity()Checks if it's identity naming.NamingrequireJavaBeanConvention()Require naming to follow JavaBeam capitalization convention.NamingrequireNonConstant(Naming.Preference preference)Returns non-contant naming which is this.java.lang.StringtoString()
-
-
-
Method Detail
-
apply
public java.lang.String apply(java.lang.String input)
Description copied from class:NamingApplies naming to input identifier, converting it to desired naming.
-
detect
public java.lang.String detect(java.lang.String identifier)
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:
Naming.identity()
-
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
public Naming requireNonConstant(Naming.Preference preference)
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
public Naming 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:
- javabean spec
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-