T
- the wrapper typepublic abstract class AbstractAutoBean<T> extends Object implements AutoBean<T>, HasSplittable
Modifier and Type | Class and Description |
---|---|
static class |
AbstractAutoBean.OneShotContext
Used to avoid cycles when visiting.
|
AutoBean.PropertyName
Modifier and Type | Field and Description |
---|---|
protected Splittable |
data
Used by
createSimplePeer() . |
protected static Object[] |
EMPTY_OBJECT |
static String |
UNSPLITTABLE_VALUES_KEY |
protected T |
wrapped |
Modifier | Constructor and Description |
---|---|
protected |
AbstractAutoBean(AutoBeanFactory factory)
Constructor that will use a generated simple peer.
|
protected |
AbstractAutoBean(AutoBeanFactory factory,
Splittable data)
Constructor that will use a generated simple peer, backed with existing
data.
|
protected |
AbstractAutoBean(T wrapped,
AutoBeanFactory factory)
Constructor that wraps an existing object.
|
Modifier and Type | Method and Description |
---|---|
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. |
protected void |
call(String method,
Object returned,
Object... parameters)
No-op.
|
protected void |
checkFrozen() |
protected void |
checkWrapped() |
AutoBean<T> |
clone(boolean deep)
This method always throws an
UnsupportedOperationException . |
protected T |
createSimplePeer() |
protected <V> V |
get(String method,
V toReturn)
No-op.
|
AutoBeanFactory |
getFactory()
Returns the AutoBeanFactory that created the AutoBean.
|
protected <W> W |
getFromWrapper(W obj) |
protected <Q> Q |
getOrReify(String propertyName)
Native getters and setters for primitive properties are generated for each
type to ensure inlining.
|
Splittable |
getSplittable() |
<Q> Q |
getTag(String tagName)
Retrieve a tag value that was previously provided to
AutoBean.setTag(String, Object) . |
protected T |
getWrapped() |
boolean |
hasUnsplittableValues()
Indicates that the value returned from
getSplittable() may not
contain all of the data encapsulated by the AutoBean. |
boolean |
isFrozen()
Returns the value most recently passed to
AutoBean.setFrozen(boolean) , or
false if it has never been called. |
protected boolean |
isUsingSimplePeer() |
protected boolean |
isWrapped(Object obj) |
boolean |
isWrapper()
Returns
true if the AutoBean was provided with an external object. |
protected void |
set(String method,
Object value)
No-op.
|
void |
setData(Splittable data) |
void |
setFrozen(boolean frozen)
Disallows any method calls other than getters.
|
protected void |
setProperty(String propertyName,
Object value) |
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) |
protected abstract void |
traverseProperties(AutoBeanVisitor visitor,
AbstractAutoBean.OneShotContext ctx) |
T |
unwrap()
If the AutoBean wraps an object, return the underlying object.
|
public static final String UNSPLITTABLE_VALUES_KEY
protected static final Object[] EMPTY_OBJECT
protected Splittable data
createSimplePeer()
.protected T wrapped
protected AbstractAutoBean(AutoBeanFactory factory)
protected AbstractAutoBean(AutoBeanFactory factory, Splittable data)
protected AbstractAutoBean(T wrapped, AutoBeanFactory factory)
AutoBean<Splittable>
instances.public void accept(AutoBeanVisitor visitor)
AutoBean
accept
in interface AutoBean<T>
visitor
- an AutoBeanVisitor
public abstract T as()
AutoBean
T
interface which will
delegate to the underlying wrapped object, if any.public AutoBean<T> clone(boolean deep)
AutoBean
UnsupportedOperationException
. The
implementation of this method in previous releases was not sufficiently
robust and there are no further uses of this method within the GWT code
base. Furthermore, there are many different semantics that can be applied
to a cloning process that cannot be adequately addressed with a single
implementation.
A simple clone of an acyclic datastructure can be created by using
AutoBeanCodex
to encode and decode the root object. Other cloning
algorithms are best implemented by using an AutoBeanVisitor
.
public AutoBeanFactory getFactory()
AutoBean
getFactory
in interface AutoBean<T>
public Splittable getSplittable()
getSplittable
in interface HasSplittable
public <Q> Q getTag(String tagName)
AutoBean
AutoBean.setTag(String, Object)
.getTag
in interface AutoBean<T>
tagName
- the tag nameAutoBean.setTag(String, Object)
public boolean hasUnsplittableValues()
getSplittable()
may not
contain all of the data encapsulated by the AutoBean.public boolean isFrozen()
AutoBean
AutoBean.setFrozen(boolean)
, or
false
if it has never been called.public boolean isWrapper()
AutoBean
true
if the AutoBean was provided with an external object.public void setData(Splittable data)
public void setFrozen(boolean frozen)
AutoBean
IllegalStateException
.public void setTag(String tagName, Object value)
AutoBean
setTag
in interface AutoBean<T>
tagName
- the tag namevalue
- the wrapped valueAutoBean.getTag(String)
public void traverse(AutoBeanVisitor visitor, AbstractAutoBean.OneShotContext ctx)
public T unwrap()
AutoBean
protected void call(String method, Object returned, Object... parameters)
method
- the method namereturned
- the returned objectparameters
- the parameter listprotected void checkFrozen()
protected void checkWrapped()
protected T createSimplePeer()
protected <V> V get(String method, V toReturn)
method
- the method nametoReturn
- the value to returnprotected <W> W getFromWrapper(W obj)
protected <Q> Q getOrReify(String propertyName)
protected T getWrapped()
protected boolean isUsingSimplePeer()
protected boolean isWrapped(Object obj)
protected void set(String method, Object value)
method
- the method namevalue
- the Object value to be setprotected abstract void traverseProperties(AutoBeanVisitor visitor, AbstractAutoBean.OneShotContext ctx)
Copyright © 2016. All rights reserved.