com.devexperts.evolution.utils.configencoder
Class ConfigEncoder

java.lang.Object
  extended by java.beans.Encoder
      extended by com.devexperts.evolution.utils.configencoder.ConfigEncoder

public class ConfigEncoder
extends java.beans.Encoder

The ConfigEncoder class is a complementary alternative to the XMLEncoder and can be used to generate a textual representation of a JavaBean in the same way that the XMLEncoder can be used to create XML representation of JavaBeans.

Author:
Anton V. Shakhmin
See Also:
XMLEncoder, ConfigDecoder

Field Summary
static java.lang.String DEFAULT_ENCODING
           
 
Constructor Summary
ConfigEncoder(java.io.OutputStream out)
          Creates a new output stream for sending JavaBeans to the stream out using UTF-8 encoding.
ConfigEncoder(java.io.Writer out)
           
 
Method Summary
 void close()
          This method calls flush, writes the closing postamble and then closes the output stream associated with this stream.
 NameConverter getNameConverter()
           
 java.lang.Object getOwner()
          Gets the owner of this encoder.
 java.beans.PersistenceDelegate getPersistenceDelegate(java.lang.Class<?> type)
           
 void setNameConverter(NameConverter nameConverter)
           
 void setOwner(java.lang.Object owner)
          Sets the owner of this encoder to owner.
 void writeExpression(java.beans.Expression oldExp)
          Records the Expression so that the Encoder will produce the actual output when the stream is flushed.
 void writeObject(java.lang.Object o)
          Write an representation of the specified object to the output.
 void writeStatement(java.beans.Statement oldStm)
          Records the Statement so that the Encoder will produce the actual output when the stream is flushed.
 
Methods inherited from class java.beans.Encoder
get, getExceptionListener, remove, setExceptionListener, setPersistenceDelegate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ENCODING

public static final java.lang.String DEFAULT_ENCODING
See Also:
Constant Field Values
Constructor Detail

ConfigEncoder

public ConfigEncoder(java.io.OutputStream out)
Creates a new output stream for sending JavaBeans to the stream out using UTF-8 encoding.

Parameters:
out - The stream to which the representation of the objects will be sent.
See Also:
ConfigDecoder.ConfigDecoder(InputStream)

ConfigEncoder

public ConfigEncoder(java.io.Writer out)
Method Detail

setOwner

public void setOwner(java.lang.Object owner)
Sets the owner of this encoder to owner.

Parameters:
owner - The owner of this encoder.
See Also:
getOwner()

getOwner

public java.lang.Object getOwner()
Gets the owner of this encoder.

Returns:
The owner of this encoder.
See Also:
setOwner(java.lang.Object)

getNameConverter

public NameConverter getNameConverter()

setNameConverter

public void setNameConverter(NameConverter nameConverter)

writeObject

public void writeObject(java.lang.Object o)
Write an representation of the specified object to the output.

Overrides:
writeObject in class java.beans.Encoder
Parameters:
o - The object to be written to the stream.
See Also:
ConfigDecoder.readObject()

getPersistenceDelegate

public java.beans.PersistenceDelegate getPersistenceDelegate(java.lang.Class<?> type)
Overrides:
getPersistenceDelegate in class java.beans.Encoder

writeStatement

public void writeStatement(java.beans.Statement oldStm)
Records the Statement so that the Encoder will produce the actual output when the stream is flushed.

This method should only be invoked within the context of initializing a persistence delegate.

Overrides:
writeStatement in class java.beans.Encoder
Parameters:
oldStm - The statement that will be written to the stream.
See Also:
PersistenceDelegate.initialize(java.lang.Class, java.lang.Object, java.lang.Object, java.beans.Encoder)

writeExpression

public void writeExpression(java.beans.Expression oldExp)
Records the Expression so that the Encoder will produce the actual output when the stream is flushed.

This method should only be invoked within the context of initializing a persistence delegate or setting up an encoder to read from a resource bundle.

For more information about using resource bundles with the ConfigEncoder, see http://java.sun.com/products/jfc/tsc/articles/persistence4/#i18n

Overrides:
writeExpression in class java.beans.Encoder
Parameters:
oldExp - The expression that will be written to the stream.
See Also:
PersistenceDelegate.initialize(java.lang.Class, java.lang.Object, java.lang.Object, java.beans.Encoder)

close

public void close()
This method calls flush, writes the closing postamble and then closes the output stream associated with this stream.



Copyright © 2012 Devexperts, LLC. All Rights Reserved.