PTLog API - 1.0

jp.ne.dti.lares.foozy.ptlog.format
Class DefaultUniversalFormatter

java.lang.Object
  extended byjp.ne.dti.lares.foozy.ptlog.format.DefaultUniversalFormatter
All Implemented Interfaces:
BufferFormatter, ByteFormatter, CharFormatter, DoubleFormatter, FloatFormatter, IntFormatter, LongFormatter, ObjectFormatter, ShortFormatter, TraceFormatter, UniversalFormatter

public class DefaultUniversalFormatter
extends java.lang.Object
implements UniversalFormatter

Default implementation.

This delegates request to another which registered by setByteFormatter(jp.ne.dti.lares.foozy.ptlog.format.ByteFormatter) or the other methods.


Field Summary
 
Fields inherited from interface jp.ne.dti.lares.foozy.ptlog.format.BufferFormatter
DELIMITER_ADD, DELIMITER_MESSAGE, DELIMITER_VALUE
 
Constructor Summary
DefaultUniversalFormatter()
          Constructor.
 
Method Summary
 boolean accepts(java.lang.Object value)
          Return true always.
 void addObjectFormatter(ObjectFormatter formatter)
          Add specified one to list as formatter candidate.
 java.lang.String enter(java.lang.String subject, java.lang.String method)
          Format specified value.
 java.lang.String exit(java.lang.String subject, java.lang.String method)
          Format specified value.
 java.lang.String format(byte value)
          Format specified value.
 java.lang.String format(java.lang.Byte value)
          Format specified value.
 java.lang.String format(char value)
          Format specified value.
 java.lang.String format(java.lang.Character value)
          Format specified value.
 java.lang.String format(double value)
          Format specified value.
 java.lang.String format(java.lang.Double value)
          Format specified value.
 java.lang.String format(float value)
          Format specified value.
 java.lang.String format(java.lang.Float value)
          Format specified value.
 java.lang.String format(int value)
          Format specified value.
 java.lang.String format(java.lang.Integer value)
          Format specified value.
 java.lang.String format(long value)
          Format specified value.
 java.lang.String format(java.lang.Long value)
          Format specified value.
 java.lang.String format(java.lang.Object value)
          Format specified object.
 java.lang.String format(short value)
          Format specified value.
 java.lang.String format(java.lang.Short value)
          Format specified value.
 java.lang.String getDelimiter(int type)
          Get delimter for specified type.
 java.lang.String pass(java.lang.String subject, java.lang.String method, java.lang.String checkpoint)
          Format specified value.
 void setBufferFormatter(BufferFormatter formatter)
           
 void setByteFormatter(ByteFormatter formatter)
          Set ByteFormatter.
 void setCharFormatter(CharFormatter formatter)
          Set CharFormatter.
 void setDoubleFormatter(DoubleFormatter formatter)
          Set DoubleFormatter.
 void setFloatFormatter(FloatFormatter formatter)
          Set FloatFormatter.
 void setIntFormatter(IntFormatter formatter)
          Set IntFormatter.
 void setLongFormatter(LongFormatter formatter)
          Set LongFormatter.
 void setObjectFormatter(ObjectFormatter formatter)
          Clear all registered ObjectFormatters and add specified one.
 void setShortFormatter(ShortFormatter formatter)
          Set ShortFormatter.
 void setTraceFormatter(TraceFormatter formatter)
          Set TraceFormatter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUniversalFormatter

public DefaultUniversalFormatter()
Constructor.

Method Detail

setByteFormatter

public final void setByteFormatter(ByteFormatter formatter)
Set ByteFormatter.

"null" means DefaultByteFormatter.S_DEC.


setCharFormatter

public final void setCharFormatter(CharFormatter formatter)
Set CharFormatter.

"null" means DefaultCharFormatter.CHAR.


setShortFormatter

public final void setShortFormatter(ShortFormatter formatter)
Set ShortFormatter.

"null" means DefaultShortFormatter.S_DEC.


setIntFormatter

public final void setIntFormatter(IntFormatter formatter)
Set IntFormatter.

"null" means DefaultIntFormatter.S_DEC.


setLongFormatter

public final void setLongFormatter(LongFormatter formatter)
Set LongFormatter.

"null" means DefaultLongFormatter.S_DEC.


setFloatFormatter

public final void setFloatFormatter(FloatFormatter formatter)
Set FloatFormatter.

"null" means DefaultFloatFormatter.INSTANCE.


setDoubleFormatter

public final void setDoubleFormatter(DoubleFormatter formatter)
Set DoubleFormatter.

"null" means DefaultDoubleFormatter.INSTANCE.


setTraceFormatter

public final void setTraceFormatter(TraceFormatter formatter)
Set TraceFormatter.

"null" means DefaultTraceFormatter.INSTANCE.


setObjectFormatter

public final void setObjectFormatter(ObjectFormatter formatter)
Clear all registered ObjectFormatters and add specified one.

"null" causes only clearing.

ATTENTION:This does not suppose simultaneous invocation.

See Also:
addObjectFormatter(jp.ne.dti.lares.foozy.ptlog.format.ObjectFormatter), format(Object)

addObjectFormatter

public final void addObjectFormatter(ObjectFormatter formatter)
Add specified one to list as formatter candidate.

