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

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

public final class SourceSnippets
extends java.lang.Object

Utility class for source snippets.


Method Summary
static InjectorMethod asMethod(boolean isNative, java.lang.String signature, java.lang.String pkg, SourceSnippet body)
          Creates an InjectorMethod using the given SourceSnippet as its body.
static SourceSnippet callChildGetter(GinjectorBindings childBindings, Key<?> key)
          Creates a snippet that evaluates to an injected instance of the given key, as produced by the given child.
static SourceSnippet callGetter(Key<?> key)
          Creates a snippet that evaluates to an injected instance of the given key in the current GinjectorBindings.
static SourceSnippet callGinjectorInterfaceGetter()
          Creates a snippet that evaluates to the implementation of the current Ginjector interface.
static SourceSnippet callMemberInject(TypeLiteral<?> type, java.lang.String input)
          Creates a snippet (including a trailing semicolon) that performs member injection on a value of the given type.
static SourceSnippet callMethod(java.lang.String methodName, java.lang.String fragmentPackageName, java.lang.Iterable<java.lang.String> parameters)
          Creates a snippet that evaluates to an invocation of the named method on the given package fragment.
static SourceSnippet callParentGetter(Key<?> key, GinjectorBindings parentBindings)
          Creates a snippet that evaluates to an injected instance of the given key, as produced by the given parent injector.
static SourceSnippet forText(java.lang.String text)
          Creates a snippet that generates a constant text string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

callChildGetter

public static SourceSnippet callChildGetter(GinjectorBindings childBindings,
                                            Key<?> key)
Creates a snippet that evaluates to an injected instance of the given key, as produced by the given child.


callGetter

public static SourceSnippet callGetter(Key<?> key)
Creates a snippet that evaluates to an injected instance of the given key in the current GinjectorBindings.


callMemberInject

public static SourceSnippet callMemberInject(TypeLiteral<?> type,
                                             java.lang.String input)
Creates a snippet (including a trailing semicolon) that performs member injection on a value of the given type.

Parameters:
type - the type of value to perform member injection on
input - a Java expression that evaluates to the object that should be member-injected

callMethod

public static SourceSnippet callMethod(java.lang.String methodName,
                                       java.lang.String fragmentPackageName,
                                       java.lang.Iterable<java.lang.String> parameters)
Creates a snippet that evaluates to an invocation of the named method on the given package fragment.

Used when generating an intermediate invoker method; see MethodCallUtil.createMethodCallWithInjection(com.google.gwt.inject.rebind.reflect.MethodLiteral, java.lang.String, com.google.gwt.inject.rebind.util.NameGenerator, java.util.List).


callParentGetter

public static SourceSnippet callParentGetter(Key<?> key,
                                             GinjectorBindings parentBindings)
Creates a snippet that evaluates to an injected instance of the given key, as produced by the given parent injector.


callGinjectorInterfaceGetter

public static SourceSnippet callGinjectorInterfaceGetter()
Creates a snippet that evaluates to the implementation of the current Ginjector interface.


forText

public static SourceSnippet forText(java.lang.String text)
Creates a snippet that generates a constant text string.


asMethod

public static InjectorMethod asMethod(boolean isNative,
                                      java.lang.String signature,
                                      java.lang.String pkg,
                                      SourceSnippet body)
Creates an InjectorMethod using the given SourceSnippet as its body.

Parameters:
isNative - whether the returned method is a native method
signature - the signature of the returned method
pkg - the package in which the returned method should be created
body - the body text of the new method