public abstract class

AbstractAutoBean

extends Object
implements AutoBean<T>
java.lang.Object
   ↳ com.google.gwt.autobean.shared.impl.AbstractAutoBean<T>

Class Overview

Basic implementation.

Summary

Nested Classes
class AbstractAutoBean.OneShotContext Used to avoid cycles when visiting. 
Fields
protected static final Object[] EMPTY_OBJECT
protected final Map<StringObject> values Used by createSimplePeer().
Protected Constructors
AbstractAutoBean(AutoBeanFactory factory)
Constructor that will use a generated simple peer.
AbstractAutoBean(AbstractAutoBean<T> toClone, boolean deep)
Clone constructor.
AbstractAutoBean(AutoBeanFactory factory, T wrapped)
Constructor that wraps an existing object.
Public Methods
void accept(AutoBeanVisitor visitor)
Accept an AutoBeanVisitor.
abstract T as()
Returns a proxy implementation of the T interface which will delegate to the underlying wrapped object, if any.
abstract AutoBean<T> clone(boolean deep)
Creates a copy of the AutoBean.
AutoBeanFactory getFactory()
Returns the AutoBeanFactory that created the AutoBean.
<Q> Q getTag(String tagName)
Retrieve a tag value that was previously provided to setTag(String, Object).
boolean isFrozen()
Returns the value most recently passed to setFrozen(boolean), or false if it has never been called.
boolean isWrapper()
Returns true if the AutoBean was provided with an external object.
void setFrozen(boolean frozen)
Disallows any method calls other than getters.
void setTag(String tagName, Object value)
A tag is an arbitrary piece of external metadata to be associated with the wrapped value.
void traverse(AutoBeanVisitor visitor, AbstractAutoBean.OneShotContext ctx)
T unwrap()
If the AutoBean wraps an object, return the underlying object.
Protected Methods
void call(String method, Object returned, Object... parameters)
No-op.
void checkFrozen()
void checkWrapped()
T createSimplePeer()
<V> V get(String method, V toReturn)
No-op.
<W> W getFromWrapper(W obj)
T getWrapped()
boolean isUsingSimplePeer()
boolean isWrapped(Object obj)
void set(String method, Object value)
No-op.
abstract void traverseProperties(AutoBeanVisitor visitor, AbstractAutoBean.OneShotContext ctx)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gwt.autobean.shared.AutoBean

Fields

protected static final Object[] EMPTY_OBJECT

protected final Map<StringObject> values

Protected Constructors

protected AbstractAutoBean (AutoBeanFactory factory)

Constructor that will use a generated simple peer.

protected AbstractAutoBean (AbstractAutoBean<T> toClone, boolean deep)

Clone constructor.

protected AbstractAutoBean (AutoBeanFactory factory, T wrapped)

Constructor that wraps an existing object.

Public Methods

public void accept (AutoBeanVisitor visitor)

Accept an AutoBeanVisitor.

Parameters
visitor an AutoBeanVisitor

public abstract T as ()

Returns a proxy implementation of the T interface which will delegate to the underlying wrapped object, if any.

Returns
  • a proxy that delegates to the wrapped object

public abstract AutoBean<T> clone (boolean deep)

Creates a copy of the AutoBean.

If the AutoBean has tags, the tags will be copied into the cloned AutoBean. If any of the tag values are AutoBeans, they will not be cloned, regardless of the value of deep.

Parameters
deep indicates if all referenced AutoBeans should be cloned
Returns

public AutoBeanFactory getFactory ()

Returns the AutoBeanFactory that created the AutoBean.

Returns
  • an AutoBeanFactory

public Q getTag (String tagName)

Retrieve a tag value that was previously provided to setTag(String, Object).

Parameters
tagName the tag name
Returns
  • the tag value

public boolean isFrozen ()

Returns the value most recently passed to setFrozen(boolean), or false if it has never been called.

Returns
  • true if this instance is frozen

public boolean isWrapper ()

Returns true if the AutoBean was provided with an external object.

Returns
  • true if this instance is a wrapper

public void setFrozen (boolean frozen)

Disallows any method calls other than getters. All setter and call operations will throw an IllegalStateException.

Parameters
frozen if true, freeze this instance

public void setTag (String tagName, Object value)

A tag is an arbitrary piece of external metadata to be associated with the wrapped value.

Parameters
tagName the tag name
value the wrapped value

public void traverse (AutoBeanVisitor visitor, AbstractAutoBean.OneShotContext ctx)

public T unwrap ()

If the AutoBean wraps an object, return the underlying object. The AutoBean will no longer function once unwrapped.

Returns
  • the previously-wrapped object

Protected Methods

protected void call (String method, Object returned, Object... parameters)

No-op. Used as a debugger hook point for generated code.

Parameters
method the method name
returned the returned object
parameters the parameter list

protected void checkFrozen ()

protected void checkWrapped ()

protected T createSimplePeer ()

protected V get (String method, V toReturn)

No-op. Used as a debugger hook point for generated code.

Parameters
method the method name
toReturn the value to return

protected W getFromWrapper (W obj)

protected T getWrapped ()

protected boolean isUsingSimplePeer ()

protected boolean isWrapped (Object obj)

protected void set (String method, Object value)

No-op. Used as a debugger hook point for generated code.

Parameters
method the method name
value the Object value to be set

protected abstract void traverseProperties (AutoBeanVisitor visitor, AbstractAutoBean.OneShotContext ctx)