ariba.util.formatter
Class StringFormatter

java.lang.Object
  extended by ariba.util.formatter.Formatter
      extended by ariba.util.formatter.StringFormatter
All Implemented Interfaces:
Compare, StringParser
Direct Known Subclasses:
LowerCaseStringFormatter, SecureStringFormatter

public class StringFormatter
extends Formatter

StringFormatter is a subclass of Formatter which is responsible for formatting, parsing, and comparing strings.


Field Summary
static java.lang.String ClassName
          Our Java class name.
 
Fields inherited from interface ariba.util.core.Compare
EqualTo, GreaterThan, LessThan
 
Constructor Summary
StringFormatter()
          Creates a new StringFormatter.
 
Method Summary
static int compareStrings(java.lang.String s1, java.lang.String s2)
          Compares two String values for sorting purposes.
static int compareStrings(java.lang.String s1, java.lang.String s2, java.util.Locale locale)
          Compares two String values for sorting purposes.
 java.lang.Object getValue(java.lang.Object object, java.util.Locale locale)
          Returns a new String derived from the given object.
 
Methods inherited from class ariba.util.formatter.Formatter
canFormatNulls, compare, compare, equal, equal, getFormat, getFormat, getFormatterClassForType, getFormatterForObject, getFormatterForType, getLocale, getStringValue, getStringValue, getValue, handlesNulls, isBidirectional, makeParseException, makeParseException, makeParseException, makeParseExceptionMessage, makeParseExceptionMessage, objectsAreEqual, objectsAreEqual, parse, parse, parseString, parseString, quickCompare, quickCompare, quickCompareValue, registerFormatter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ClassName

public static final java.lang.String ClassName
Our Java class name.

See Also:
Constant Field Values
Constructor Detail

StringFormatter

public StringFormatter()
Creates a new StringFormatter.

Method Detail

compareStrings

public static int compareStrings(java.lang.String s1,
                                 java.lang.String s2)
Compares two String values for sorting purposes. Returns an int value which is less than, equal to, or greater than zero depending on whether the first object sorts before, the same, or after the second object. Uses the default locale to create a Collator instance to do the comparison.

Parameters:
s1 - the first String to compare
s2 - the second String to compare
Returns:
int value which determines how the two strings should be ordered

compareStrings

public static int compareStrings(java.lang.String s1,
                                 java.lang.String s2,
                                 java.util.Locale locale)
Compares two String values for sorting purposes. Returns an int value which is less than, equal to, or greater than zero depending on whether the first object sorts before, the same, or after the second object. Uses the given locale to create a Collator instance to do the comparison. The locale must be non-null.

Parameters:
s1 - the first String to compare
s2 - the second String to compare
locale - the locale to do the comparison
Returns:
int value which determines how the two strings should be ordered

getValue

public java.lang.Object getValue(java.lang.Object object,
                                 java.util.Locale locale)
Returns a new String derived from the given object. If the object is not a String, returns the result of calling the toString method on the object. The locale parameter is currently unused.

Specified by:
getValue in class Formatter
Parameters:
object - the object to convert to a String
locale - the Locale to use for conversion (unused)
Returns:
a String derived from the given object


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