Java Doc for Formatter.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » core » web » format » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.core.web.format 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.kuali.core.web.format.Formatter

All known Subclasses:   org.kuali.core.web.format.PhoneNumberFormatter,  org.kuali.core.web.format.BooleanFormatter,  org.kuali.core.web.format.LittleBooleanFormatter,  org.kuali.core.web.format.TimestampAMPMFormatter,  org.kuali.core.web.format.NoOpStringFormatter,  org.kuali.module.financial.web.struts.form.CashReceiptDepositTypeFormatter,  org.kuali.core.web.format.LongFormatter,  org.kuali.core.web.format.BigDecimalFormatter,  org.kuali.core.web.format.TypeFormatter,  org.kuali.core.web.format.CollectionFormatter,  org.kuali.core.web.format.SimpleBooleanFormatter,  org.kuali.core.web.format.SummarizableFormatter,  org.kuali.core.web.format.DateFormatter,  org.kuali.module.financial.web.struts.form.CashDrawerStatusCodeFormatter,  org.kuali.core.web.format.PercentageFormatter,  org.kuali.core.web.format.CurrencyFormatter,  org.kuali.core.web.format.IntegerFormatter,  org.kuali.core.web.format.EncryptionFormatter,
Formatter
public class Formatter implements Serializable(Code)
It provides default formatting and conversion behavior for most value types, including primitives, arrays, and instances of most Collection types. Formatter and its subclasses were designed primarily to be used by web app framework components, though they can also be used in other contexts.

During request processing, the PojoActionForm uses Formatter instances to convert inbound request values to JavaBean property types. Whenever a given value cannot be converted to its target type, the conversion method PojoPropertyUtilsBean.getProperty(ObjectString) throws a FormatException to signal this condition to the calling code.

During the response phase, Struts tags make calls to the PojoRequestProcessor in order to access bean property values. The PojoRequestProcessor then uses Formatter instances to format the bean values for presentation in the user interface.

In either case, Formatter instances are obtained by calling Formatter.getFormatter(Class) , which looks in an internal registry to determine which Formatter class to instantiate, and returns a new instance. The StrutsLive framework includes a number of Formatter classes that are registered statically; additional Formatter classes can be registered at compile time or at run time.

Subclasses of Formatter typically override the callback methods Formatter.convertToObject(String) and Formatter.formatObject(Object) , which otherwise provide default conversion and formmating behavior needed for atomic values (i.e., an ordinary bean property such as a String or Integer, or else an element of a property typed as array or Collection).
See Also:   PojoActionForm.populate(HttpServletRequest)
See Also:   PojoPropertyUtilsBean.getProperty(ObjectString)



Field Summary
final static  StringCREATE_MSG
    
protected  ClasspropertyType
    
protected  Mapsettings
    


Method Summary
public  ObjectconvertFromPresentationFormat(Object value)
     Returns an object representation of the provided string after first removing any extraneous formatting characters.
protected  ObjectconvertToArray(String[] strings)
     Converts an array of strings to an array of objects by calling Formatter.convertToObject(String) on each element of the provided array in turn, using instances of a Formatter class that corresponds to this Formatter's property type.
protected  CollectionconvertToCollection(String[] strings)
     Converts an array of strings to a Collection type corresponding to the value of propertyType.
protected  ObjectconvertToObject(String string)
     May be orverridden by subclasses to customize its behavior.
public static  ClassfindFormatter(Class type)
    
public  Objectformat(Object value)
    
public  ObjectformatArray(Object value)
    
protected  ObjectformatBean(Object bean)
     If an element of the Collection isn't a supported type, assume it's a JavaBean, and format each of its properties.
public  ObjectformatCollection(Collection value)
    
public  ObjectformatForPresentation(Object value)
     begin Kuali Foundation modification Returns a String representation of the given value.
protected  ObjectformatNull()
     May be overridden by subclasses to provide special handling for null values when formatting a bean property value for presentation.
public  ObjectformatObject(Object value)
     May be overridden by subclasses to provide custom formatting behavior.
public static  ClassformatterForType(Class type)
     Return the Formatter associated with the given type, by consulting an internal registry.
public static  FormattergetFormatter(Class aType)
    
public static  FormattergetFormatter(Class aType, Map settings)
     Returns an instance of the Formatter class to be used to format the provided value type.
public  StringgetImplementationClass()
    
protected  ObjectgetNullObjectValue()
     May be overridden by subclasses to provide special handling for null values when converting from presentation format to a bean property type.
public  ClassgetPropertyType()
    
