GWT 2.6.0.vaadin2

com.google.gwt.core.ext
Class Generator

java.lang.Object
  extended by com.google.gwt.core.ext.Generator
Direct Known Subclasses:
IncrementalGenerator

public abstract class Generator
extends java.lang.Object

Generates source code for subclasses during deferred binding requests. Subclasses must be thread-safe.
Well-behaved generators can speed up the separate compiles by overriding @{link #getAccessedPropertyNames}, @{link #contentDependsOnProperties}, and @{contentDependsOnTypes}". The compiler will use this information to run generators less often and cache their outputs.


Constructor Summary
Generator()
           
 
Method Summary
 boolean contentDependsOnProperties()
          Whether the *content* of created files (not the list of files created) changes as the set value of configuration properties or the list of legal values of binding properties changes.
Generators whose output content is stable even when property values change can override this method to speed up separate compiles.
 boolean contentDependsOnTypes()
          Whether the *content* of created files (not the list of files created) changes as more types are created that match some subtype query.
Generators whose output content is stable even as new types are created can override this method to speed up separate compiles.
static java.lang.String escape(java.lang.String unescaped)
          Escapes string content to be a valid string literal.
static java.lang.String escapeClassName(java.lang.String unescapedString)
          Returns an escaped version of a String that is valid as a Java class name.
Illegal characters become "_" + the character integer padded to 5 digits like "_01234".
abstract  java.lang.String generate(TreeLogger logger, GeneratorContext context, java.lang.String typeName)
          Generate a default constructible subclass of the requested type.
 java.util.Set<java.lang.String> getAccessedPropertyNames()
          Returns the set of names of all properties that are accessed by generator execution and affect its behavior.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Generator

public Generator()
Method Detail

escape

public static java.lang.String escape(java.lang.String unescaped)
Escapes string content to be a valid string literal.

Returns:
an escaped version of unescaped, suitable for being enclosed in double quotes in Java source

escapeClassName

public static java.lang.String escapeClassName(java.lang.String unescapedString)
Returns an escaped version of a String that is valid as a Java class name.
Illegal characters become "_" + the character integer padded to 5 digits like "_01234". The padding prevents collisions like the following "_" + "123" + "4" = "_" + "1234". The "_" escape character is escaped to "__".


generate

public abstract java.lang.String generate(TreeLogger logger,
                                          GeneratorContext context,
                                          java.lang.String typeName)
                                   throws UnableToCompleteException
Generate a default constructible subclass of the requested type. The generator throws UnableToCompleteException if for any reason it cannot provide a substitute class

Returns:
the name of a subclass to substitute for the requested class, or return null to cause the requested type itself to be used
Throws:
UnableToCompleteException

getAccessedPropertyNames

public java.util.Set<java.lang.String> getAccessedPropertyNames()
Returns the set of names of all properties that are accessed by generator execution and affect its behavior. Returning a null indicates that *all* properties are considered relevant.
Generators that don't need access to every property can override this method to speed up separate compiles.


contentDependsOnProperties

public boolean contentDependsOnProperties()
Whether the *content* of created files (not the list of files created) changes as the set value of configuration properties or the list of legal values of binding properties changes.
Generators whose output content is stable even when property values change can override this method to speed up separate compiles.


contentDependsOnTypes

public boolean contentDependsOnTypes()
Whether the *content* of created files (not the list of files created) changes as more types are created that match some subtype query.
Generators whose output content is stable even as new types are created can override this method to speed up separate compiles.


GWT 2.6.0.vaadin2