borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.model 

SimpleFormatter component

java.lang.Object
   +----borland.jbcl.model.ItemFormatter
           +----borland.jbcl.model.VariantFormatter
                   +----borland.jbcl.model.SimpleFormatter

About the SimpleFormatter component

Constructors  Properties  Methods  
The SimpleFormatter class 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.

See also: Edit/display mask patterns


SimpleFormatter constructors

SimpleFormatter properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.model.VariantFormatter

Properties implemented in java.lang.Object

SimpleFormatter methods

Methods implemented in this class

Methods implemented in borland.jbcl.model.VariantFormatter

Methods implemented in java.lang.Object


SimpleFormatter constructors

SimpleFormatter()

  public SimpleFormatter()
Constructs a SimpleFormatter object.

SimpleFormatter(int)

  public SimpleFormatter(int variantType)
Constructs a SimpleFormatter object that instantiates a VariantFormatStr object of the specified Variant type.

Parameters:

variantType
The Variant type of the data the class will format and parse.

SimpleFormatter properties

formatObj

 public Format getFormatObj()
Calls the getFormatObj() method of the VariantFormatStr object, returning the format object.

locale

 public Locale getLocale()
Calls the getLocale() method of the VariantFormatStr object, returning the locale.

pattern

 public String getPattern()
Calls the getPattern() method of the VariantFormatStr object, returning the default pattern.

variantType

 public int getVariantType()
Calls the getVariantType() method of the VariantFormatStr object, returning the Variant type.

SimpleFormatter methods

format(borland.jbcl.util.Variant)

  public String format(borland.jbcl.util.Variant value)
Calls the format() method of the VariantFormatStr object, returning the formatted string.

Overrides: borland.jbcl.model.VariantFormatter.format(borland.jbcl.util.Variant)

getSpecialObject(int)

  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().

Parameters:

objType
The special object type to return.

Overrides: borland.jbcl.model.VariantFormatter.getSpecialObject(int)

parse(java.lang.String, borland.jbcl.util.Variant)

  public void parse(java.lang.String stringValue, borland.jbcl.util.Variant value)
Analyzes the given String and produces as output a Variant containing the approriate value.

Parameters:

stringValue
The string to be parsed.
value
The Variant that receives the parsed result.

Overrides: borland.jbcl.model.VariantFormatter.parse(java.lang.String, borland.jbcl.util.Variant)

parse(java.lang.String, borland.jbcl.util.Variant, int)

  public void parse(java.lang.String stringValue, borland.jbcl.util.Variant value, int variantType)

Overrides: borland.jbcl.model.VariantFormatter.parse(java.lang.String, borland.jbcl.util.Variant, int)

setPattern(java.lang.String)

  public String setPattern(java.lang.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.

Parameters:

pattern
The new pattern to be used for formatting and parsing.

Overrides: borland.jbcl.model.VariantFormatter.setPattern(java.lang.String)

setSpecialObject(int, java.lang.Object)

  public Object setSpecialObject(int objType, java.lang.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.

Parameters:

charType
The special object type. The possible values are VariantFormatter.FillChar, which is the fill character to fill blank slots, and VariantFormatter.Replacecharacter, which is used to replace FillChar on parse.
obj
The special object.

Overrides: borland.jbcl.model.VariantFormatter.setSpecialObject(int, java.lang.Object)