public class NameGenerator extends Object
Ginjector
implementation.Constructor and Description |
---|
NameGenerator() |
Modifier and Type | Method and Description |
---|---|
String |
convertToValidMemberName(String name) |
String |
createMethodName(String base)
Returns a new valid (i.e.
|
String |
getAssistedInjectMethodName(Key<?> factoryKey,
String methodName)
Returns the name of an assisted injection helper method.
|
String |
getChildInjectorGetterMethodName(String childInjectorClassName)
Returns the name of a getter for a child injector.
|
String |
getFragmentCanonicalClassName(String injectorClassName,
FragmentPackageName fragmentPackageName)
Computes the canonical name (including package) of a single fragment of a
Ginjector.
|
String |
getFragmentClassName(String injectorClassName,
FragmentPackageName fragmentPackageName)
Computes the name of a single fragment of a Ginjector.
|
String |
getFragmentFieldName(FragmentPackageName fragmentPackageName)
Computes the field name of a single fragment of an injector.
|
String |
getFragmentGetterMethodName(FragmentPackageName fragmentPackageName)
Returnst he name of a getter for an injector fragment.
|
String |
getGetterMethodName(Key<?> key)
Returns the key's getter method name.
|
String |
getGinjectorInterfaceFieldName()
Computes the name of the field in which the Ginjector interface
implementation is stored.
|
String |
getGinjectorInterfaceGetterMethodName()
Computes the name of the method used to retrieve the Ginjector interface
implementation.
|
String |
getMemberInjectMethodName(TypeLiteral<?> type)
Returns the type's member inject method name.
|
String |
getSingletonFieldName(Key<?> key)
Returns the key's singleton field name.
|
void |
markAsUsed(String name)
Reserves the given name to prevent new methods to be created with it.
|
static String |
replaceLast(String source,
char toReplace,
char with) |
public String getAssistedInjectMethodName(Key<?> factoryKey, String methodName)
public String getChildInjectorGetterMethodName(String childInjectorClassName)
public String getFragmentGetterMethodName(FragmentPackageName fragmentPackageName)
public String getGetterMethodName(Key<?> key)
public String getFragmentClassName(String injectorClassName, FragmentPackageName fragmentPackageName)
injectorClassName
- the simple name of the injector's class (not
including its package)public String getFragmentCanonicalClassName(String injectorClassName, FragmentPackageName fragmentPackageName)
public String getFragmentFieldName(FragmentPackageName fragmentPackageName)
public String getGinjectorInterfaceFieldName()
public String getGinjectorInterfaceGetterMethodName()
public String getMemberInjectMethodName(TypeLiteral<?> type)
public String getSingletonFieldName(Key<?> key)
public String createMethodName(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(String name) throws IllegalArgumentException
name
- name to be reservedIllegalArgumentException
Copyright © 2008–2018. All rights reserved.