Java Doc for ReflectionUtils.java in  » J2EE » spring-framework-2.0.6 » org » springframework » 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 » J2EE » spring framework 2.0.6 » org.springframework.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.util.ReflectionUtils

ReflectionUtils
abstract public class ReflectionUtils (Code)
Simple utility class for handling reflection exceptions. Only intended for internal use.
author:
   Juergen Hoeller
author:
   Rob Harrop
author:
   Rod Johnson
author:
   Costin Leau
since:
   1.2.2

Inner Class :public static interface MethodCallback
Inner Class :public static interface MethodFilter
Inner Class :public static interface FieldCallback
Inner Class :public static interface FieldFilter

Field Summary
public static  FieldFilterCOPYABLE_FIELDS
     Pre-built FieldFilter that matches all non-static, non-final fields.


Method Summary
public static  booleandeclaresException(Method method, Class exceptionType)
     Determine whether the given method explicitly declares the given exception or one of its superclasses, which means that an exception of that type can be propagated as-is within a reflective invocation.
public static  voiddoWithFields(Class targetClass, FieldCallback fc)
     Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields.
public static  voiddoWithFields(Class targetClass, FieldCallback fc, FieldFilter ff)
     Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields.
public static  voiddoWithMethods(Class targetClass, MethodCallback mc)
     Perform the given callback operation on all matching methods of the given class and superclasses.
public static  voiddoWithMethods(Class targetClass, MethodCallback mc, MethodFilter mf)
     Perform the given callback operation on all matching methods of the given class and superclasses.
public static  MethodfindMethod(Class clazz, String name, Class[] paramTypes)
     Attempt to find a Method on the supplied type with the supplied name and parameter types.
public static  Method[]getAllDeclaredMethods(Class leafClass)
     Get all declared methods on the leaf class and all superclasses.
public static  voidhandleInvocationTargetException(InvocationTargetException ex)
     Handle the given invocation target exception.
public static  voidhandleReflectionException(Exception ex)
     Handle the given reflection exception.
public static  ObjectinvokeMethod(Method method, Object target)
     Invoke the specified Method against the supplied target object with no arguments.
public static  ObjectinvokeMethod(Method method, Object target, Object[] args)
     Invoke the specified Method against the supplied target object with the supplied arguments.
public static  booleanisPublicStaticFinal(Field field)
     Determine whether the given field is a "public static final" constant.
public static  voidmakeAccessible(Field field)
     Make the given field accessible, explicitly setting it accessible if necessary.
public static  voidshallowCopyFieldState(Object src, Object dest)
     Given the source object and the destination, which must be the same class or a subclass, copy all fields, including inherited fields.

Field Detail
COPYABLE_FIELDS
public static FieldFilter COPYABLE_FIELDS(Code)
Pre-built FieldFilter that matches all non-static, non-final fields.





Method Detail
declaresException
public static boolean declaresException(Method method, Class exceptionType)(Code)
Determine whether the given method explicitly declares the given exception or one of its superclasses, which means that an exception of that type can be propagated as-is within a reflective invocation.
Parameters:
  method - the declaring method
Parameters:
  exceptionType - the exception to throw true if the exception can be thrown as-is;false if it needs to be wrapped



doWithFields
public static void doWithFields(Class targetClass, FieldCallback fc) throws IllegalArgumentException(Code)
Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields.
Parameters:
  targetClass - the target class to analyze
Parameters:
  fc - the callback to invoke for each field



doWithFields
public static void doWithFields(Class targetClass, FieldCallback fc, FieldFilter ff) throws IllegalArgumentException(Code)
Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields.
Parameters:
  targetClass - the target class to analyze
Parameters:
  fc - the callback to invoke for each field
Parameters:
  ff - the filter that determines the fields to apply the callback to



doWithMethods
public static void doWithMethods(Class targetClass, MethodCallback mc) throws IllegalArgumentException(Code)
Perform the given callback operation on all matching methods of the given class and superclasses.

