private < T extends IEntity > Object verifyEntityId ( T entity ) throws FMSException { Class < ? > objectClass = entity . getClass ( ) ; Object rid = null ; Method m ; try { m = objectClass . getMethod ( "getId" ) ; rid = m . invoke ( entity ) ; } catch ( Exception e ) { throw new FMSException ( "Unable to read the method getId" , e ) ; } if ( rid == null ) { throw new FMSException ( "Id is required." ) ; } return rid ; }
Verifies that entity has getID method which can be invoked to retrieve entity id