borland Packages  Class Hierarchy  jbcl.model Package  Index 

ItemFormatStr class

java.lang.Object
   +----borland.jbcl.model.ItemFormatter
           +----borland.jbcl.model.ItemFormatStr

About the ItemFormatStr class

Constructors  Properties  Methods  
The ItemFormatStr exends the ItemFormatter class through the use of String patterns to control formatting and parsing. ItemFormatStr supports Variants only, and is a wrapper for the VariantFormatStr class.

See also: Edit/display mask patterns, VariantFormatStr class.


ItemFormatStr constructors

ItemFormatStr properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

ItemFormatStr methods

Methods implemented in this class

Methods implemented in java.lang.Object


ItemFormatStr constructors

ItemFormatStr(java.lang.String, int)

  public ItemFormatStr(java.lang.String pattern, int variantType)
Constructs an ItemFormatStr object that specifies the pattern used to format values and the type of data the object formats and parses.

Parameters:

pattern
The string of special characters uses to format values when using the format() method. If this value is null (or empty), the best default pattern is automatically selected based on the locale.
variantType
The Variant data type that is used by the format() and parse() methods.

ItemFormatStr(java.lang.String, int, java.util.Locale)

  public ItemFormatStr(java.lang.String pattern, int variantType, java.util.Locale locale)
Constructs an ItemFormatStr object that specifies the pattern used to format values, the type of data the object formats and parses, and the locale.

Parameters:

pattern
The string of special characters uses to format values when using the format() method. If this value is null (or empty), the best default pattern is automatically selected based on the locale.
variantType
The Variant data type that is used by the format() and parse() methods.
locale
The locale, which affects such things as what the currency sign looks like, how time and date data appears, and so on. If locale is null, the current default locale is used.

ItemFormatStr properties

formatObj

 public Format getFormatObj()
Returns the JDK Format subclass associated with this formatter. A returned value of null is possible.

locale

 public Locale getLocale()
Returns the Locale object being used by this formatting class. The returned value will never be null.

pattern

 public String getPattern()
Returns the pattern used by this VariantFormatStr object for formatting and parsing. See edit/display patterns.

ItemFormatStr methods

format(java.lang.Object)

  public String format(java.lang.Object 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 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:

value
The value to be formatted.

Overrides: borland.jbcl.model.ItemFormatter.format(java.lang.Object)

getSpecialObject(int)

  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:

objType
Identifies which object in which formatter to retrieve. It can be ItemFormatter.FILLCHARACTER or ItemFormatter.REPLACECHARACTER. Fill characters are used to fill empty slots in the string. Replace characters replace fill characters on output.

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

parse(java.lang.String)

  public Object parse(java.lang.String stringValue)
Parses the specified string and produces as output an Object containing the appropriate value.

Parameters:

stringValue
The string to be parsed.

Overrides: borland.jbcl.model.ItemFormatter.parse(java.lang.String)

setPattern(java.lang.String)

  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:

pattern
The pattern that controls the formatting and parsing.

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

setSpecialObject(int, java.lang.Object)

  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:

objType
Identifies which object in which formatter to retrieve. It can be ItemFormatter.FILLCHARACTER or ItemFormatter.REPLACECHARACTER. Fill characters are used to fill empty slots in the string. Replace characters replace fill characters on output.
obj
Contains the object to be set. The type of the Object must match the expected type for the given objType; do not pass a null object.