com.google.gwt.libideas.resources.rebind
Class ResourceGeneratorUtil

java.lang.Object
  extended by com.google.gwt.libideas.resources.rebind.ResourceGeneratorUtil

public final class ResourceGeneratorUtil
extends java.lang.Object

Utility methods for building ResourceGenerators.


Field Summary
static java.lang.String METADATA_TAG
           
static java.lang.String TRANSFORMER_TAG
           
 
Method Summary
static
<T> T
applyTransformations(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.core.ext.typeinfo.JMethod method, java.lang.Class<T> baseType, T input)
          Apply Transformers to a resource.
static java.lang.String baseName(java.net.URL resource)
          Return the base filename of a resource.
static java.net.URL[] findResources(com.google.gwt.core.ext.TreeLogger logger, ResourceContext context, com.google.gwt.core.ext.typeinfo.JMethod method)
          Find all resources referenced by a method on the bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METADATA_TAG

public static final java.lang.String METADATA_TAG
See Also:
Constant Field Values

TRANSFORMER_TAG

public static final java.lang.String TRANSFORMER_TAG
See Also:
Constant Field Values
Method Detail

applyTransformations

public static <T> T applyTransformations(com.google.gwt.core.ext.TreeLogger logger,
                                         com.google.gwt.core.ext.typeinfo.JMethod method,
                                         java.lang.Class<T> baseType,
                                         T input)
                              throws com.google.gwt.core.ext.UnableToCompleteException
Apply Transformers to a resource. The presence of one or more gwt.transformer annotations will specify the Transformer class to use. Multiple transformations will be applied in their declared order.

Type Parameters:
T - the Java type that encapsulates the value of the resource
Parameters:
logger - the TreeLogger context
method - the method to examine
baseType - a class literal which specifies the base type
input - the value to transform
Returns:
the transformed value.
Throws:
com.google.gwt.core.ext.UnableToCompleteException

baseName

public static java.lang.String baseName(java.net.URL resource)
Return the base filename of a resource. The behavior is similar to the unix command basename.

Parameters:
resource - the URL of the resource
Returns:
the final name segment of the resource

findResources

public static java.net.URL[] findResources(com.google.gwt.core.ext.TreeLogger logger,
                                           ResourceContext context,
                                           com.google.gwt.core.ext.typeinfo.JMethod method)
                                    throws com.google.gwt.core.ext.UnableToCompleteException
Find all resources referenced by a method on the bundle.

Parameters:
context -
method -
Returns:
URLs for each resource annotation defined on the method.
Throws:
com.google.gwt.core.ext.UnableToCompleteException - if the method has no resource annotations or ore or more of the resources could not be found