public void putListener ( CallbackType callbackType , Method method ) { if ( callbacks == null ) { callbacks = new EnumMap <> ( CallbackType . class ) ; } Method oldMethod = callbacks . put ( callbackType , method ) ; if ( oldMethod != null ) { String format = "Class %s has at least two methods, %s and %s, with annotation of %s. " + "At most one method is allowed for a given callback type. " ; String message = String . format ( format , listenerClass . getName ( ) , oldMethod . getName ( ) , method . getName ( ) , callbackType . getAnnotationClass ( ) . getName ( ) ) ; throw new EntityManagerException ( message ) ; } }
Registers the given method as the callback method for the given event type .