Class MapBackedScopelet<M extends MapBackedScopelet<M>>
java.lang.Object
org.microbean.scopelet.Scopelet<M>
org.microbean.scopelet.MapBackedScopelet<M>
- Type Parameters:
M
- theMapBackedScopelet
subclass 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_ID
Fields 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, singleton
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.microbean.bean.Aggregate
assign, dependencies
Methods inherited from interface org.microbean.bean.Factory
describeConstable, destroy
-
Constructor Details
-
MapBackedScopelet
-
-
Method Details
-
close
Description copied from class:Scopelet
Irrevocably 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:
close
in interfaceAutoCloseable
- Overrides:
close
in classScopelet<M extends MapBackedScopelet<M>>
- See Also:
-
instance
Description copied from class:Scopelet
Checks to see if thisScopelet
is active and then returns a pre-existing or created-on-demand contextual instance suitable for the combination of identifier,Factory
andCreation
, ornull
- Specified by:
instance
in classScopelet<M extends MapBackedScopelet<M>>
- Type Parameters:
I
- the type of contextual instance- Parameters:
beanId
- an identifier that can identify a contextual instance; may benull
factory
- aFactory
; may benull
creation
- 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:Scopelet
Checks to see if thisScopelet
is active and then removes any contextual instance stored under the suppliedid
, returningtrue
if 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:
remove
in classScopelet<M extends MapBackedScopelet<M>>
- Parameters:
id
- an identifier; may benull
- Returns:
true
if and only if removal actually occurred
-