PTLog API - 1.0

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

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

public class DefaultShortFormatter
extends java.lang.Object
implements ShortFormatter

Default implementation.

This uses Integer#toString(int value, int radix), which is used invoked from Short#toString in fact, to format specified value.


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

This returns "-1" for 0xFFFF.


U_OCT

public static final DefaultShortFormatter U_OCT
For convenience to format in octal radix as unsigned short.

This returns "1777777" for 0xFFFF.


S_DEC

public static final DefaultShortFormatter S_DEC
For convenience to format decimal radix as signed short.

This returns "-1" for 0xFFFF.


U_DEC

public static final DefaultShortFormatter U_DEC
For convenience to format decimal radix as unsigned short.

This returns "65535" for 0xFFFF.


S_HEX

public static final DefaultShortFormatter S_HEX
For convenience to format hexadecimal radix as signed short.

This returns "-1" for 0xFFFF.


U_HEX

public static final DefaultShortFormatter U_HEX
For convenience to format hexadecimal radix as unsigned short.

This returns "ffff" for 0xFFFF.

Constructor Detail

DefaultShortFormatter

public DefaultShortFormatter(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(Short) of "this".

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

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

format

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

Specified by:
format in interface ShortFormatter

format

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

Specified by:
format in interface ShortFormatter

PTLog API - 1.0