All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.util.transforms
Class BaseFormatTransform

    com.sas.util.transforms.BaseFormatTransform

All Implemented Interfaces:
  com.sas.util.transforms.TransformInterface, java.io.Serializable

Direct Known Subclasses:
  FormatTransform, ParseTransform

    public abstract class BaseFormatTransform

implements com.sas.util.transforms.TransformInterface

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 or parsed value of another property. See `PropertyLinkAdaptor.addLink(Object, String, Object, String, com.sas.util.transforms.TransformInterface)`

Since:
  1.2
See Also:
  `FormatTransform`, `ParseTransform`, Serialized Form

Field Summary
`protected java.text.Format` | `format` The Format used to format and parse values.
`protected java.lang.String` | `SASpattern` If the format is a SAS format, this is the text pattern assigned in `setSASFormat(String)`

Constructor Summary
`BaseFormatTransform()` Construct a default FormatTransform which uses default rules to convert between number and String values.
`BaseFormatTransform(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.String` | `getDateFormat()` Return the date format pattern, or null if the format is anot a DateFormat.
`java.lang.String` | `getDecimalFormat()` Return the decimal format pattern, or null if the format is anot a DecimalFormat.
`java.text.Format` | `getFormat()` Return the value of the format property.
`java.lang.String` | `getSASFormat()`
`void` | `setDateFormat(java.lang.String pattern)` Set the pattern of a | `void` | `setDecimalFormat(java.lang.String pattern)` Set the pattern of a | `void` | `setFormat(java.text.Format newFormat)` Set the format property.
`void` | `setSASFormat(java.lang.String pattern)` Set the SAS format pattern to use for formatting and parsing.
`abstract java.lang.Object` | `transform(java.lang.Object object)`

Field Detail

### format

    protected java.text.Format format

  The Format used to format and parse values. If null, use the Locale default format.

### SASpattern

    protected java.lang.String SASpattern

  If the format is a SAS format, this is the text pattern assigned in `setSASFormat(String)`

Constructor Detail

### BaseFormatTransform

    public BaseFormatTransform()

  Construct a default FormatTransform which uses default rules to convert between number and String values.

### BaseFormatTransform

    public BaseFormatTransform(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 Detail

### setFormat

    public void setFormat(java.text.Format newFormat)

  Set the format property.

  Parameters:
    `newFormat` - the new value for the format property.

### getFormat

    public java.text.Format getFormat()

  Return the value of the format property.

  Returns:
    the value of the format property.

### transform

    public abstract java.lang.Object transform(java.lang.Object object)
                                        throws com.sas.util.transforms.TransformException

  Specified by:
    `transform` in interface `com.sas.util.transforms.TransformInterface`
  Throws:
    `com.sas.util.transforms.TransformException`

### setDecimalFormat

    public void setDecimalFormat(java.lang.String pattern)

  Set the pattern of a `DecimalFormat` format. This will set the SAS and date formats to null and set the format property to a new DecimalFormat instance. Note that in the current release of the class libraries, parsing using the SASFormat classes in the com.sas.text package is not implemented.

### getDecimalFormat

    public java.lang.String getDecimalFormat()

  Return the decimal format pattern, or null if the format is anot a DecimalFormat.

### setDateFormat

    public void setDateFormat(java.lang.String pattern)

  Set the pattern of a `SimpleDateFormat` format. This will set the SAS and decimal formats to null and set the format property to a new SimpleDateFormat instance.

### getDateFormat

    public java.lang.String getDateFormat()

  Return the date format pattern, or null if the format is anot a DateFormat.

### setSASFormat

    public void setSASFormat(java.lang.String pattern)

  Set the SAS format pattern to use for formatting and parsing. This will set the date and decimal format to null and set the format to a new SASFormat instance.

### getSASFormat

    public java.lang.String getSASFormat()

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.