ATTENTION:This does not suppose simultaneous invocation.

See Also:
setObjectFormatter(jp.ne.dti.lares.foozy.ptlog.format.ObjectFormatter), format(Object)

setBufferFormatter

public final void setBufferFormatter(BufferFormatter formatter)

format

public java.lang.String format(byte value)
Format specified value.

Specified by:
format in interface ByteFormatter
See Also:
setByteFormatter(jp.ne.dti.lares.foozy.ptlog.format.ByteFormatter)

format

public java.lang.String format(java.lang.Byte value)
Format specified value.

Specified by:
format in interface ByteFormatter
See Also:
setByteFormatter(jp.ne.dti.lares.foozy.ptlog.format.ByteFormatter)

format

public java.lang.String format(char value)
Format specified value.

Specified by:
format in interface CharFormatter
See Also:
setCharFormatter(jp.ne.dti.lares.foozy.ptlog.format.CharFormatter)

format

public java.lang.String format(java.lang.Character value)
Format specified value.

Specified by:
format in interface CharFormatter
See Also:
setCharFormatter(jp.ne.dti.lares.foozy.ptlog.format.CharFormatter)

format

public java.lang.String format(short value)
Format specified value.

Specified by:
format in interface ShortFormatter
See Also:
setShortFormatter(jp.ne.dti.lares.foozy.ptlog.format.ShortFormatter)

format

public java.lang.String format(java.lang.Short value)
Format specified value.

Specified by:
format in interface ShortFormatter
See Also:
setShortFormatter(jp.ne.dti.lares.foozy.ptlog.format.ShortFormatter)

format

public java.lang.String format(int value)
Format specified value.

Specified by:
format in interface IntFormatter
See Also:
setIntFormatter(jp.ne.dti.lares.foozy.ptlog.format.IntFormatter)

format

public java.lang.String format(java.lang.Integer value)
Format specified value.

Specified by:
format in interface IntFormatter
See Also:
setIntFormatter(jp.ne.dti.lares.foozy.ptlog.format.IntFormatter)

format

public java.lang.String format(long value)
Format specified value.

Specified by:
format in interface LongFormatter
See Also:
setLongFormatter(jp.ne.dti.lares.foozy.ptlog.format.LongFormatter)

format

public java.lang.String format(java.lang.Long value)
Format specified value.

Specified by:
format in interface LongFormatter
See Also:
setLongFormatter(jp.ne.dti.lares.foozy.ptlog.format.LongFormatter)

format

public java.lang.String format(float value)
Format specified value.

Specified by:
format in interface FloatFormatter
See Also:
setFloatFormatter(jp.ne.dti.lares.foozy.ptlog.format.FloatFormatter)

format

public java.lang.String format(java.lang.Float value)
Format specified value.

Specified by:
format in interface FloatFormatter
See Also:
setFloatFormatter(jp.ne.dti.lares.foozy.ptlog.format.FloatFormatter)

format

public java.lang.String format(double value)
Format specified value.

Specified by:
format in interface DoubleFormatter
See Also:
setDoubleFormatter(jp.ne.dti.lares.foozy.ptlog.format.DoubleFormatter)

format

public java.lang.String format(java.lang.Double value)
Format specified value.

Specified by:
format in interface DoubleFormatter
See Also:
setDoubleFormatter(jp.ne.dti.lares.foozy.ptlog.format.DoubleFormatter)

enter

public java.lang.String enter(java.lang.String subject,
                              java.lang.String method)
Format specified value.

Specified by:
enter in interface TraceFormatter
Parameters:
subject - of logging request.
method - from which logging is requested.
See Also:
setTraceFormatter(jp.ne.dti.lares.foozy.ptlog.format.TraceFormatter)

exit

public java.lang.String exit(java.lang.String subject,
                             java.lang.String method)
Format specified value.

Specified by:
exit in interface TraceFormatter
Parameters:
subject - of logging request.
method - from which logging is requested.
See Also:
setTraceFormatter(jp.ne.dti.lares.foozy.ptlog.format.TraceFormatter)

pass

public java.lang.String pass(java.lang.String subject,
                             java.lang.String method,
                             java.lang.String checkpoint)
Format specified value.

Specified by:
pass in interface TraceFormatter
Parameters:
subject - of logging request.
method - from which logging is requested.
checkpoint - to pass
See Also:
setTraceFormatter(jp.ne.dti.lares.foozy.ptlog.format.TraceFormatter)

accepts

public boolean accepts(java.lang.Object value)
Return true always.

Specified by:
accepts in interface UniversalFormatter

format

public java.lang.String format(java.lang.Object value)
Format specified object.
  1. use DefaultObjectFormatter.INSTANCE if specified one is null or instance of java.lang.String
  2. invoke ObjectFormatter.accepts(java.lang.Object) on each registered formatters, and
  3. use first one which returned "true"
  4. use DefaultObjectFormatter.INSTANCE if no one accepts specified object

Specified by:
format in interface UniversalFormatter

getDelimiter

public java.lang.String getDelimiter(int type)
Description copied from interface: BufferFormatter
Get delimter for specified type.

Specified "type" must be one of below.

Specified by:
getDelimiter in interface BufferFormatter
Parameters:
type - of delimiter

PTLog API - 1.0