public class

FieldManager

extends Object
java.lang.Object
   ↳ com.google.gwt.uibinder.rebind.FieldManager

Class Overview

This class handles all FieldWriter instances created for the current template.

Summary

Public Constructors
FieldManager(TypeOracle types, MortalLogger logger)
Public Methods
FieldWriter lookup(String fieldName)
void pop()
Remove the field at the top of the #parsedFieldStack.
void push(FieldWriter fieldWriter)
FieldWriter registerField(JClassType fieldType, String fieldName)
Used to declare fields of an existing type.
FieldWriter registerFieldForGeneratedCssResource(ImplicitCssResource cssResource)
Used to declare fields that will hold generated instances generated CssResource interfaces.
FieldWriter registerFieldOfGeneratedType(JClassType assignableType, String typePackage, String typeName, String fieldName)
Used to declare fields of a type (other than CssResource) that is to be generated.
void registerFieldReference(String fieldReferenceString, JType type)
Called to register a {field.reference} encountered during parsing, to be validated against the type oracle once parsing is complete.
void validate()
To be called after parsing is complete.
void writeGwtFieldsDeclaration(IndentedWriter writer, String ownerTypeName)
Writes all stored gwt fields.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public FieldManager (TypeOracle types, MortalLogger logger)

Public Methods

public FieldWriter lookup (String fieldName)

Parameters
fieldName the name of the FieldWriter to find
Returns
  • the FieldWriter instance indexed by fieldName or null in case fieldName is not found

public void pop ()

Remove the field at the top of the #parsedFieldStack.

public void push (FieldWriter fieldWriter)

Parameters
fieldWriter the field to push on the top of the #parsedFieldStack

public FieldWriter registerField (JClassType fieldType, String fieldName)

Used to declare fields of an existing type. If your field will hold a type that is being generated, see registerFieldOfGeneratedType(JClassType, String, String, String).

When making a field we peek at the #parsedFieldStack to make sure that the field that holds the widget currently being parsed will depended upon the field being declared. This ensures, for example, that dom id fields (see #declareDomIdHolder()) used by an HTMLPanel will be declared before it is.

Parameters
fieldType the type of the new field
fieldName the name of the new field
Returns
Throws
UnableToCompleteException on duplicate name

public FieldWriter registerFieldForGeneratedCssResource (ImplicitCssResource cssResource)

Used to declare fields that will hold generated instances generated CssResource interfaces. If your field will hold a reference of an existing type, see registerField(JClassType, String). For other generated types, use registerFieldOfGeneratedType(JClassType, String, String, String) registerFieldForGeneratedCssResource(ImplicitCssResource).

When making a field we peek at the #parsedFieldStack to make sure that the field that holds the widget currently being parsed will depended upon the field being declared. This ensures, for example, that dom id fields (see #declareDomIdHolder()) used by an HTMLPanel will be declared before it is.

Returns
Throws
UnableToCompleteException on duplicate name

public FieldWriter registerFieldOfGeneratedType (JClassType assignableType, String typePackage, String typeName, String fieldName)

Used to declare fields of a type (other than CssResource) that is to be generated. If your field will hold a reference of an existing type, see registerField(JClassType, String). For generated CssResources, see registerFieldForGeneratedCssResource(ImplicitCssResource).

When making a field we peek at the #parsedFieldStack to make sure that the field that holds the widget currently being parsed will depended upon the field being declared. This ensures, for example, that dom id fields (see #declareDomIdHolder()) used by an HTMLPanel will be declared before it is.

Parameters
assignableType class or interface extened or implemented by this type
typeName the full qualified name for the class associated with the field
fieldName the name of the field
Returns
Throws
UnableToCompleteException on duplicate name

public void registerFieldReference (String fieldReferenceString, JType type)

Called to register a {field.reference} encountered during parsing, to be validated against the type oracle once parsing is complete.

Throws
UnableToCompleteException

public void validate ()

To be called after parsing is complete. Surveys all {field.reference}s and checks they refer to existing types, and have appropriate return types.

Throws
UnableToCompleteException if any {field.references} can't be resolved

public void writeGwtFieldsDeclaration (IndentedWriter writer, String ownerTypeName)

Writes all stored gwt fields.

Parameters
writer the writer to output
ownerTypeName the name of the class being processed
Throws
UnableToCompleteException