public class NameGenerator
extends java.lang.Object
Ginjector
implementation.| Constructor and Description |
|---|
NameGenerator() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
convertToValidMemberName(java.lang.String name) |
java.lang.String |
createMethodName(java.lang.String base)
Returns a new valid (i.e.
|
java.lang.String |
getAssistedInjectMethodName(Key<?> factoryKey,
java.lang.String methodName)
Returns the name of an assisted injection helper method.
|
java.lang.String |
getChildInjectorGetterMethodName(java.lang.String childInjectorClassName)
Returns the name of a getter for a child injector.
|
java.lang.String |
getFragmentCanonicalClassName(java.lang.String injectorClassName,
FragmentPackageName fragmentPackageName)
Computes the canonical name (including package) of a single fragment of a
Ginjector.
|
java.lang.String |
getFragmentClassName(java.lang.String injectorClassName,
FragmentPackageName fragmentPackageName)
Computes the name of a single fragment of a Ginjector.
|
java.lang.String |
getFragmentFieldName(FragmentPackageName fragmentPackageName)
Computes the field name of a single fragment of an injector.
|
java.lang.String |
getFragmentGetterMethodName(FragmentPackageName fragmentPackageName)
Returnst he name of a getter for an injector fragment.
|
java.lang.String |
getGetterMethodName(Key<?> key)
Returns the key's getter method name.
|
java.lang.String |
getGinjectorInterfaceFieldName()
Computes the name of the field in which the Ginjector interface
implementation is stored.
|
java.lang.String |
getGinjectorInterfaceGetterMethodName()
Computes the name of the method used to retrieve the Ginjector interface
implementation.
|
java.lang.String |
getMemberInjectMethodName(TypeLiteral<?> type)
Returns the type's member inject method name.
|
java.lang.String |
getSingletonFieldName(Key<?> key)
Returns the key's singleton field name.
|
void |
markAsUsed(java.lang.String name)
Reserves the given name to prevent new methods to be created with it.
|
static java.lang.String |
replaceLast(java.lang.String source,
char toReplace,
char with) |
public java.lang.String getAssistedInjectMethodName(Key<?> factoryKey, java.lang.String methodName)
public java.lang.String getChildInjectorGetterMethodName(java.lang.String childInjectorClassName)
public java.lang.String getFragmentGetterMethodName(FragmentPackageName fragmentPackageName)
public java.lang.String getGetterMethodName(Key<?> key)
public java.lang.String getFragmentClassName(java.lang.String injectorClassName,
FragmentPackageName fragmentPackageName)
injectorClassName - the simple name of the injector's class (not
including its package)public java.lang.String getFragmentCanonicalClassName(java.lang.String injectorClassName,
FragmentPackageName fragmentPackageName)
public java.lang.String getFragmentFieldName(FragmentPackageName fragmentPackageName)
public java.lang.String getGinjectorInterfaceFieldName()
public java.lang.String getGinjectorInterfaceGetterMethodName()
public java.lang.String getMemberInjectMethodName(TypeLiteral<?> type)
public java.lang.String getSingletonFieldName(Key<?> key)
public java.lang.String createMethodName(java.lang.String base)
base.
Note: Method names are considered "used" after being returned by this
method, whether they're actually used to write a new method or not.base - base on which method name gets createdpublic void markAsUsed(java.lang.String name)
throws java.lang.IllegalArgumentException
name - name to be reservedjava.lang.IllegalArgumentExceptionpublic java.lang.String convertToValidMemberName(java.lang.String name)
public static java.lang.String replaceLast(java.lang.String source,
char toReplace,
char with)