Java Doc for BeanUtils.java in  » Testing » PolePosition-0.20 » com » versant » core » 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 » Testing » PolePosition 0.20 » com.versant.core.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.versant.core.util.BeanUtils

BeanUtils
public class BeanUtils (Code)
Static utility methods for working with java beans.

Inner Class :public static class CmdLineResult



Method Summary
public static  voidfillFields(Object o, String prefix, Map props, Set fieldsToIgnore)
     Fill o by introspecting all of its public non-static, non-final fields that are int, Integer, boolean, Boolean or String and looking for properties named prefix + fieldname to populate them.
public static  SetgetAllProperties(Class cls)
     Get all the valid properties for this class.
public static  ObjectgetPropertyValue(Object bean, String property)
     Get the value of a property of bean.
public static  booleanisSupportedFieldType(Class t)
    
public static  ClassloadClass(String name, boolean initialize, ClassLoader loader)
     Load the class with name using loaded.
public static  ObjectnewInstance(String cname, ClassLoader loader, Class mustBe)
     Create a new instance of cname using loader.
public static  voidparseProperties(String ps, Properties props)
     Add any properties from a semicolon delimited String ps to props.
public static  voidparseProperties(String props, Object bean)
     Parse semicolon delimited properties from props and set them on bean.
public static  voidprintUsage(Object o, String[] requiredFields, String toolName, String toolDescription, boolean hasProps, PrintStream out)
    

Print command line usage information by introspecting o to find all of its public non-static, non-final fields that are int, Integer, boolean, Boolean or String.

public static  CmdLineResultprocessCmdLine(String[] args, ClassLoader loader, Object o, String[] requiredFields, String toolName, String toolDescription, boolean hasProps)
    

Process command line arguments.

public static  voidsetCommandLineArgs(Object bean, String[] args, String[] expected)
     Process a list of command line arguments in [-propertyname value]+ format setting each on the bean.
public static  voidsetProperties(Object bean, Map props)
     Find and set all properties or public fields on bean from key/value pairs in props.
public static  voidsetProperty(Object bean, String prop, String value)
     Set a property on bean.
public static  ClasstoClass(String primitiveName)
     Convert a primitive name (int, byte etc.) to a class or null if the name is not a primitive.



Method Detail
fillFields
public static void fillFields(Object o, String prefix, Map props, Set fieldsToIgnore)(Code)
Fill o by introspecting all of its public non-static, non-final fields that are int, Integer, boolean, Boolean or String and looking for properties named prefix + fieldname to populate them.



getAllProperties
public static Set getAllProperties(Class cls)(Code)
Get all the valid properties for this class.



getPropertyValue
public static Object getPropertyValue(Object bean, String property) throws Exception(Code)
Get the value of a property of bean.



isSupportedFieldType
public static boolean isSupportedFieldType(Class t)(Code)



loadClass
public static Class loadClass(String name, boolean initialize, ClassLoader loader) throws ClassNotFoundException(Code)
Load the class with name using loaded. The name may be a primitive (int, byte etc) or a single dimensional array (e.g. int[]).



newInstance
public static Object newInstance(String cname, ClassLoader loader, Class mustBe)(Code)
Create a new instance of cname using loader. It must be an instance of mustBe.



parseProperties
public static void parseProperties(String ps, Properties props)(Code)
Add any properties from a semicolon delimited String ps to props.



parseProperties
public static void parseProperties(String props, Object bean)(Code)
Parse semicolon delimited properties from props and set them on bean. This can handle String, int and boolean properties.
exception:
  IllegalArgumentException - on errors



printUsage
public static void printUsage(Object o, String[] requiredFields, String toolName, String toolDescription, boolean hasProps, PrintStream out)(Code)

Print command line usage information by introspecting o to find all of its public non-static, non-final fields that are int, Integer, boolean, Boolean or String. For each field a public static final String field named HELP_fieldname is used to provided a description of the field if present. The values of the fields in o are assumed to be the defaults.

If hasProps is true the information on how to specify key=value properties is also printed.




processCmdLine
public static CmdLineResult processCmdLine(String[] args, ClassLoader loader, Object o, String[] requiredFields, String toolName, String toolDescription, boolean hasProps)(Code)

Process command line arguments. Arguments starting with a dash are expected to match the names of public fields in o (like BeanUtils.fillFields ) with non-boolean fields requiring an argument. If a boolean field does not have an argument then it is set to true.

If hasProps is true then there is an implicit -p arguement to specify the resource name or filename of a properties file to load and return. The default name is versant.properties. The argument is first treated as a file and if this fails then as a resource. System properties starting with "versant." or "javax.jdo.option." are added after the properties are loaded. Finally command line arguments of the form key=value are added i.e. they override any previous value.

Errors are printed to System.err followed by usage information and an IllegalArgumentException is thrown.

If one of the args is /? or -help or --help then the usage is printed and an IllegalArgumentException is thrown.

The fieldsFilled set contains the names of all fields that wereset from the command line. If hasProps is true then the properties fieldon the result holds all properties with overrides already appliedotherwise it is null.



setCommandLineArgs
public static void setCommandLineArgs(Object bean, String[] args, String[] expected) throws IllegalArgumentException(Code)
Process a list of command line arguments in [-propertyname value]+ format setting each on the bean.
Parameters:
  args - Command line arguments as passed to a main method
Parameters:
  expected - Names of allowed properties
exception:
  IllegalArgumentException - if args are invalid



setProperties
public static void setProperties(Object bean, Map props) throws IllegalArgumentException(Code)
Find and set all properties or public fields on bean from key/value pairs in props. Only int, String and boolean properties and fields may be set. This is a NOP if props or bean is null.
exception:
  IllegalArgumentException - if any are invalid



setProperty
public static void setProperty(Object bean, String prop, String value) throws IllegalArgumentException(Code)
Set a property on bean. Only int, String and boolean properties may be set.
exception:
  IllegalArgumentException - if invalid



toClass
public static Class toClass(String primitiveName)(Code)
Convert a primitive name (int, byte etc.) to a class or null if the name is not a primitive.



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.