dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16846
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6522: minor changes
------------------------------------------------------------
revno: 6522
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-04-07 14:44:57 +0200
message:
minor changes
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java 2012-04-07 12:36:39 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java 2012-04-07 12:44:57 +0000
@@ -160,7 +160,7 @@
public static boolean isCollection( String fieldName, Object object, Class<?> type )
{
- Field field = null;
+ Field field;
try
{
@@ -172,14 +172,17 @@
try
{
- ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
- Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
-
- if ( actualTypeArguments.length > 0 )
+ if ( Collection.class.isAssignableFrom( field.getType() ) )
{
- if ( type.isAssignableFrom( (Class<?>) actualTypeArguments[0] ) )
+ ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
+ Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
+
+ if ( actualTypeArguments.length > 0 )
{
- return true;
+ if ( type.isAssignableFrom( (Class<?>) actualTypeArguments[0] ) )
+ {
+ return true;
+ }
}
}
@@ -214,9 +217,6 @@
try
{
return (T) method.invoke( object );
- } catch ( ClassCastException e )
- {
- return null;
} catch ( InvocationTargetException e )
{
return null;
@@ -226,11 +226,11 @@
}
}
- public static boolean isType(Field field, Class<?> clazz)
+ public static boolean isType( Field field, Class<?> clazz )
{
Class<?> type = field.getType();
- if(clazz.isAssignableFrom( type ))
+ if ( clazz.isAssignableFrom( type ) )
{
return true;
}