The same named method occurring on subclass and superclass will appear twice, unless excluded by a MethodFilter .
Parameters:
  targetClass - class to start looking at
Parameters:
  mc - the callback to invoke for each method
See Also:   ReflectionUtils.doWithMethods(Class,MethodCallback,MethodFilter)




doWithMethods
public static void doWithMethods(Class targetClass, MethodCallback mc, MethodFilter mf) throws IllegalArgumentException(Code)
Perform the given callback operation on all matching methods of the given class and superclasses.

The same named method occurring on subclass and superclass will appear twice, unless excluded by the specified MethodFilter .
Parameters:
  targetClass - class to start looking at
Parameters:
  mc - the callback to invoke for each method
Parameters:
  mf - the filter that determines the methods to apply the callback to




findMethod
public static Method findMethod(Class clazz, String name, Class[] paramTypes)(Code)
Attempt to find a Method on the supplied type with the supplied name and parameter types. Searches all superclasses up to Object.

Returns null if no Method can be found.
Parameters:
  clazz - the class to introspect
Parameters:
  name - the name of the method
Parameters:
  paramTypes - the parameter types of the method the Method object, or null if none found




getAllDeclaredMethods
public static Method[] getAllDeclaredMethods(Class leafClass) throws IllegalArgumentException(Code)
Get all declared methods on the leaf class and all superclasses. Leaf class methods are included first.



handleInvocationTargetException
public static void handleInvocationTargetException(InvocationTargetException ex)(Code)
Handle the given invocation target exception. Should only be called if no checked exception is expected to be thrown by the target method.

Throws the underlying RuntimeException or Error in case of such a root cause. Throws an IllegalStateException else.
Parameters:
  ex - the invocation target exception to handle




handleReflectionException
public static void handleReflectionException(Exception ex)(Code)
Handle the given reflection exception. Should only be called if no checked exception is expected to be thrown by the target method.

Throws the underlying RuntimeException or Error in case of an InvocationTargetException with such a root cause. Throws an IllegalStateException with an appropriate message else.
Parameters:
  ex - the reflection exception to handle




invokeMethod
public static Object invokeMethod(Method method, Object target)(Code)
Invoke the specified Method against the supplied target object with no arguments. The target object can be null when invoking a static Method .

Thrown exceptions are handled via a call to ReflectionUtils.handleReflectionException .
Parameters:
  method - the method to invoke
Parameters:
  target - the target object to invoke the method on the invocation result, if any
See Also:   ReflectionUtils.invokeMethod(java.lang.reflect.Method,Object,Object[])




invokeMethod
public static Object invokeMethod(Method method, Object target, Object[] args)(Code)
Invoke the specified Method against the supplied target object with the supplied arguments. The target object can be null when invoking a static Method .

Thrown exceptions are handled via a call to ReflectionUtils.handleReflectionException .
Parameters:
  method - the method to invoke
Parameters:
  target - the target object to invoke the method on
Parameters:
  args - the invocation arguments (may be null) the invocation result, if any
See Also:   ReflectionUtils.invokeMethod(java.lang.reflect.Method,Object,Object[])




isPublicStaticFinal
public static boolean isPublicStaticFinal(Field field)(Code)
Determine whether the given field is a "public static final" constant.
Parameters:
  field - the field to check



makeAccessible
public static void makeAccessible(Field field)(Code)
Make the given field accessible, explicitly setting it accessible if necessary. The setAccessible(true) method is only called when actually necessary, to avoid unnecessary conflicts with a JVM SecurityManager (if active).
Parameters:
  field - the field to make accessible
See Also:   java.lang.reflect.Field.setAccessible



shallowCopyFieldState
public static void shallowCopyFieldState(Object src, Object dest) throws IllegalArgumentException(Code)
Given the source object and the destination, which must be the same class or a subclass, copy all fields, including inherited fields. Designed to work on objects with public no-arg constructors.
throws:
  IllegalArgumentException - if the arguments are incompatible



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.