public final class SourceSnippets extends Object
Modifier and Type | Method and Description |
---|---|
static InjectorMethod |
asMethod(boolean isNative,
String signature,
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,
String input)
Creates a snippet (including a trailing semicolon) that performs member
injection on a value of the given type.
|
static SourceSnippet |
callMethod(String methodName,
String fragmentPackageName,
Iterable<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(String text)
Creates a snippet that generates a constant text string.
|
public static SourceSnippet callChildGetter(GinjectorBindings childBindings, Key<?> key)
public static SourceSnippet callGetter(Key<?> key)
GinjectorBindings
.public static SourceSnippet callMemberInject(TypeLiteral<?> type, String input)
type
- the type of value to perform member injection oninput
- a Java expression that evaluates to the object that should be
member-injectedpublic static SourceSnippet callMethod(String methodName, String fragmentPackageName, Iterable<String> parameters)
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<com.google.gwt.inject.rebind.util.InjectorMethod>)
.
public static SourceSnippet callParentGetter(Key<?> key, GinjectorBindings parentBindings)
public static SourceSnippet callGinjectorInterfaceGetter()
public static SourceSnippet forText(String text)
public static InjectorMethod asMethod(boolean isNative, String signature, String pkg, SourceSnippet body)
InjectorMethod
using the given SourceSnippet
as
its body.isNative
- whether the returned method is a native methodsignature
- the signature of the returned methodpkg
- the package in which the returned method should be createdbody
- the body text of the new methodCopyright © 2008–2018. All rights reserved.