com.waveset.msgcat
Class Number

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.msgcat.MessageParameter
          extended bycom.waveset.msgcat.Number
All Implemented Interfaces:
javax.naming.Referenceable, XmlObject

public class Number
extends MessageParameter

An object that encapsulates a number that can be passed as a parameter to a localizable Message. Localization is not performed until called upon by the Catalog.


Field Summary
static java.lang.String ATT_IS_LONG
           
static java.lang.String ATT_NUMBER
           
static java.lang.String ATT_STYLE
           
static java.lang.String code_id
           
static int CURRENCY
           
static java.lang.String ELEMENT
           
static java.lang.String INVALID_NUMBER
           
static int NUMBER
           
static int PERCENT
           
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace
 
Constructor Summary
Number(double number)
          Create a new localizable number (real) parameter with default style set to NUMBER.
Number(double number, int style)
          Create a new localizable number (real) parameter.
Number(org.w3c.dom.Element e)
          Construct number from XML.
Number(long number)
          Create a new localizable number (integer) parameter with default style set to NUMBER.
Number(long number, int style)
          Create a new localizable number (integer) parameter.
Number(java.lang.String number)
          Create a new localizable number parameter from a string.
Number(java.lang.String number, int style)
          Create a new localizable number parameter from a string.
 
Method Summary
protected  void addSubclassAttributes(java.lang.StringBuffer b)
           
protected  void addSubclassElements(java.lang.StringBuffer b, int indent)
           
 boolean equals(java.lang.Object o)
          Determine equivalence.
static java.lang.String format(double number, int style, java.util.Locale locale)
           
static java.lang.String format(double number, java.util.Locale locale)
           
static java.lang.String format(long number, int style, java.util.Locale locale)
           
static java.lang.String format(long number, java.util.Locale locale)
           
 java.lang.String getElementName()
          Get the xml element name.
protected  boolean getIsLong()
          Get the flag that indicates whether or not the number is treated as a long.
protected  double getNumber()
          Get the number.
protected  int getStyle()
          Get the style.
protected  void parseSubclassAttributes(org.w3c.dom.Element e)
           
protected  void parseSubclassElements(org.w3c.dom.Element e)
           
 void parseXml(org.w3c.dom.Element e)
           
protected  void setIsLong(boolean is_long)
          Set whether or not the number is to be treated as a long.
protected  void setNumber(double number)
          Set the number.
protected  void setStyle(int style)
          Set the style;
 java.lang.String toString()
          Localize this date/time to the default locale.
 java.lang.String toString(java.util.Locale locale)
          Localize this number.
 java.lang.String toXml()
          Serialize this object as an XML string.
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize this object as an XML string.
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

ELEMENT

public static final java.lang.String ELEMENT
See Also:
Constant Field Values

NUMBER

public static final int NUMBER
See Also:
Constant Field Values

CURRENCY

public static final int CURRENCY
See Also:
Constant Field Values

PERCENT

public static final int PERCENT
See Also:
Constant Field Values

INVALID_NUMBER

public static final java.lang.String INVALID_NUMBER
See Also:
Constant Field Values

ATT_NUMBER

public static final java.lang.String ATT_NUMBER
See Also:
Constant Field Values

ATT_IS_LONG

public static final java.lang.String ATT_IS_LONG
See Also:
Constant Field Values

ATT_STYLE

public static final java.lang.String ATT_STYLE
See Also:
Constant Field Values
Constructor Detail

Number

public Number(org.w3c.dom.Element e)
       throws WavesetException
Construct number from XML.


Number

public Number(long number,
              int style)
Create a new localizable number (integer) parameter.

Parameters:
number - The number parameter.
style - Indicates the format style for the number.

Number

public Number(long number)
Create a new localizable number (integer) parameter with default style set to NUMBER.

Parameters:
number - The number parameter.

Number

public Number(double number,
              int style)
Create a new localizable number (real) parameter.

Parameters:
number - The number parameter.
style - Indicates the format style for the number.

Number

public Number(double number)
Create a new localizable number (real) parameter with default style set to NUMBER.

Parameters:
number - The number parameter.

Number

public Number(java.lang.String number,
              int style)
Create a new localizable number parameter from a string. The default expectation is that the number represented by the string will be a long (doubles aren't actually used yet in waveset display code).

Parameters:
number - The number parameter.
style - Indicates the format style for the number.

Number

public Number(java.lang.String number)
Create a new localizable number parameter from a string. The default expectation is that the number represented by the string will be a long. Default style set to NUMBER.

Parameters:
number - The number parameter.
Method Detail

format

public static java.lang.String format(double number,
                                      int style,
                                      java.util.Locale locale)

format

public static java.lang.String format(double number,
                                      java.util.Locale locale)

format

public static java.lang.String format(long number,
                                      int style,
                                      java.util.Locale locale)

format

public static java.lang.String format(long number,
                                      java.util.Locale locale)

getElementName

public java.lang.String getElementName()
Get the xml element name.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

getNumber

protected double getNumber()
Get the number.


getIsLong

protected boolean getIsLong()
Get the flag that indicates whether or not the number is treated as a long.


getStyle

protected int getStyle()
Get the style.


setNumber

protected void setNumber(double number)
Set the number.

Parameters:
number - The number parameter.

setIsLong

protected void setIsLong(boolean is_long)
Set whether or not the number is to be treated as a long.

Parameters:
is_long - The flag.

setStyle

protected void setStyle(int style)
Set the style;

Parameters:
style - Indicates the format style for the number.

toString

public java.lang.String toString(java.util.Locale locale)
Localize this number.

Specified by:
toString in class MessageParameter
Parameters:
locale - The locale to use.

toString

public java.lang.String toString()
Localize this date/time to the default locale.

Specified by:
toString in class MessageParameter

addSubclassAttributes

protected void addSubclassAttributes(java.lang.StringBuffer b)

addSubclassElements

protected void addSubclassElements(java.lang.StringBuffer b,
                                   int indent)

parseSubclassAttributes

protected void parseSubclassAttributes(org.w3c.dom.Element e)
                                throws WavesetException
Throws:
WavesetException

parseSubclassElements

protected void parseSubclassElements(org.w3c.dom.Element e)
                              throws WavesetException
Throws:
WavesetException

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Serialize this object as an XML string.

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject

parseXml

public void parseXml(org.w3c.dom.Element e)
              throws WavesetException
Throws:
WavesetException

toXml

public java.lang.String toXml()
Serialize this object as an XML string.

Specified by:
toXml in interface XmlObject
Overrides:
toXml in class AbstractXmlObject

equals

public boolean equals(java.lang.Object o)
Determine equivalence. Used for testing.