void addInstance ( final Class < ? > discoveredType , final Object newlyConstructed ) { WeakHashMap < Object , Void > map ; synchronized ( instances ) { map = instances . get ( discoveredType ) ; if ( map == null ) { map = new WeakHashMap <> ( ) ; instances . put ( discoveredType , map ) ; } } synchronized ( map ) { map . put ( newlyConstructed , null ) ; } }
Register an instance of a property - consuming type ; the registry will use a weak reference to hold on to this instance so that it can be discarded if it has a short lifespan