public boolean isCollection ( Object obj , Field field ) { try { Object val = field . get ( obj ) ; boolean isCollResource = false ; if ( val != null ) { isCollResource = CollectionResource . class . equals ( val . getClass ( ) ) ; } return ( ! isCollResource && ! field . getType ( ) . equals ( CollectionResource . class ) ) && ( Collection . class . equals ( field . getType ( ) ) || ArrayUtils . contains ( field . getType ( ) . getInterfaces ( ) , Collection . class ) ) ; } catch ( Exception e ) { throw new Siren4JRuntimeException ( e ) ; } }
Determine if the field is a Collection class and not a CollectionResource class which needs special treatment .