com.google.gwt.libideas.resources.rebind
Class Transformer<T>
java.lang.Object
com.google.gwt.libideas.resources.rebind.Transformer<T>
- Type Parameters:
T
- The type of value on which the Transformer operates
public abstract class Transformer<T>
- extends java.lang.Object
Applies user-defined transformations to the contents of a Resource at
compile-time. Add one or more gwt.transformer
annotations to
the resource declaration. The Transformers will be applied in the order in
which they are declared. The Transformer does not need to be included in the
module's source path, and may therefore take advantage of non-translatable
code.
Method Summary |
|
asSubclass(java.lang.Class<X> type)
Ensures that the Transformer is capable of transforming the requested type. |
abstract T |
transform(com.google.gwt.core.ext.typeinfo.JMethod method,
T input)
Perform the transformation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Transformer
public Transformer()
asSubclass
public final <X> Transformer<X> asSubclass(java.lang.Class<X> type)
- Ensures that the Transformer is capable of transforming the requested type.
This method allows consumers of Transformer subclasses to not need generic
casts.
- Type Parameters:
X
- The desired type of object- Parameters:
type
- The type of the objects that the caller wishes to transform
- Returns:
- the instance of the Transformer if the Transformer can accept
X
- Throws:
java.lang.ClassCastException
- if the Transformer cannot be cast to the desired
subtype.
transform
public abstract T transform(com.google.gwt.core.ext.typeinfo.JMethod method,
T input)
- Perform the transformation.
- Parameters:
method
- the JMethod for which the TextResource is being generatedinput
- the original value of the resource.
- Returns:
- the replacement value to use