@ SuppressWarnings ( "unchecked" ) static < E , M extends BinderMapper < E > > M getMapper ( Class < E > cls ) { M mapper = ( M ) OBJECT_MAPPERS . get ( cls ) ; if ( mapper == null ) { // The only way the mapper wouldn't already be loaded into // OBJECT_MAPPERS is if it was compiled separately, but let's handle // it anyway String beanClassName = cls . getName ( ) ; String mapperClassName = cls . getName ( ) + KriptonBinder . MAPPER_CLASS_SUFFIX ; try { Class < E > mapperClass = ( Class < E > ) Class . forName ( mapperClassName ) ; mapper = ( M ) mapperClass . newInstance ( ) ; // mapper. OBJECT_MAPPERS . put ( cls , mapper ) ; } catch ( ClassNotFoundException e ) { e . printStackTrace ( ) ; throw new KriptonRuntimeException ( String . format ( "Class '%s' does not exist. Does '%s' have @BindType annotation?" , mapperClassName , beanClassName ) ) ; } catch ( InstantiationException e ) { e . printStackTrace ( ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } } return mapper ; }
Gets the mapper .