borland Packages Class Hierarchy jbcl.model Package Index
java.lang.Object +----borland.jbcl.model.ItemFormatter +----borland.jbcl.model.VariantFormatter +----borland.jbcl.model.DoubleFormatter +----borland.jbcl.model.IntegerFormatter +----borland.jbcl.model.BooleanFormatter +----borland.jbcl.model.DateFormatter +----borland.jbcl.model.LongFormatter +----borland.jbcl.model.TimestampFormatter +----borland.jbcl.model.SimpleFormatter +----borland.jbcl.model.BigDecimalFormatter +----borland.jbcl.model.TimeFormatter +----borland.jbcl.model.VariantFormatStr +----borland.jbcl.model.StringFormatter +----borland.jbcl.model.ObjectFormatter +----borland.jbcl.model.BinaryFormatter
Properties MethodsThis general-purpose formatting class is a subclass of the abstract ItemFormatter that formats and parses Variant data. All classes in the dataset package use the VariantFormatter class exclusively.
public Format getFormatObj()VariantFormatter is itself a layer on the JDK's Format interface. getFormatObj() provides access to the underlying Format object being used by a particular formatter (which depends on the type of data being formatted). It returns the Format object being used (see JDK's description of Format, NumberFormat, DecimalFormat, and SimpleTimeFormat). getFormatObj() returns null if the constructor could not accept the initial pattern.
public Locale getLocale()Returns the Locale currently being used by this formatter. Currently, there is no way to change this locale once the formatter has been created. The returned value is never null.
public String getPattern()Returns the pattern currently being used by this formatter for parsing and formatting.
public int getScale()Returns the scale being used for numeric formatting. getScale() always returns -1, meaning no scale is being used. Override this method if you want to use a different scale.
public abstract int getVariantType()Returns the Variant. type being used by this variant formatter. All calls to getVariantType() will produce Variants of this type. There is no setVariantType() because there is a special version of parse(), which allows the caller to request a particular returned Variant type.
public abstract String format(borland.jbcl.util.Variant value)Returns a String representing the given value stored in the supplied object. All reasonable attempts are made to "cast" the type found in the object into the appropriate type specified in the constructor of the implementing classes. A returned empty string indicates a null or empty input value. null means the formatting failed.
Parameters:
public FastStringBuffer format(borland.jbcl.util.Variant value, borland.jbcl.util.FastStringBuffer buffer)Constructs a FastStringBuffer representing the given value stored in the supplied Variant. All reasonable attempts are made to "cast" the type found in the variant into the appropriate type specified in the constructor of the subclasses. A returned empty string indicates a null or empty input value. A null return means the formatting failed.
Parameters:
public String format(java.lang.Object value)Returns a String representing the given value stored in the supplied object. All reasonable attempts are made to "cast" the type found in the object into the appropriate type specified in the constructor of the implementing classes. A returned empty string indicates a null or empty input value. null means the formatting failed.
Parameters:
Overrides: borland.jbcl.model.ItemFormatter.format(java.lang.Object)
public Object getSpecialObject(int objType)Returns the value of the specified 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:
Overrides: borland.jbcl.model.ItemFormatter.getSpecialObject(int)
public void parse(borland.jbcl.util.Variant variant, char[] value, int offset, int len)A high-speed parse that parses directly into a character array.
Parameters:
public Object parse(java.lang.String stringValue)Analyzes the given String and produces as output an Object containing the appropriate value. A null return value results when stringValue is null or empty.
Parameters:
Overrides: borland.jbcl.model.ItemFormatter.parse(String)
public abstract 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:
public void parse(java.lang.String stringValue, borland.jbcl.util.Variant value, int variantType)An alternative form of parse() that allows the type of Variant returned to be specified.
Parameters:
public static final void setFromDouble(borland.jbcl.util.Variant value, int type, double val)
Parameters:
public static final void setFromInt(borland.jbcl.util.Variant value, int type, int val)Sets the variant using the specified int value.
Parameters:
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:
public Object setSpecialObject(int charType, 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: