borland Packages Class Hierarchy dx.text Package
java.lang.Object +----com.borland.dx.text.ItemFormatter +----com.borland.dx.text.VariantFormatter +----com.borland.dx.text.SimpleFormatter
Constructors Properties Methods
Implements Serializable
The SimpleFormatter
component is a wrapper for the VariantFormatStr
class. It is a simple implementation of a formating and parsing class that uses the default locale and the default control pattern for the particular Variant
that is passed to it.
public SimpleFormatter()Constructs a
SimpleFormatter
object.
public SimpleFormatter(int variantType)Constructs a
SimpleFormatter
object that instantiates a VariantFormatStr
object of the specified Variant
type.
variantType
Variant
type of the data the class will format and parse.
public Format getFormatObj()Calls
getFormatObj()
of the VariantFormatStr
object, returning the format object.
public Locale getLocale()Calls
getLocale()
of the VariantFormatStr
object, returning the locale.
public String getPattern()Calls
getPattern()
of the VariantFormatStr
object, returning the default pattern.
public int getVariantType()Calls
getVariantType()
of the VariantFormatStr
object, returning the Variant
type.
public String format(Variant value)Calls the
format()
method of the VariantFormatStr
object, returning the formatted string.
value
value
isn't a Variant
, the method throws the InvalidFormatException
.
public Object getSpecialObject(int objType)Calls the
getSpecialObject()
method of the VariantFormatStr
object, returning the special object.
Some Formatter classes define special objects for their own use. You must know the internal details of the Format subclass being used to use getSpecialObject(
).
objType
public void parse(String stringValue, Variant value)Analyzes the given
String
and produces as output a Variant
containing the approriate value.
stringValue
value
Variant
that receives the parsed result.
public void parse(String stringValue, Variant value, int variantType)Analyzes the given
String
and produces as output a Variant
containing the approriate value.
stringValue
value
Variant
that receives the parsed result.
variantType
Variant
being used.
public String setPattern(String pattern)Sets the pattern used for parsing and formatting to a new pattern, returning the old pattern. The new pattern must be of the same basic type associated with this type of formatter. For example, if you used a Date/Time pattern in the constructor, you can't switch to a numeric pattern as each basic pattern type has its own data-dependent
format()
and parse()
methods.
If the new pattern is null (or empty), setPattern()
chooses a default pattern for the current locale.
pattern
public Object setSpecialObject(int objType, Object obj)Some Formatter classes define special objects for their own use. This method allows them to be set. You must know the internal details of the Format subclass being used to use
setSpecialObject(
).
The returned value is the prior value of the object.
charType
VariantFormatter.FillChar
, which is the fill character to fill blank slots, and VariantFormatter.Replacecharacter
, which is used to replace FillChar
on parse.
obj