PTLog API - 1.0

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

java.lang.Object
  extended byjp.ne.dti.lares.foozy.ptlog.format.DefaultLongFormatter
All Implemented Interfaces:
LongFormatter

public class DefaultLongFormatter
extends java.lang.Object
implements LongFormatter

Default implementation.

This uses Long#toString(long value, int radix) to format specified value.


Field Summary
static DefaultLongFormatter S_DEC
          For convenience to format decimal radix as signed long.
static DefaultLongFormatter S_HEX
          For convenience to format hexadecimal radix as signed long.
static DefaultLongFormatter S_OCT
          For convenience to format in octal radix as signed long.
 
Constructor Summary
DefaultLongFormatter(int radix)
          Constructor.
 
Method Summary
 java.lang.String format(long value)
          Format specified value.
 java.lang.String format(java.lang.Long value)
          Format specified value.
 ObjectFormatter forObject()
          Get object which adapts "this" to ObjectFormatter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_OCT

public static final DefaultLongFormatter S_OCT
For convenience to format in octal radix as signed long.

This returns "-1" for 0xFFFFFFFFFFFFFFFF.


S_DEC

public static final DefaultLongFormatter S_DEC
For convenience to format decimal radix as signed long.

This returns "-1" for 0xFFFFFFFFFFFFFFFF.


S_HEX

public static final DefaultLongFormatter S_HEX
For convenience to format hexadecimal radix as signed long.

This returns "-1" for 0xFFFFFFFFFFFFFFFF.

Constructor Detail

DefaultLongFormatter

public DefaultLongFormatter(int radix)
Constructor.

Parameters:
radix - to format specified byte value.
Method Detail

forObject

public final ObjectFormatter forObject()
Get object which adapts "this" to ObjectFormatter.

This is useful to get ObjectFormatter which formats value in as same manner as format(Long) of "this".

This adaptation is done even if you override format(Long) in derived classes.

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

format

public java.lang.String format(long value)
Description copied from interface: LongFormatter
Format specified value.

Specified by:
format in interface LongFormatter

format

public java.lang.String format(java.lang.Long value)
Description copied from interface: LongFormatter
Format specified value.

Specified by:
format in interface LongFormatter

PTLog API - 1.0