Package org.apache.juneau.objecttools
Class ObjectIntrospector
java.lang.Object
org.apache.juneau.objecttools.ObjectIntrospector
POJO method introspector.
 
   This class is used to invoke methods on Objects using arguments in serialized form.
 
Example:
   String 
The arguments passed to the identified method are POJOs serialized in JSON format. Arbitrarily complex arguments can be passed in as arguments.
- This is an extremely powerful but potentially dangerous tool. Use wisely.
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionShortcut for callingnew ObjectIntrospector(o,null );ObjectIntrospector(Object object, ReaderParser parser) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionstatic ObjectIntrospectorStatic creator.static ObjectIntrospectorcreate(Object o, ReaderParser parser) Static creator.<T> TinvokeMethod(Class<T> returnType, Method method, Reader args) Primary method.<T> TinvokeMethod(Class<T> returnType, String method, String args) Convenience method for invoking argument from method signature (@seeMethodInfo.getSignature().invokeMethod(Method method, Reader args) Primary method.invokeMethod(String method, String args) Convenience method for invoking argument from method signature (@seeMethodInfo.getSignature().
- 
Constructor Details- 
ObjectIntrospectorConstructor.- Parameters:
- object- The object on which Java methods will be invoked.
- parser- The parser to use to parse the method arguments. If- null ,- JsonParser.DEFAULTis used.
 
- 
ObjectIntrospectorShortcut for callingnew ObjectIntrospector(o,null );- Parameters:
- o- The object on which Java methods will be invoked.
 
 
- 
- 
Method Details- 
createStatic creator.- Parameters:
- o- The object on which Java methods will be invoked.
- Returns:
- A new ObjectIntrospectorobject.
 
- 
createStatic creator.- Parameters:
- o- The object on which Java methods will be invoked.
- parser- The parser to use to parse the method arguments.
- Returns:
- A new ObjectIntrospectorobject.
 
- 
invokeMethodpublic Object invokeMethod(Method method, Reader args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, ParseException, IOException Primary method.Invokes the specified method on this bean. - Parameters:
- method- The method being invoked.
- args- The arguments to pass as parameters to the method. These will automatically be converted to the appropriate object type if possible. Can be- null if method has no arguments.
- Returns:
- The object returned by the call to the method, or null if target object isnull .
- Throws:
- IllegalAccessException- If the- Constructor object enforces Java language access control and the underlying constructor is inaccessible.
- IllegalArgumentException- If one of the following occurs:- The number of actual and formal parameters differ.
- An unwrapping conversion for primitive arguments fails.
- A parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
- The constructor pertains to an enum type.
 
- InvocationTargetException- If the underlying constructor throws an exception.
- ParseException- Malformed input encountered.
- IOException- Thrown by underlying stream.
 
- 
invokeMethodpublic <T> T invokeMethod(Class<T> returnType, Method method, Reader args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, ParseException, IOException Primary method.Invokes the specified method on this bean. - Type Parameters:
- T- The return type of the method call.
- Parameters:
- returnType- The return type of the method call.
- method- The method being invoked.
- args- The arguments to pass as parameters to the method. These will automatically be converted to the appropriate object type if possible. Can be- null if method has no arguments.
- Returns:
- The object returned by the call to the method, or null if target object isnull .
- Throws:
- IllegalAccessException- If the- Constructor object enforces Java language access control and the underlying constructor is inaccessible.
- IllegalArgumentException- If one of the following occurs:- The number of actual and formal parameters differ.
- An unwrapping conversion for primitive arguments fails.
- A parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
- The constructor pertains to an enum type.
 
- InvocationTargetException- If the underlying constructor throws an exception.
- ParseException- Malformed input encountered.
- IOException- Thrown by underlying stream.
 
- 
invokeMethodpublic Object invokeMethod(String method, String args) throws NoSuchMethodException, IllegalArgumentException, InvocationTargetException, IllegalAccessException, ParseException, IOException Convenience method for invoking argument from method signature (@seeMethodInfo.getSignature().- Parameters:
- method- The method being invoked.
- args- The arguments to pass as parameters to the method. These will automatically be converted to the appropriate object type if possible. Can be- null if method has no arguments.
- Returns:
- The object returned by the call to the method, or null if target object isnull .
- Throws:
- NoSuchMethodException- If method does not exist.
- IllegalAccessException- If the- Constructor object enforces Java language access control and the underlying constructor is inaccessible.
- IllegalArgumentException- If one of the following occurs:- The number of actual and formal parameters differ.
- An unwrapping conversion for primitive arguments fails.
- A parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
- The constructor pertains to an enum type.
 
- InvocationTargetException- If the underlying constructor throws an exception.
- ParseException- Malformed input encountered.
- IOException- Thrown by underlying stream.
 
- 
invokeMethodpublic <T> T invokeMethod(Class<T> returnType, String method, String args) throws NoSuchMethodException, IllegalArgumentException, InvocationTargetException, IllegalAccessException, ParseException, IOException Convenience method for invoking argument from method signature (@seeMethodInfo.getSignature().- Type Parameters:
- T- The return type of the method call.
- Parameters:
- returnType- The return type of the method call.
- method- The method being invoked.
- args- The arguments to pass as parameters to the method. These will automatically be converted to the appropriate object type if possible. Can be- null if method has no arguments.
- Returns:
- The object returned by the call to the method, or null if target object isnull .
- Throws:
- NoSuchMethodException- If method does not exist.
- IllegalAccessException- If the- Constructor object enforces Java language access control and the underlying constructor is inaccessible.
- IllegalArgumentException- If one of the following occurs:- The number of actual and formal parameters differ.
- An unwrapping conversion for primitive arguments fails.
- A parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
- The constructor pertains to an enum type.
 
- InvocationTargetException- If the underlying constructor throws an exception.
- ParseException- Malformed input encountered.
- IOException- Thrown by underlying stream.
 
 
-