org.kuali.rice.kns.web.format
Class NoOpStringFormatter

java.lang.Object
  extended by org.kuali.rice.kns.web.format.Formatter
      extended by org.kuali.rice.kns.web.format.NoOpStringFormatter
All Implemented Interfaces:
Serializable

public class NoOpStringFormatter
extends Formatter

This class is used to prevent reformatting of String values.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.kuali.rice.kns.web.format.Formatter
CREATE_MSG, propertyType, settings
 
Constructor Summary
NoOpStringFormatter()
           
 
Method Summary
 Object convertFromPresentationFormat(Object value)
          Returns an object representation of the provided string after first removing any extraneous formatting characters.
protected  Object convertToObject(String target)
          Does absolutely nothing to the given String.
 Object format(Object value)
          Does absolutely nothing to the given String.
 Object formatArray(Object value)
           
 Object formatCollection(Collection value)
           
 Object formatForPresentation(Object value)
          begin Kuali Foundation modification Returns a String representation of the given value.
 Object formatObject(Object value)
          May be overridden by subclasses to provide custom formatting behavior.
 
Methods inherited from class org.kuali.rice.kns.web.format.Formatter
convertToArray, convertToCollection, findFormatter, formatBean, formatNull, formatterForType, getFormatter, getFormatter, getImplementationClass, getNullObjectValue, getPropertyType, getSettings, isBlank, isEmptyValue, isNullValue, isSupportedType, registerFormatter, setPropertyType, setSettings, trimString, unwrapString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoOpStringFormatter

public NoOpStringFormatter()
Method Detail

convertToObject

protected Object convertToObject(String target)
Does absolutely nothing to the given String. Yes, this is actually a valuable way to prevent the POJO stuff from converting a simple String into a 1-element String array.

Overrides:
convertToObject in class Formatter

format

public Object format(Object value)
Does absolutely nothing to the given String. Yes, this is actually a valuable way to prevent the POJO stuff from converting a simple String into a 1-element String array.

Overrides:
format in class Formatter

convertFromPresentationFormat

public Object convertFromPresentationFormat(Object value)
Description copied from class: Formatter
Returns an object representation of the provided string after first removing any extraneous formatting characters. If the argument is a native array wrapping the actual value, the value is removed (unwrapped) from the array prior to invoking the callback method Formatter.convertToObject(String), which performs the actual conversion.

If the provided object is null, a blank String, or a String[] of length 0 or that has null or a blank String in the first position, returns null. Otherwise, If the destination property is a Collection, returns an instance of that type containing the string values of the array elements.

If the provided object is an array, uses a Formatter corresponding to the array's component type to convert each of its elements, and returns a new array containing the converted values. May be overidden by subclasses to customize conversion, though ordinarily Formatter.convertToObject(String)is a better choice since it takes advantage of convertFromPresentationFormat's built-in behavior.

Overrides:
convertFromPresentationFormat in class Formatter
Parameters:
value - the string value to be converted
Returns:
the object value corresponding to the provided string value
See Also:
Formatter.convertToObject(String)

formatArray

public Object formatArray(Object value)
Overrides:
formatArray in class Formatter

formatCollection

public Object formatCollection(Collection value)
Overrides:
formatCollection in class Formatter

formatForPresentation

public Object formatForPresentation(Object value)
Description copied from class: Formatter
begin Kuali Foundation modification Returns a String representation of the given value. May be overridden by subclasses to provide customized behavior for different types, though generally the callback method Formatter.format(Object)provides a better customization hook.

Provides default handling for properties typed as array or Collection. Subclass implementations of this method must invoke super.formatForPresentation() to take advantage of this built-in behavior.

Delegates to callback method formatObjectfor all other types. This method in turn invokes the callback method format, which serves as an extension point for subclasses; the default implementation simply returns its argument. Overriding format allows subclasses to take advantage of all of the array, primitive type, and Collection handling functionality provided by the base class.

Overrides:
formatForPresentation in class Formatter
Parameters:
value - the object to be formatted
Returns:
a formatted string representation of the given object
See Also:
end Kuali Foundation modification

formatObject

public Object formatObject(Object value)
Description copied from class: Formatter
May be overridden by subclasses to provide custom formatting behavior. Provides default formatting implementation for primitive types. (Note that primitive types are will always be wrapped in an array in order to be passed as an argument of type Object).

Overrides:
formatObject in class Formatter


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.