public class MethodMirror extends Object
Modifier and Type | Field and Description |
---|---|
static String |
GETTER_REGEX
Regular expression for getter methods.
|
static String |
SETTER_REGEX
Regular expression for setter methods.
|
Constructor and Description |
---|
MethodMirror(Method reflectedMethod)
Public constructor for the reflection class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static String |
getCurrentMethodName(Integer depth)
Gets the name of the current method (with the selected depth) being executed.
|
String |
getFieldName()
Gets the field name from a getter/setter.
|
static String |
getFieldName(String methodName)
Gets the field name from a getter/setter.
|
Method |
getReflectedMethod()
Gets the method being reflected.
|
int |
hashCode() |
Object |
invokeMethod(Object targetObject,
Boolean ignoreAccess,
Object[] paramsValues)
Invokes a method from an object/class.
|
Object |
invokeMethod(String jndiPath,
Boolean ignoreAccess,
Object[] paramsValues)
Invokes a method from a JNDI object.
|
Boolean |
isGetter()
Returns if the method name is from a getter.
|
static Boolean |
isGetter(String methodName)
Returns if the method name is from a getter.
|
Boolean |
isSetter()
Returns if the method name is from a setter.
|
static Boolean |
isSetter(String methodName)
Returns if the method name is from a setter.
|
void |
setReflectedMethod(Method reflectedMethod)
Sets the method being reflected.
|
public static final String GETTER_REGEX
public static final String SETTER_REGEX
public MethodMirror(Method reflectedMethod) throws org.dejava.component.exception.localized.unchecked.EmptyParameterException
reflectedMethod
- Method being reflected.org.dejava.component.exception.localized.unchecked.EmptyParameterException
- If the reflected field is not given.public Method getReflectedMethod()
public void setReflectedMethod(Method reflectedMethod)
reflectedMethod
- New method being reflected.public static String getCurrentMethodName(Integer depth)
depth
- Depth in the current stack for the desired method (0 is the first and so on).public static Boolean isGetter(String methodName)
methodName
- The method name.public Boolean isGetter()
public static Boolean isSetter(String methodName)
methodName
- The method name.public Boolean isSetter()
public static String getFieldName(String methodName)
methodName
- The method name.public String getFieldName()
public Object invokeMethod(Object targetObject, Boolean ignoreAccess, Object[] paramsValues) throws org.dejava.component.exception.localized.unchecked.EmptyParameterException, org.dejava.component.exception.localized.unchecked.InvalidParameterException, InvocationException
targetObject
- The target object from which the method will be invoked.ignoreAccess
- If the defined access for the method must be ignored.paramsValues
- Parameters values to be used during the invocation.org.dejava.component.exception.localized.unchecked.EmptyParameterException
- If the target object is null and the method is not static.org.dejava.component.exception.localized.unchecked.InvalidParameterException
- If the given parameters are from the wrong type or if the method is unaccessible.InvocationException
- If the method throws an exception itself.public Object invokeMethod(String jndiPath, Boolean ignoreAccess, Object[] paramsValues) throws org.dejava.component.exception.localized.unchecked.InvalidParameterException, InvocationException
jndiPath
- The JNDI path for the object from which the method will be invoked.ignoreAccess
- If the defined access for the method must be ignored.paramsValues
- Parameters values to be used during the invocation.org.dejava.component.exception.localized.unchecked.InvalidParameterException
- If the parameters for this method are not valid (empty or method could not be accessed).InvocationException
- If the method throws an exception itself.public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
Copyright © 2013. All Rights Reserved.