suppress warnings about inexact argument type
This commit is contained in:
@@ -291,15 +291,12 @@ public abstract class DataAware {
|
|||||||
* @param obj the object which contains the property.
|
* @param obj the object which contains the property.
|
||||||
* @return the get method reflection object.
|
* @return the get method reflection object.
|
||||||
*/
|
*/
|
||||||
private static Class[] EMPTY_ARRAY = new Class[0];
|
|
||||||
|
|
||||||
protected Method createGetMethod(String propName, Object obj)
|
protected Method createGetMethod(String propName, Object obj)
|
||||||
{
|
{
|
||||||
Method m = null;
|
Method m = null;
|
||||||
try
|
try
|
||||||
{ //try to get a "get" method.
|
{ //try to get a "get" method.
|
||||||
|
m = obj.getClass().getMethod("get" + propName, (Class[]) null);
|
||||||
m = obj.getClass().getMethod("get" + propName, EMPTY_ARRAY);
|
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException ex1)
|
catch (NoSuchMethodException ex1)
|
||||||
{
|
{
|
||||||
@@ -313,7 +310,7 @@ public abstract class DataAware {
|
|||||||
*/
|
*/
|
||||||
public Object get(Object target) {
|
public Object get(Object target) {
|
||||||
try {
|
try {
|
||||||
return getMethod.invoke(target, EMPTY_ARRAY);
|
return getMethod.invoke(target, (Object[]) null);
|
||||||
} catch (IllegalAccessException ex1) {
|
} catch (IllegalAccessException ex1) {
|
||||||
ex1.printStackTrace();
|
ex1.printStackTrace();
|
||||||
} catch (InvocationTargetException ex2) {
|
} catch (InvocationTargetException ex2) {
|
||||||
|
@@ -42,10 +42,6 @@ import java.lang.reflect.Method;
|
|||||||
*/
|
*/
|
||||||
public class MethodInvocation
|
public class MethodInvocation
|
||||||
{
|
{
|
||||||
|
|
||||||
static final Class[] EMPTY_ARRAY =
|
|
||||||
{
|
|
||||||
};
|
|
||||||
//the method to invoke.
|
//the method to invoke.
|
||||||
Method mMethod;
|
Method mMethod;
|
||||||
//the object to invoke the method on.
|
//the object to invoke the method on.
|
||||||
@@ -66,7 +62,7 @@ public class MethodInvocation
|
|||||||
|
|
||||||
public MethodInvocation(String methodName, Object obj, Class paramClass) throws NoSuchMethodException
|
public MethodInvocation(String methodName, Object obj, Class paramClass) throws NoSuchMethodException
|
||||||
{
|
{
|
||||||
this(paramClass == null ? obj.getClass().getMethod(methodName, null) : obj.getClass().getMethod(methodName, new Class[]
|
this(paramClass == null ? obj.getClass().getMethod(methodName, (Class[]) null) : obj.getClass().getMethod(methodName, new Class[]
|
||||||
{
|
{
|
||||||
paramClass
|
paramClass
|
||||||
}), obj, paramClass);
|
}), obj, paramClass);
|
||||||
@@ -86,12 +82,11 @@ public class MethodInvocation
|
|||||||
{
|
{
|
||||||
if (mWithParam)
|
if (mWithParam)
|
||||||
{
|
{
|
||||||
return mMethod.invoke(mObject, (Object) param
|
return mMethod.invoke(mObject, (Object) param);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return mMethod.invoke(mObject, EMPTY_ARRAY);
|
return mMethod.invoke(mObject, (Object[]) null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user