@ SuppressWarnings ( "unchecked" ) protected < T > JAXBElement < ? extends IntuitEntity > getIntuitObject ( T entity ) { Class < ? > objectClass = entity . getClass ( ) ; String methodName = "create" . concat ( objectClass . getSimpleName ( ) ) ; ObjectFactory objectEntity = new ObjectFactory ( ) ; Class < ? > objectEntityClass = objectEntity . getClass ( ) ; Method method = null ; try { method = objectEntityClass . getMethod ( methodName , Class . forName ( objectClass . getName ( ) ) ) ; } catch ( Exception e ) { LOG . error ( "Exception while prepare the method signature using reflection to generate JAXBElement" , e ) ; } JAXBElement < ? extends IntuitEntity > jaxbElement = null ; try { jaxbElement = ( JAXBElement < ? extends IntuitEntity > ) method . invoke ( objectEntity , entity ) ; } catch ( Exception e ) { LOG . error ( "Exception while invoking the method using reflection to generate JAXBElement" , e ) ; } return jaxbElement ; }
Method to get the corresponding IEntity type for the given JAXBElement