borland.jbcl Packages borland.jbcl Class Hierarchy borland.jbcl.model
java.lang.Object +----borland.jbcl.model.ItemFormatter +----borland.jbcl.model.VariantFormatter +----borland.jbcl.model.VariantFormatStr
Constructors Properties Methods
The VariantFormatStr class extends the VariantFormatter class through the use of String patterns to control formatting and parsing. It can handle all Variant types. Other formatter classes exist that are built to handle a specific Variant type.
There are five different kinds of pattern strings which can be used. Each is distinct, and the fields from one cannot be used with another. The type used will be inferred from the Variant.type passed into the constructor. The types are:
See edit/display masks for information about using the various patterns.
public VariantFormatStr(java.lang.String pattern, int variantType)Constructs a VariantFormatStr object that specifies the pattern used to format values and the type of data the object formats and parses.
Parameters:
public VariantFormatStr(java.lang.String pattern, int variantType, java.util.Locale locale)Constructs a VariantFormatStr object that specifies the pattern used to format values, the type of data the object formats and parses, and the locale.
Parameters:
public VariantFormatStr(java.lang.String pattern, int variantType, java.util.Locale locale, int scale, int precision, boolean isCurrency)Constructs a VariantFormatStr object that specifies the pattern used to format values, the type of data the object formats and parses, the locale, and other formatting information.
Parameters:
public Format getFormatObj()Returns the JDK Format subclass associated with this formatter. A returned value of null is possible.
public Locale getLocale()Returns the Locale object being used by this formatting class. The returned value will never be null.
public String getPattern()Returns the pattern used by this VariantFormatStr object for formatting and parsing. See edit/display patterns.
public int getScale()Returns the current scale factor, which is relevant only for BigDecimal data.
public int getVariantType()Returns the Variant type for this VariantFormatStr object.
public static final String buildTrueFormatMask(java.lang.String editMask)Returns a pattern string, removing any Borland-specific extensions.
Parameters:
public String format(borland.jbcl.util.Variant value)Returns a formatted string from the value specified with the value parameter. format() uses the current pattern to format the value. format() does not support all data types, but an attempt is made to cast the Variant data into a type required by the formatting logic.
The returned formatted string could be empty if the input Variant was null or unassigned. A null is returned if the formatting fails.
Parameters:
Overrides: borland.jbcl.model.VariantFormatter.format(Variant)
protected String getDefaultPattern(int variantType)Returns the default pattern used for formatting the data based on the Variant type and the current locale.
public Object getSpecialObject(int objType)Retrieves the special object associated with a particular formatter. This is a general purpose routine to obtain specific booleans, characters, flags, and so on inside a formatter, but it is completely dependent on the formatter being used.
Parameters:
Overrides: borland.jbcl.model.VariantFormatter.getSpecialObject(int)
public void parse(java.lang.String stringValue, borland.jbcl.util.Variant value)Parses a string using the current pattern and produces the appropriate value in the form of a Variant.
Parameters:
Overrides: borland.jbcl.model.VariantFormatter.parse(java.lang.String, Variant)
public void parse(java.lang.String stringValue, borland.jbcl.util.Variant value, int variantType)Parses a string using the current pattern and produces the appropriate value in the form of a Variant.
Parameters:
Overrides: borland.jbcl.model.VariantFormatter.parse(java.lang.String, Variant, int)
public String setPattern(java.lang.String pattern)Sets the pattern used by this VariantFormatStr object to format and parse. See edit/display masks for information about specifying a pattern.
The prior pattern is returned.
Parameters:
Overrides: borland.jbcl.model.VariantFormatter.setPattern(java.lang.String)
public Object setSpecialObject(int objType, java.lang.Object obj)Sets the special object associated with a particular formatter. This is a general purpose routine to obtain specific booleans, characters, flags, and so on inside a formatter, but it is completely dependent on the formatter being used. setSpecialObject() returns the prior special object, which can be useful for restoring the original value after a temporary alteration.
Parameters:
Overrides: borland.jbcl.model.VariantFormatter.setSpecialObject(int, java.lang.Object)