ariba.util.formatter
Interface StringParser

All Known Implementing Classes:
AWVFormatterFactory.NonBlankString, BigDecimalFormatter, BigDecimalMoneyFormatter, BooleanFormatter, DateFormatter, DecimalFormatterCommon, DoubleFormatter, Formatter, GenericChooser.FieldPathFormatter, GenericMoneyFormatter, IntegerArrayFormatter, IntegerFormatter, ListFormatter, LongFormatter, LowerCaseStringFormatter, NullStringParser, SecureStringFormatter, StringFormatter, SystemBooleanFormatter, UserDateFormatter

public interface StringParser

A StringParser is a class which can take a string and parse it into an object. The Formatter class and its subclasses implement this interface; some customer-defined classes under config may also implement this interface. It is used by the field defaulting framework to allow custom handling of string parsing. The parse() method takes a string and attempts to parse it into an object of the appropriate type. If the string can't be parsed, a ParseException is thrown. The value() method takes an arbitrary object and attempts to create an object of the appropriate type from it. In some cases the object returned may be the value itself (if it's already of the right type). Often, this method just converts the value to a string and calls parse(), returning a reasonable default value if a parse exception is caught.


Method Summary
 Object getValue(Object object)
          Returns an object of the appropriate type for object.
 Object parse(String string)
          Parses string into an object of the appropriate type.
 Object parse(String string, Locale locale)
          Parses string into an object of the appropriate type using the given locale.
 

Method Detail

parse

Object parse(String string)
             throws ParseException
Parses string into an object of the appropriate type.

Parameters:
string - the string to be parsed
Returns:
The object parsed from the input string
Throws:
ParseExceptionunexpected - error occurred while parsing string
ParseException

parse

Object parse(String string,
             Locale locale)
             throws ParseException
Parses string into an object of the appropriate type using the given locale.

Parameters:
string - the string to be parsed
locale - the locale used when parsing the string
Returns:
The object parsed from the input string
Throws:
ParseExceptionunexpected - error occurred while parsing string
ParseException

getValue

Object getValue(Object object)
Returns an object of the appropriate type for object.

Parameters:
object - The object being parsed
Returns:
Returns a object of the appropriate type


AribaWeb User Interface Development Framework
Copyright © 2000-2009 Ariba, Inc. All Rights Reserved.