Interface ClientBundleRequirements


public interface ClientBundleRequirements
Allows ResourceGenerators to indicate how their generated resources may be affected by their execution environment. An instance of this type will be provided to the ResourceGenerator via the ResourceGenerator.prepare(com.google.gwt.core.ext.TreeLogger, com.google.gwt.resources.ext.ResourceContext, com.google.gwt.resources.ext.ClientBundleRequirements, com.google.gwt.core.ext.typeinfo.JMethod) method.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Indicates that the ResourcePrototype implementation generated by a ResourceGenerator is sensitive to the values of the specified configuration property.
    void
    addPermutationAxis(String propertyName)
    Indicates that the ResourcePrototype implementation generated by a ResourceGenerator is sensitive to the value of the specified deferred-binding property.
    void
    addResolvedResource(String partialPath, URL resolvedResourceUrl)
    Indicates that the ResourcePrototype implementation generated by a ResourceGenerator is sensitive to a dependent resource.
    void
    Indicates that the ResourcePrototype implementation generated by a ResourceGenerator is sensitive to structural changes to the given type, as well as any of it's super type hierarchy.
  • Method Details

    • addConfigurationProperty

      void addConfigurationProperty(String propertyName) throws BadPropertyValueException
      Indicates that the ResourcePrototype implementation generated by a ResourceGenerator is sensitive to the values of the specified configuration property.
      Parameters:
      propertyName - the name of the configuration property
      Throws:
      BadPropertyValueException
    • addPermutationAxis

      void addPermutationAxis(String propertyName) throws BadPropertyValueException
      Indicates that the ResourcePrototype implementation generated by a ResourceGenerator is sensitive to the value of the specified deferred-binding property. This method should be called when the behavior of the ResourcePrototype must differ between permutations of the compiled output. For example, some resource implementations may be sensitive to the user.agent deferred-binding property, and would call this method with the literal string user.agent.

      If a deferred-binding property does not exist, an attempt is made to check whether a configuration property by the same name exists.

      Parameters:
      propertyName - the name of the deferred-binding property
      Throws:
      BadPropertyValueException - if propertyName is neither a valid deferred-binding property nor a valid configuration property.
    • addResolvedResource

      void addResolvedResource(String partialPath, URL resolvedResourceUrl)
      Indicates that the ResourcePrototype implementation generated by a ResourceGenerator is sensitive to a dependent resource. This method takes both an unresolved partialPath and a located resolvedResourceUrl, since the resolved location of a resource can change dynamically at run time. So, by calling this method, the requirement is being declared for both the resolution of the resource's URL, as well as its content.

      The implementation for resolving a resource url from a partial path is contained in ResourceGeneratorUtil, and is based on an ordered set of 'locator' implementations, which are tried in sequence. Example 'locator' implementations include looking up a resource file by name, which usually amounts to a freshly generated temporary file (see ResourceGeneratorUtil.addNamedFile(java.lang.String, java.io.File)), or by using the partial path as a classpath resource used by a class loader, which can be affected by classpath shadowing.

      The current resolution for a resource partial path can be checked via ResourceGeneratorUtil.tryFindResource(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.GeneratorContext, com.google.gwt.resources.ext.ResourceContext, java.lang.String).

      Parameters:
      partialPath - a partial path representing a dependent resource.
      resolvedResourceUrl - a located resolved URL for a dependent resource.
    • addTypeHierarchy

      void addTypeHierarchy(JClassType type)
      Indicates that the ResourcePrototype implementation generated by a ResourceGenerator is sensitive to structural changes to the given type, as well as any of it's super type hierarchy.
      Parameters:
      type - a type