private String generateTypeKey ( final Object object , final KeyGenerator typeGenerator ) { String objectKey = null ; Method method = null ; try { method = object . getClass ( ) . getMethod ( typeGenerator . value ( ) ) ; objectKey = ( String ) method . invoke ( object ) ; } catch ( final NoSuchMethodException e ) { LOGGER . log ( METHOD_NOT_FOUND , typeGenerator . value ( ) , object . getClass ( ) . getSimpleName ( ) , e ) ; } catch ( final SecurityException e ) { LOGGER . log ( NO_KEY_GENERATOR_METHOD , typeGenerator . value ( ) , object . getClass ( ) . getSimpleName ( ) , e ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { LOGGER . log ( KEY_GENERATOR_FAILURE , typeGenerator . value ( ) , object . getClass ( ) . getSimpleName ( ) , e ) ; } return objectKey ; }
Generate Type key by using the class - level annotation .