java.beans

Class Encoder

public class Encoder extends Object

Since: 1.4

Constructor Summary
Encoder()
Method Summary
Objectget(Object oldInstance)
Returns the replacement object which has been created by the encoder during the instantiation sequence or null if the object has not been processed yet.
ExceptionListenergetExceptionListener()
Returns the currently active {@link ExceptionListener} instance.
PersistenceDelegategetPersistenceDelegate(Class<?> type)
Objectremove(Object oldInstance)
voidsetExceptionListener(ExceptionListener listener)
Sets the {@link ExceptionListener} instance to be used for reporting recorable exceptions in the instantiation and initialization sequence.
voidsetPersistenceDelegate(Class<?> type, PersistenceDelegate delegate)
Sets the {@link PersistenceDelegate} instance for the given class.
voidwriteExpression(Expression expr)

Note: If you call this method not from within an object instantiation and initialization sequence it will be silently ignored.

protected voidwriteObject(Object o)
voidwriteStatement(Statement stmt)

Note: If you call this method not from within an object instantiation and initialization sequence it will be silently ignored.

Constructor Detail

Encoder

public Encoder()

Method Detail

get

public Object get(Object oldInstance)
Returns the replacement object which has been created by the encoder during the instantiation sequence or null if the object has not been processed yet.

Note: The String class acts as an endpoint for the inherently recursive algorithm of the {@link Encoder}. Therefore instances of String will always be returned by this method. In other words the assertion: assert (anyEncoder.get(anyString) == anyString)

Note: If null is requested, the result will always be null.

getExceptionListener

public ExceptionListener getExceptionListener()
Returns the currently active {@link ExceptionListener} instance.

getPersistenceDelegate

public PersistenceDelegate getPersistenceDelegate(Class<?> type)

remove

public Object remove(Object oldInstance)

setExceptionListener

public void setExceptionListener(ExceptionListener listener)
Sets the {@link ExceptionListener} instance to be used for reporting recorable exceptions in the instantiation and initialization sequence. If the argument is null a default instance will be used that prints the thrown exception to System.err.

setPersistenceDelegate

public void setPersistenceDelegate(Class<?> type, PersistenceDelegate delegate)
Sets the {@link PersistenceDelegate} instance for the given class.

Note: Throws a NullPointerException if the argument is null.

Note: Silently ignores PersistenceDelegates for Array types and primitive wrapper classes.

Note: Although this method is not declared static changes to the {@link PersistenceDelegate}s affect all {@link Encoder} instances. In this implementation the access is thread safe.

writeExpression

public void writeExpression(Expression expr)

Note: If you call this method not from within an object instantiation and initialization sequence it will be silently ignored.

writeObject

protected void writeObject(Object o)

writeStatement

public void writeStatement(Statement stmt)

Note: If you call this method not from within an object instantiation and initialization sequence it will be silently ignored.