public < T > T access ( Class < T > clazz ) { if ( configuration . getClass ( ) . equals ( clazz ) ) { return clazz . cast ( configuration ) ; } try { return clazz . cast ( fieldCache . get ( clazz ) . get ( configuration ) ) ; } catch ( Exception e ) { log . error ( "Could not access field for " + clazz , e ) ; throw new RuntimeException ( e ) ; } }
Access a custom configuration of the given type . The fields of the configuration object are searched for one that is of the given type .