private static < T extends MPBase > T fillResource ( T sourceResource , T destinationResource ) throws MPException { Field [ ] declaredFields = destinationResource . getClass ( ) . getDeclaredFields ( ) ; for ( Field field : declaredFields ) { try { Field originField = sourceResource . getClass ( ) . getDeclaredField ( field . getName ( ) ) ; field . setAccessible ( true ) ; originField . setAccessible ( true ) ; field . set ( destinationResource , originField . get ( sourceResource ) ) ; } catch ( Exception ex ) { throw new MPException ( ex ) ; } } return destinationResource ; }
Copies the atributes from an obj to a destination obj