public < T > void updateRefs ( T oldObject , T newObject ) { checkNotNull ( oldObject ) ; checkNotNull ( newObject ) ; checkArgument ( ! ( newObject instanceof Listener ) ) ; Object previousMapping = mappings . put ( oldObject , newObject ) ; if ( previousMapping != null ) { if ( previousMapping instanceof Listener ) { @ SuppressWarnings ( "unchecked" ) // Listener<T> can only be registered with a T Listener < T > listener = ( Listener < T > ) previousMapping ; listener . newVersion ( newObject ) ; } else { throw new IllegalStateException ( "found multiple remappings for " + oldObject ) ; } } }
Registers that the old object has been remapped to the new object .