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
 java.lang.Object getValue(java.lang.Object object)
          Returns an object of the appropriate type for object.
 java.lang.Object parse(java.lang.String string)
          Parses string into an object of the appropriate type.
 java.lang.Object parse(java.lang.String string, java.util.Locale locale)
          Parses string into an object of the appropriate type using the given locale.
 

Method Detail

parse

java.lang.Object parse(java.lang.String string)
                       throws java.text.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
java.text.ParseException

parse

java.lang.Object parse(java.lang.String string,
                       java.util.Locale locale)
                       throws java.text.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
java.text.ParseException

getValue

java.lang.Object getValue(java.lang.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-2014 Ariba, Inc. All Rights Reserved.