com.google.gwt.inject.rebind.util
Class NameGenerator

java.lang.Object
  extended by com.google.gwt.inject.rebind.util.NameGenerator

public class NameGenerator
extends java.lang.Object

Helper to generate various names for members of a Ginjector implementation.


Constructor Summary
NameGenerator()
           
 
Method Summary
 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 getCreatorMethodName(Key<?> key)
          Returns the key's creator method name.
 java.lang.String getGetterMethodName(Key<?> key)
          Returns the key's getter method name.
 java.lang.String getMemberInjectMethodName(Key<?> key)
          Returns the key'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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameGenerator

public NameGenerator()
Method Detail

getGetterMethodName

public java.lang.String getGetterMethodName(Key<?> key)
Returns the key's getter method name. The method with that name can be called to retrieve an instance of the type described by the key.

Returns:
getter method name

getCreatorMethodName

public java.lang.String getCreatorMethodName(Key<?> key)
Returns the key's creator method name. The method with that name can be called to create and retrieve an instance of the type described by the key.

Returns:
creator method name

getMemberInjectMethodName

public java.lang.String getMemberInjectMethodName(Key<?> key)
Returns the key's member inject method name. The method with that name can be called with a single parameter to inject members of that parameter.

Returns:
member inject method name

getSingletonFieldName

public java.lang.String getSingletonFieldName(Key<?> key)
Returns the key's singleton field name.

Returns:
singleton field name

createMethodName

public java.lang.String createMethodName(java.lang.String base)
Returns a new valid (i.e. unique) method name based on 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.

Parameters:
base - base on which method name gets created
Returns:
valid method name

markAsUsed

public void markAsUsed(java.lang.String name)
                throws java.lang.IllegalArgumentException
Reserves the given name to prevent new methods to be created with it.

Parameters:
name - name to be reserved
Throws:
java.lang.IllegalArgumentException

convertToValidMemberName

public java.lang.String convertToValidMemberName(java.lang.String name)

replaceLast

public static java.lang.String replaceLast(java.lang.String source,
                                           char toReplace,
                                           char with)