PTLog API - 1.0

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

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

public class DefaultIntFormatter
extends java.lang.Object
implements IntFormatter

Default implementation.

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


Field Summary
static DefaultIntFormatter S_DEC
          For convenience to format decimal radix as signed int.
static DefaultIntFormatter S_HEX
          For convenience to format hexadecimal radix as signed int.
static DefaultIntFormatter S_OCT
          For convenience to format in octal radix as signed int.
static DefaultIntFormatter U_DEC
          For convenience to format decimal radix as unsigned int.
static DefaultIntFormatter U_HEX
          For convenience to format hexadecimal radix as unsigned int.
static DefaultIntFormatter U_OCT
          For convenience to format in octal radix as unsigned int.
 
Constructor Summary
DefaultIntFormatter(int radix, boolean useSign)
          Constructor.
 
Method Summary
 java.lang.String format(int value)
          Format specified value.
 java.lang.String format(java.lang.Integer 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 DefaultIntFormatter S_OCT
For convenience to format in octal radix as signed int.

This returns "-1" for 0xFFFFFFFF.


U_OCT

public static final DefaultIntFormatter U_OCT
For convenience to format in octal radix as unsigned int.

This returns "37777777777" for 0xFFFFFFFF.


S_DEC

public static final DefaultIntFormatter S_DEC
For convenience to format decimal radix as signed int.

This returns "-1" for 0xFFFFFFFF.


U_DEC

public static final DefaultIntFormatter U_DEC
For convenience to format decimal radix as unsigned int.

This returns "4294967295" for 0xFFFFFFFF.


S_HEX

public static final DefaultIntFormatter S_HEX
For convenience to format hexadecimal radix as signed int.

This returns "-1" for 0xFFFFFFFF.


U_HEX

public static final DefaultIntFormatter U_HEX
For convenience to format hexadecimal radix as unsigned int.

This returns "ffffffff" for 0xFFFFFFFF.

Constructor Detail

DefaultIntFormatter

public DefaultIntFormatter(int radix,
                           boolean useSign)
Constructor.

Parameters:
radix - to format specified byte value.
useSign - whether sign('-') is used to represent value or not.
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(Integer) of "this".

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

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

format

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

Specified by:
format in interface IntFormatter

format

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

Specified by:
format in interface IntFormatter

PTLog API - 1.0