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>
,ScopeMember
- Direct Known Subclasses:
SingletonScopelet
A thread-safe, partial
Scopelet
implementation backed by ConcurrentMap
machinery.- Author:
- Laird Nelson
-
Field Summary
Fields inherited from interface org.microbean.bean.Aggregate
EMPTY_ASSIGNMENTS, EMPTY_DEPENDENCIES
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MapBackedScopelet
(NamedAttributeMap<?> scopeId) Creates a newMapBackedScopelet
. -
Method Summary
Methods inherited from class org.microbean.scopelet.Scopelet
active, bean, closed, containsId, create, destroys, equals, get, governedBy, governingScopeId, hashCode, id, instance, scopeId, singleton
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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
Creates a newMapBackedScopelet
.- Parameters:
scopeId
- aNamedAttributeMap
identifying the scope thisMapBackedScopelet
serves; must not benull
- Throws:
NullPointerException
- ifscopeId
isnull
- See Also:
-
-
Method Details
-
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
andRequest
.- 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
request
- aRequest
, 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
-
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
-
close
-