Class MapBackedScopelet<M extends MapBackedScopelet<M>>
java.lang.Object
org.microbean.scopelet.Scopelet<M>
org.microbean.scopelet.MapBackedScopelet<M>
- Type Parameters:
M- theMapBackedScopeletsubclass extending this class
- All Implemented Interfaces:
AutoCloseable,Constable,Aggregate,Factory<M>
- Direct Known Subclasses:
SingletonScopelet
A thread-safe, partial
Scopelet implementation backed by ConcurrentMap machinery.- Author:
- Laird Nelson
- See Also:
-
Field Summary
Fields inherited from class org.microbean.scopelet.Scopelet
APPLICATION_ID, NONE_ID, SCOPE, SINGLETON_IDFields inherited from interface org.microbean.bean.Aggregate
EMPTY_ASSIGNMENTS, EMPTY_DEPENDENCIES -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.microbean.scopelet.Scopelet
active, closed, create, destroys, singletonMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.microbean.bean.Aggregate
assign, dependenciesMethods inherited from interface org.microbean.bean.Factory
describeConstable, destroy
-
Constructor Details
-
MapBackedScopelet
-
-
Method Details
-
close
Description copied from class:ScopeletIrrevocably closes thisScopelet, and, by doing so, notionally makes it irrevocably closed and inactive.Overrides of this method must call
super.close()as part of their implementation or undefined behavior may result.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classScopelet<M extends MapBackedScopelet<M>>- See Also:
-
instance
Description copied from class:ScopeletChecks to see if thisScopeletis active and then returns a pre-existing or created-on-demand contextual instance suitable for the combination of identifier,FactoryandCreation, ornull- Specified by:
instancein classScopelet<M extends MapBackedScopelet<M>>- Type Parameters:
I- the type of contextual instance- Parameters:
beanId- an identifier that can identify a contextual instance; may benullfactory- aFactory; may benullcreation- aCreation, typically the one in effect that is causing this method to be invoked in the first place; may benull- Returns:
- a contextual instance, possibly pre-existing, or possibly created just in time, or
null - See Also:
-
remove
Description copied from class:ScopeletChecks to see if thisScopeletis active and then removes any contextual instance stored under the suppliedid, returningtrueif and only if removal actually took place.The default implementation of this method always returns
false. Subclasses are encouraged to override it as appropriate.- Overrides:
removein classScopelet<M extends MapBackedScopelet<M>>- Parameters:
id- an identifier; may benull- Returns:
trueif and only if removal actually occurred
-