Encoder is a class which can be used to create
files or streams that encode the state of a collection of
JavaBeans in terms of their public APIs. The Encoder,
in conjunction with its persistence delegates, is responsible for
breaking the object graph down into a series of Statements
and Expressions which can be used to create it.
A subclass typically provides a syntax for these expressions
using some human readable form - like Java source code or XML.
| Modifier and Type | Field and Description |
|---|---|
| private Map | |
| private Map | |
| private ExceptionListener | |
| pack-priv boolean | |
| private final PersistenceDelegateFinder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| private Statement | |
| public Object | |
| pack-priv Object | |
| public ExceptionListener | Returns: The exception handler for this stream; Will return the default exception listener if this has not explicitly been set.Gets the exception handler for this stream. |
| public PersistenceDelegate | Returns: the persistence delegate for the given typethe class of the objects type)Returns the persistence delegate for the given type. |
| pack-priv Object | |
| public Object | |
| pack-priv void | |
| public void | setExceptionListener(ExceptionListener
The exception handler for this stream;
if exceptionListener)null the default exception listener will be used.Sets the exception handler for this stream to |
| public void | setPersistenceDelegate(Class<?>
the class of objects that the specified persistence delegate applies to type, PersistenceDelegate the persistence delegate for instances of the given type delegate)Associates the specified persistence delegate with the given type. |
| public void | writeExpression(Expression
The expression to be written to the stream. oldExp)The implementation first checks to see if an expression with this value has already been written. |
| protected void | writeObject(Object
The object to be written to the stream. o)Write the specified object to the output stream. |
| private Object | |
| public void | writeStatement(Statement
The expression to be written to the stream. oldStm)Writes statement |
| attributes | back to summary |
|---|---|
| private Map<Object, Object> attributes | |
| bindings | back to summary |
|---|---|
| private Map<Object, Expression> bindings | |
| exceptionListener | back to summary |
|---|---|
| private ExceptionListener exceptionListener | |
| executeStatements | back to summary |
|---|---|
| pack-priv boolean executeStatements | |
| finder | back to summary |
|---|---|
| private final PersistenceDelegateFinder finder | |
| Encoder | back to summary |
|---|---|
| public Encoder() Constructs an | |
| clear | back to summary |
|---|---|
| pack-priv void clear() | |
| cloneStatement | back to summary |
|---|---|
| private Statement cloneStatement(Statement oldExp) | |
| get | back to summary |
|---|---|
| public Object get(Object oldInstance) Returns a tentative value for | |
| getAttribute | back to summary |
|---|---|
| pack-priv Object getAttribute(Object key) | |
| getExceptionListener | back to summary |
|---|---|
| public ExceptionListener getExceptionListener() Gets the exception handler for this stream.
| |
| getPersistenceDelegate | back to summary |
|---|---|
| public PersistenceDelegate getPersistenceDelegate(Class<?> type) Returns the persistence delegate for the given type. The persistence delegate is calculated by applying the following rules in order:
| |
| getValue | back to summary |
|---|---|
| pack-priv Object getValue(Expression exp) | |
| remove | back to summary |
|---|---|
| public Object remove(Object oldInstance) Removes the entry for this instance, returning the old entry. | |
| setAttribute | back to summary |
|---|---|
| pack-priv void setAttribute(Object key, Object value) | |
| setExceptionListener | back to summary |
|---|---|
| public void setExceptionListener(ExceptionListener exceptionListener) Sets the exception handler for this stream to
| |
| setPersistenceDelegate | back to summary |
|---|---|
| public void setPersistenceDelegate(Class<?> type, PersistenceDelegate delegate) Associates the specified persistence delegate with the given type.
| |
| writeExpression | back to summary |
|---|---|
| public void writeExpression(Expression oldExp) The implementation first checks to see if an
expression with this value has already been written.
If not, the expression is cloned, using
the same procedure as
| |
| writeObject | back to summary |
|---|---|
| protected void writeObject(Object o) Write the specified object to the output stream. The serialized form will denote a series of expressions, the combined effect of which will create an equivalent object when the input stream is read. By default, the object is assumed to be a JavaBean with a nullary constructor, whose state is defined by the matching pairs of "setter" and "getter" methods returned by the Introspector.
| |
| writeObject1 | back to summary |
|---|---|
| private Object writeObject1(Object oldInstance) | |
| writeStatement | back to summary |
|---|---|
| public void writeStatement(Statement oldStm) Writes statement
The implementation of this method will produce
a second expression to represent the same expression in
an environment that will exist when the stream is read.
This is achieved simply by calling
| |