com.google.gwt.inject.rebind.binding
Class BindConstantBinding

java.lang.Object
  extended by com.google.gwt.inject.rebind.binding.BindConstantBinding
All Implemented Interfaces:
Binding

public class BindConstantBinding
extends java.lang.Object
implements Binding

Binding for a constant value.


Constructor Summary
BindConstantBinding(SourceWriteUtil sourceWriteUtil)
           
 
Method Summary
 RequiredKeys getRequiredKeys()
           
static boolean isConstantKey(Key<?> key)
          Returns true if the provided key is a valid constant key, i.e.
<T> void
setKeyAndInstance(Key<T> key, T instance)
          Sets this binding's key and instance.
 void writeCreatorMethods(com.google.gwt.user.rebind.SourceWriter writer, java.lang.String creatorMethodSignature)
          Writes the method necessary to create the binding's type to the writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BindConstantBinding

@Inject
public BindConstantBinding(SourceWriteUtil sourceWriteUtil)
Method Detail

isConstantKey

public static boolean isConstantKey(Key<?> key)
Returns true if the provided key is a valid constant key, i.e. if a constant binding can be legally created for it.

Parameters:
key - key to check
Returns:
true if constant key

setKeyAndInstance

public <T> void setKeyAndInstance(Key<T> key,
                                  T instance)
Sets this binding's key and instance. Must be called before writeCreatorMethod is invoked.

Parameters:
key - key to bind to
instance - value to bind to

writeCreatorMethods

public void writeCreatorMethods(com.google.gwt.user.rebind.SourceWriter writer,
                                java.lang.String creatorMethodSignature)
Description copied from interface: Binding
Writes the method necessary to create the binding's type to the writer. A method with the creatorMethodSignature must be written, other methods are optional.

Specified by:
writeCreatorMethods in interface Binding
Parameters:
writer - writer that methods are written to
creatorMethodSignature - signature of method that needs to be created

getRequiredKeys

public RequiredKeys getRequiredKeys()
Specified by:
getRequiredKeys in interface Binding
Returns:
A tuple of two sets: One set of keys that this binding requires. This set is used to find more classes that need to be bound. The second set contains all keys that have been optionally requested.