org.jhotdraw.util
Class Methods
- java.lang.Object
-
- org.jhotdraw.util.Methods
-
public class Methods extends java.lang.ObjectMethods contains convenience methods for method invocations using java.lang.reflect.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.lang.Objectinvoke(java.lang.Object obj, java.lang.String methodName)Invokes the specified accessible parameterless method if it exists.static java.lang.Objectinvoke(java.lang.Object obj, java.lang.String methodName, boolean newValue)Invokes the specified setter method if it exists.static java.lang.Objectinvoke(java.lang.Object obj, java.lang.String methodName, java.lang.Class[] clazz, java.lang.Object... newValue)Invokes the specified setter method if it exists.static java.lang.Objectinvoke(java.lang.Object obj, java.lang.String methodName, java.lang.Class clazz, java.lang.Object newValue)Invokes the specified setter method if it exists.static java.lang.Objectinvoke(java.lang.Object obj, java.lang.String methodName, float newValue)Invokes the specified setter method if it exists.static java.lang.Objectinvoke(java.lang.Object obj, java.lang.String methodName, int newValue)Invokes the specified method if it exists.static java.lang.Objectinvoke(java.lang.Object obj, java.lang.String methodName, java.lang.String stringParameter)Invokes the specified accessible method with a string parameter if it exists.static booleaninvokeGetter(java.lang.Object obj, java.lang.String methodName, boolean defaultValue)Invokes the specified getter method if it exists.static intinvokeGetter(java.lang.Object obj, java.lang.String methodName, int defaultValue)Invokes the specified getter method if it exists.static longinvokeGetter(java.lang.Object obj, java.lang.String methodName, long defaultValue)Invokes the specified getter method if it exists.static java.lang.ObjectinvokeGetter(java.lang.Object obj, java.lang.String methodName, java.lang.Object defaultValue)Invokes the specified getter method if it exists.static voidinvokeIfExists(java.lang.Object obj, java.lang.String methodName)Invokes the specified setter method if it exists.static voidinvokeIfExists(java.lang.Object obj, java.lang.String methodName, boolean newValue)Invokes the specified method if it exists.static voidinvokeIfExists(java.lang.Object obj, java.lang.String methodName, java.lang.Class clazz, java.lang.Object newValue)Invokes the specified setter method if it exists.static voidinvokeIfExists(java.lang.Object obj, java.lang.String methodName, float newValue)Invokes the specified setter method if it exists.static voidinvokeIfExistsWithEnum(java.lang.Object obj, java.lang.String methodName, java.lang.String enumClassName, java.lang.String enumValueName)Invokes the specified setter method if it exists.static java.lang.ObjectinvokeStatic(java.lang.Class clazz, java.lang.String methodName)Invokes the specified accessible parameterless method if it exists.static java.lang.ObjectinvokeStatic(java.lang.Class clazz, java.lang.String methodName, java.lang.Class[] types, java.lang.Object[] values)Invokes the specified parameterless method if it exists.static java.lang.ObjectinvokeStatic(java.lang.String clazz, java.lang.String methodName)Invokes the specified accessible parameterless method if it exists.static java.lang.ObjectinvokeStatic(java.lang.String clazz, java.lang.String methodName, java.lang.Class[] types, java.lang.Object[] values)Invokes the specified parameterless method if it exists.static java.lang.ObjectinvokeStatic(java.lang.String clazz, java.lang.String methodName, java.lang.Class[] types, java.lang.Object[] values, java.lang.Object defaultValue)Invokes the specified parameterless method if it exists.static booleaninvokeStaticGetter(java.lang.Class clazz, java.lang.String methodName, boolean defaultValue)Invokes the specified getter method if it exists.
-
-
-
Method Detail
-
invoke
public static java.lang.Object invoke(java.lang.Object obj, java.lang.String methodName) throws java.lang.NoSuchMethodExceptionInvokes the specified accessible parameterless method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.- Returns:
- The return value of the method.
- Throws:
java.lang.NoSuchMethodException
-
invoke
public static java.lang.Object invoke(java.lang.Object obj, java.lang.String methodName, java.lang.String stringParameter) throws java.lang.NoSuchMethodExceptionInvokes the specified accessible method with a string parameter if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.stringParameter- The String parameter- Returns:
- The return value of the method or METHOD_NOT_FOUND.
- Throws:
java.lang.NoSuchMethodException
-
invokeStatic
public static java.lang.Object invokeStatic(java.lang.Class clazz, java.lang.String methodName) throws java.lang.NoSuchMethodExceptionInvokes the specified accessible parameterless method if it exists.- Parameters:
clazz- The class on which to invoke the method.methodName- The name of the method.- Returns:
- The return value of the method or METHOD_NOT_FOUND.
- Throws:
java.lang.NoSuchMethodException
-
invokeStatic
public static java.lang.Object invokeStatic(java.lang.String clazz, java.lang.String methodName) throws java.lang.NoSuchMethodExceptionInvokes the specified accessible parameterless method if it exists.- Parameters:
clazz- The class on which to invoke the method.methodName- The name of the method.- Returns:
- The return value of the method.
- Throws:
java.lang.NoSuchMethodException
-
invokeStatic
public static java.lang.Object invokeStatic(java.lang.Class clazz, java.lang.String methodName, java.lang.Class[] types, java.lang.Object[] values) throws java.lang.NoSuchMethodExceptionInvokes the specified parameterless method if it exists.- Parameters:
clazz- The class on which to invoke the method.methodName- The name of the method.types- The parameter types.values- The parameter values.- Returns:
- The return value of the method.
- Throws:
java.lang.NoSuchMethodException
-
invokeStatic
public static java.lang.Object invokeStatic(java.lang.String clazz, java.lang.String methodName, java.lang.Class[] types, java.lang.Object[] values) throws java.lang.NoSuchMethodExceptionInvokes the specified parameterless method if it exists.- Parameters:
clazz- The class on which to invoke the method.methodName- The name of the method.types- The parameter types.values- The parameter values.- Returns:
- The return value of the method.
- Throws:
java.lang.NoSuchMethodException
-
invokeStatic
public static java.lang.Object invokeStatic(java.lang.String clazz, java.lang.String methodName, java.lang.Class[] types, java.lang.Object[] values, java.lang.Object defaultValue)Invokes the specified parameterless method if it exists.- Parameters:
clazz- The class on which to invoke the method.methodName- The name of the method.types- The parameter types.values- The parameter values.defaultValue- The default value.- Returns:
- The return value of the method or the default value if the method does not exist or is not accessible.
-
invokeGetter
public static int invokeGetter(java.lang.Object obj, java.lang.String methodName, int defaultValue)Invokes the specified getter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.defaultValue- This value is returned, if the method does not exist.- Returns:
- The value returned by the getter method or the default value.
-
invokeGetter
public static long invokeGetter(java.lang.Object obj, java.lang.String methodName, long defaultValue)Invokes the specified getter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.defaultValue- This value is returned, if the method does not exist.- Returns:
- The value returned by the getter method or the default value.
-
invokeGetter
public static boolean invokeGetter(java.lang.Object obj, java.lang.String methodName, boolean defaultValue)Invokes the specified getter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.defaultValue- This value is returned, if the method does not exist.- Returns:
- The value returned by the getter method or the default value.
-
invokeGetter
public static java.lang.Object invokeGetter(java.lang.Object obj, java.lang.String methodName, java.lang.Object defaultValue)Invokes the specified getter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.defaultValue- This value is returned, if the method does not exist.- Returns:
- The value returned by the getter method or the default value.
-
invokeStaticGetter
public static boolean invokeStaticGetter(java.lang.Class clazz, java.lang.String methodName, boolean defaultValue)Invokes the specified getter method if it exists.- Parameters:
clazz- The object on which to invoke the method.methodName- The name of the method.defaultValue- This value is returned, if the method does not exist.- Returns:
- The value returned by the getter method or the default value.
-
invoke
public static java.lang.Object invoke(java.lang.Object obj, java.lang.String methodName, boolean newValue) throws java.lang.NoSuchMethodExceptionInvokes the specified setter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.- Throws:
java.lang.NoSuchMethodException
-
invoke
public static java.lang.Object invoke(java.lang.Object obj, java.lang.String methodName, int newValue) throws java.lang.NoSuchMethodExceptionInvokes the specified method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.- Throws:
java.lang.NoSuchMethodException
-
invoke
public static java.lang.Object invoke(java.lang.Object obj, java.lang.String methodName, float newValue) throws java.lang.NoSuchMethodExceptionInvokes the specified setter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.- Throws:
java.lang.NoSuchMethodException
-
invoke
public static java.lang.Object invoke(java.lang.Object obj, java.lang.String methodName, java.lang.Class clazz, java.lang.Object newValue) throws java.lang.NoSuchMethodExceptionInvokes the specified setter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.- Throws:
java.lang.NoSuchMethodException
-
invoke
public static java.lang.Object invoke(java.lang.Object obj, java.lang.String methodName, java.lang.Class[] clazz, java.lang.Object... newValue) throws java.lang.NoSuchMethodExceptionInvokes the specified setter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.- Throws:
java.lang.NoSuchMethodException
-
invokeIfExists
public static void invokeIfExists(java.lang.Object obj, java.lang.String methodName)Invokes the specified setter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.
-
invokeIfExists
public static void invokeIfExists(java.lang.Object obj, java.lang.String methodName, float newValue)Invokes the specified setter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.
-
invokeIfExists
public static void invokeIfExists(java.lang.Object obj, java.lang.String methodName, boolean newValue)Invokes the specified method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.
-
invokeIfExists
public static void invokeIfExists(java.lang.Object obj, java.lang.String methodName, java.lang.Class clazz, java.lang.Object newValue)Invokes the specified setter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.
-
invokeIfExistsWithEnum
public static void invokeIfExistsWithEnum(java.lang.Object obj, java.lang.String methodName, java.lang.String enumClassName, java.lang.String enumValueName)Invokes the specified setter method if it exists.- Parameters:
obj- The object on which to invoke the method.methodName- The name of the method.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG