|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
com.sas.util.transforms.FormatTransform
public class FormatTransform
Transform between numeric and String data using a Format.
This transform converts between numeric data and Strings
using the format method of a Format object, or converts a String
to a number using the parse methods. The Format can be a NumberFormat,
any Format instance returned from SASFormat (if you
wish to format using SAS formats), or any other class that extends from Format.
You can create property links between two components
such that one object's property is set to the formatted
value of another property.
For example, if component A has a property X of type double,
and component B has a property Y of type String and you
want B.Y to display the formatted value of A.X using
the DecimalFormat #,###.##,
you could use:
com.sas.PropertyLinkAdaptor(A, "X", B, "Y", new FormatTransform(new java.text.DecimalFormat("#,###.##")));
See
PropertyLinkAdaptor.addLink(Object, String, Object, String, com.sas.util.transforms.TransformInterface)
ParseTransform,
Serialized Form| Field Summary | |
|---|---|
static FormatTransform |
defaultInstance
A default instance which transforms between numbers and strings using the Locale's default number format. |
| Fields inherited from class com.sas.util.transforms.BaseFormatTransform |
|---|
format, SASpattern |
| Constructor Summary | |
|---|---|
FormatTransform()
Construct a default FormatTransform which uses default rules to convert between number and String values. |
|
FormatTransform(java.text.Format format)
Construct a FormatTransform which uses the format/parse methods of the format object to convert between number and String values. |
|
| Method Summary | |
|---|---|
java.lang.Object |
transform(java.lang.Object object)
Transform an object by applying the format to it. |
| Methods inherited from class com.sas.util.transforms.BaseFormatTransform |
|---|
getDateFormat, getDecimalFormat, getFormat, getSASFormat, setDateFormat, setDecimalFormat, setFormat, setSASFormat |
| Field Detail |
|---|
public static final FormatTransform defaultInstance
| Constructor Detail |
|---|
public FormatTransform()
public FormatTransform(java.text.Format format)
| Method Detail |
|---|
public java.lang.Object transform(java.lang.Object object)
throws com.sas.util.transforms.TransformException
transform in interface com.sas.util.transforms.TransformInterfacetransform in class BaseFormatTransformobject - an object to format
Number or if it implements one of
DoubleDataInterface or
FloatDataInterface, then
the corresponding toString method will be invoked on the
selected double or float value.
For example, if the object
implements DoubleDataInterface, then
the value is formatted via
DoubleData.toString(((DoubleDataInterface) object).getDoubleData()).
Else, if the object implements
one of the other numeric interfaces in the com.sas.lang package,
then the corresponding numeric value is read from the object
and formatted as a string.
For example, if the object
implements IntegerDataInterface, then
the value is formatted via
Integer.toString(((IntegerDataInterface) object).getIntegerData()).
com.sas.util.transforms.TransformException
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||