org.xins.logdoc
Class AbstractLogdocSerializable

java.lang.Object
  extended byorg.xins.logdoc.AbstractLogdocSerializable
All Implemented Interfaces:
LogdocSerializable

public abstract class AbstractLogdocSerializable
extends Object
implements LogdocSerializable

Abstract base class for LogdocSerializable implementations, with support for lazy initialization.

Since:
XINS 1.0.0
Version:
$Revision: 1.10 $ $Date: 2006/08/28 09:12:30 $
Author:
Ernst de Haan

Constructor Summary
protected AbstractLogdocSerializable()
          Constructs a new AbstractLogdocSerializable instance.
 
Method Summary
protected abstract  String initialize()
          Initializes this object.
 void serialize(LogdocStringBuffer buffer)
          Serializes this object for logging to the specified string buffer (wrapper method).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLogdocSerializable

protected AbstractLogdocSerializable()
Constructs a new AbstractLogdocSerializable instance. This constructor is only available for subclasses.

Method Detail

serialize

public final void serialize(LogdocStringBuffer buffer)
                     throws NullPointerException
Serializes this object for logging to the specified string buffer (wrapper method). This method first checks if this object is already initialized. If it is, then serialize(LogdocStringBuffer) is immediately called, otherwise initialize() is called first, to initialize this object.

Specified by:
serialize in interface LogdocSerializable
Parameters:
buffer - the LogdocStringBuffer to serialize to, cannot be null.
Throws:
NullPointerException - if buffer == null (this is checked only after the optional initialization is performed).

initialize

protected abstract String initialize()
Initializes this object. This method will be called the first time serialize(LogdocStringBuffer) is called. It should return the serialized form of this object which will from then on be returned from serialize(LogdocStringBuffer).

Returns:
the serialized form of this object which will from then on be returned from serialize(LogdocStringBuffer), a null will be interpreted as an empty string.


See http://www.xins.org/.