Java Doc for BeanUtil.java in  » Web-Framework » aranea-mvc-1.1.1 » org » araneaframework » backend » util » 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 » Web Framework » aranea mvc 1.1.1 » org.araneaframework.backend.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.araneaframework.backend.util.BeanUtil

BeanUtil
public class BeanUtil (Code)
This class provides methods to manipulate Bean fields. Simple (e.g. 'name') as well as nested (e.g. 'location.city') Bean fields are both supported. To propagate an empty Bean by nested fields, BeanUtil.fillFieldValue(Object,String,Object) method is recommended instead of BeanUtil.setFieldValue(Object,String,Object) to create missing Beans automatically.
author:
   Rein Raudjärv
See Also:   BeanMapper


Field Summary
final public static  charNESTED_DELIM
     The delimiter that separates the components of a nested reference.


Method Summary
public static  Objectclone(Object bean)
     Clones bean by copying its fields values (references) to a new instance of the same type.
Parameters:
  bean - bean Object, which value to set.
public static  Objectcopy(Object from, Object to)
     Sets all the fields with same names to same values.

NB! the values are references (there'is no deep copy made)!

from Bean fields that are not supported by to are ignored.

public static  Objectcopy(Object from, Class toType)
     Creates a new instance of Class toType and sets its field values to be the same as given from Object.
public static  voidfillFieldValue(Object bean, String field, Object value)
     Sets the value of Bean field identified by name field for object bean.
public static  ClassgetFieldType(Class beanClass, String field)
     Returns type of Bean field identified by name field.

Null is returned if no such method found.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - The name of Bean field.
public static  ObjectgetFieldValue(Object bean, String field)
     Returns the value of Bean field identified with name field for object bean.

Returns null if no bean specified or such method found.


Parameters:
  bean - Object, which value to return.
Parameters:
  field - The name of VO field.
public static  ListgetFields(Class beanClass)
     Returns List<String>- the List of Bean field names.

Only simple fields (not nested) are returned.


Parameters:
  beanClass - the class implementing the Bean pattern.
public static  MethodgetReadMethod(Class beanClass, String field)
     Returns read method (getter) for the field.

Null is returned if no such method found.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - Bean field name.
public static  MethodgetWriteMethod(Class beanClass, String field)
     Returns write method (setter) for the field.

Null is returned if no such method found.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - Bean field name.
public static  booleanisBean(Class clazz)
     Returns whether the given object type is a Bean type.
Parameters:
  clazz - the class.
public static  booleanisReadable(Class beanClass, String field)
     Checks that the field identified by field is a valid Bean field (can be read-only).

To enable reading the field, the spcfified beanClass must have getter (field's name starts with get or is) for this field.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - Bean field name.
public static  booleanisWritable(Class beanClass, String field)
     Checks that the field identified by field is a writable Bean field.

To enable writing the field, the spcfified beanClass must have setter (field's name starts with set) for this field.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - Bean field name.
public static  ObjectnewInstance(Class beanClass)
     Creates new instance of the specified beanClass.

In order to be Bean type, it must have a constructor without arguments.

public static  voidsetFieldValue(Object bean, String field, Object value)
     Sets the value of Bean field identified by name field for object bean.

Nothing happens if no bean specified, one of its sub-field is null or no such method found.

If one of the sub-fields (not the last one) is null, they are not automatically propagated.


Field Detail
NESTED_DELIM
final public static char NESTED_DELIM(Code)
The delimiter that separates the components of a nested reference.





Method Detail
clone
public static Object clone(Object bean)(Code)
Clones bean by copying its fields values (references) to a new instance of the same type.
Parameters:
  bean - bean Object, which value to set. new instance of bean type with same fields values(references)
See Also:   BeanUtil.copy(Object,Object)
See Also:   BeanUtil.copy(Object,Class)



copy
public static Object copy(Object from, Object to)(Code)
Sets all the fields with same names to same values.

NB! the values are references (there'is no deep copy made)!

from Bean fields that are not supported by to are ignored.


Parameters:
  from - Bean from which to convert.
Parameters:
  to - Bean to which to convert. to with values
See Also:   BeanUtil.copy(Object,Class)



copy
public static Object copy(Object from, Class toType)(Code)
Creates a new instance of Class toType and sets its field values to be the same as given from Object. Only fields with same names that exist in both from object and toType class are affected.
Parameters:
  from - Bean from which to read field values.
Parameters:
  toType - Class which object instance to create. new instance of toType with from values
See Also:   BeanUtil.copy(Object,Object)
See Also:   BeanUtil.clone()
See Also:   



fillFieldValue
public static void fillFieldValue(Object bean, String field, Object value)(Code)
Sets the value of Bean field identified by name field for object bean.

Nothing happens if no bean specified or such method found.

This method is identical to BeanUtil.setFieldValue(Object,String,Object) except that mssing beans in sub-fields (not the last one) of bean Object are created automatically.
Parameters:
  bean - bean Object, which value to set.
Parameters:
  field - The name of Bean field.
Parameters:
  value - The new value of the field.
See Also:   BeanUtil.setFieldValue(Object,String,Object)



getFieldType
public static Class getFieldType(Class beanClass, String field)(Code)
Returns type of Bean field identified by name field.

Null is returned if no such method found.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - The name of Bean field. The type of the field.



getFieldValue
public static Object getFieldValue(Object bean, String field)(Code)
Returns the value of Bean field identified with name field for object bean.

Returns null if no bean specified or such method found.


Parameters:
  bean - Object, which value to return.
Parameters:
  field - The name of VO field. The value of the field.



getFields
public static List getFields(Class beanClass)(Code)
Returns List<String>- the List of Bean field names.

Only simple fields (not nested) are returned.


Parameters:
  beanClass - the class implementing the Bean pattern. List<String>- the List of Beanfield names.



getReadMethod
public static Method getReadMethod(Class beanClass, String field)(Code)
Returns read method (getter) for the field.

Null is returned if no such method found.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - Bean field name. read method (getter) for the field.



getWriteMethod
public static Method getWriteMethod(Class beanClass, String field)(Code)
Returns write method (setter) for the field.

Null is returned if no such method found.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - Bean field name. write method (setter) for the field.



isBean
public static boolean isBean(Class clazz)(Code)
Returns whether the given object type is a Bean type.
Parameters:
  clazz - the class. whether the given object type is a Bean type.



isReadable
public static boolean isReadable(Class beanClass, String field)(Code)
Checks that the field identified by field is a valid Bean field (can be read-only).

To enable reading the field, the spcfified beanClass must have getter (field's name starts with get or is) for this field.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - Bean field name. if this field is in Bean.



isWritable
public static boolean isWritable(Class beanClass, String field)(Code)
Checks that the field identified by field is a writable Bean field.

To enable writing the field, the spcfified beanClass must have setter (field's name starts with set) for this field.


Parameters:
  beanClass - the class implementing the Bean pattern.
Parameters:
  field - Bean field name. if this field is in Bean.



newInstance
public static Object newInstance(Class beanClass)(Code)
Creates new instance of the specified beanClass.

In order to be Bean type, it must have a constructor without arguments.

If creating the new instance fails, a RuntimeException is thrown.


Parameters:
  beanClass - the class implementing the Bean pattern. new instance of the Bean type.



setFieldValue
public static void setFieldValue(Object bean, String field, Object value)(Code)
Sets the value of Bean field identified by name field for object bean.

Nothing happens if no bean specified, one of its sub-field is null or no such method found.

If one of the sub-fields (not the last one) is null, they are not automatically propagated. In order for this, use BeanUtil.fillFieldValue(Object,String,Object) method.


Parameters:
  bean - bean Object, which value to set.
Parameters:
  field - The name of Bean field.
Parameters:
  value - The new value of the field.
See Also:   BeanUtil.fillFieldValue(Object,String,Object)



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.