public  MapgetSettings()
    
protected  booleanisBlank(String string)
    
public static  booleanisEmptyValue(Object obj)
    
public static  booleanisNullValue(Object obj)
    
public static  booleanisSupportedType(Class type)
     Returns true if the provided class is an array type, implements either the List or Set interfaces, or is one of the Formatter classes currently registered.
public static  voidregisterFormatter(Class type, Class formatterType)
     Binds the provided value type to a Formatter type.
public  voidsetPropertyType(Class propertyType)
    
public  voidsetSettings(Map settings)
    
protected  StringtrimString(Object target)
    
public static  StringunwrapString(Object target)
    

Field Detail
CREATE_MSG
final static String CREATE_MSG(Code)



propertyType
protected Class propertyType(Code)



settings
protected Map settings(Code)





Method Detail
convertFromPresentationFormat
public Object convertFromPresentationFormat(Object value)(Code)
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.
Parameters:
  value - the string value to be converted the object value corresponding to the provided string value
See Also:    convertToObject(String)




convertToArray
protected Object convertToArray(String[] strings)(Code)
Converts an array of strings to an array of objects by calling Formatter.convertToObject(String) on each element of the provided array in turn, using instances of a Formatter class that corresponds to this Formatter's property type.
See Also:   Formatter.propertyType



convertToCollection
protected Collection convertToCollection(String[] strings)(Code)
Converts an array of strings to a Collection type corresponding to the value of propertyType. Since we don't have type information for the elements of the collection, no attempt is made to convert the elements from String to other types. However, subclasses can override this method if they need to provide the ability to convert the elements to a given type.



convertToObject
protected Object convertToObject(String string)(Code)
May be orverridden by subclasses to customize its behavior. The default implementation simply trims and returns the provided string.



findFormatter
public static Class findFormatter(Class type)(Code)



format
public Object format(Object value)(Code)



formatArray
public Object formatArray(Object value)(Code)



formatBean
protected Object formatBean(Object bean)(Code)
If an element of the Collection isn't a supported type, assume it's a JavaBean, and format each of its properties. Returns a Map containing the formatted properties keyed by property name.



formatCollection
public Object formatCollection(Collection value)(Code)



formatForPresentation
public Object formatForPresentation(Object value)(Code)
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 formatObject for 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.
Parameters:
  value - the object to be formatted a formatted string representation of the given object
See Also:   Formatter.formatObject(Object)
See Also:   end Kuali Foundation modification




formatNull
protected Object formatNull()(Code)
May be overridden by subclasses to provide special handling for null values when formatting a bean property value for presentation. The default implementation simply returns null



formatObject
public Object formatObject(Object value)(Code)
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).



formatterForType
public static Class formatterForType(Class type)(Code)
Return the Formatter associated with the given type, by consulting an internal registry. Additional associations can be made by calling registerFormatter(Class, Class) . a new Formatter instance



getFormatter
public static Formatter getFormatter(Class aType)(Code)



getFormatter
public static Formatter getFormatter(Class aType, Map settings)(Code)
Returns an instance of the Formatter class to be used to format the provided value type.
Parameters:
  type - the class of the value to be formatted
Parameters:
  settings - parameters used by subclasses to customize behavior an instance of Formatter or one of its subclasses



getImplementationClass
public String getImplementationClass()(Code)



getNullObjectValue
protected Object getNullObjectValue()(Code)
May be overridden by subclasses to provide special handling for null values when converting from presentation format to a bean property type. The default implementation simply returns null



getPropertyType
public Class getPropertyType()(Code)



getSettings
public Map getSettings()(Code)



isBlank
protected boolean isBlank(String string)(Code)
StringUtils.isEmptyString(String)



isEmptyValue
public static boolean isEmptyValue(Object obj)(Code)



isNullValue
public static boolean isNullValue(Object obj)(Code)



isSupportedType
public static boolean isSupportedType(Class type)(Code)
Returns true if the provided class is an array type, implements either the List or Set interfaces, or is one of the Formatter classes currently registered.
See Also:    registerFormatter(Class, Class)



registerFormatter
public static void registerFormatter(Class type, Class formatterType)(Code)
Binds the provided value type to a Formatter type. Note that a single Formatter class can be associated with more than one type.
Parameters:
  type - a value type
Parameters:
  formatterType - a Formatter type



setPropertyType
public void setPropertyType(Class propertyType)(Code)



setSettings
public void setSettings(Map settings)(Code)



trimString
protected String trimString(Object target)(Code)



unwrapString
public static String unwrapString(Object target)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.