Class CapabilityResolutionContext
- java.lang.Object
-
- org.jboss.as.controller.capability.registry.CapabilityResolutionContext
-
public abstract class CapabilityResolutionContext extends Object
Contextual object that theModelControllerandCapabilityScopeimplementations can use to temporarily store data during the course of a capability resolution.- Author:
- Brian Stansberry
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCapabilityResolutionContext.AttachmentKey<T>An attachment key instance.
-
Constructor Summary
Constructors Constructor Description CapabilityResolutionContext()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <V> Vattach(CapabilityResolutionContext.AttachmentKey<V> key, V value)Attaches an arbitrary object to this context.<V> VattachIfAbsent(CapabilityResolutionContext.AttachmentKey<V> key, V value)Attaches an arbitrary object to this context only if the object was not already attached.protected voidcopy(CapabilityResolutionContext source)Update this context content with the source context.<V> Vdetach(CapabilityResolutionContext.AttachmentKey<V> key)Detaches or removes the value from this context.<V> VgetAttachment(CapabilityResolutionContext.AttachmentKey<V> key)Retrieves an object that has been attached to this context.abstract ResourcegetResourceRoot()Gets the root resource of the resource tree in effect during this resolution.protected voidreset()Resets this object, removing all attachments.
-
-
-
Method Detail
-
getResourceRoot
public abstract Resource getResourceRoot()
Gets the root resource of the resource tree in effect during this resolution.- Returns:
- the root resource. Will not return
null
-
getAttachment
public <V> V getAttachment(CapabilityResolutionContext.AttachmentKey<V> key)
Retrieves an object that has been attached to this context.- Type Parameters:
V- the value type of the attachment.- Parameters:
key- the key to the attachment.- Returns:
- the attachment if found otherwise
null.
-
attach
public <V> V attach(CapabilityResolutionContext.AttachmentKey<V> key, V value)
Attaches an arbitrary object to this context.- Type Parameters:
V- the value type of the attachment.- Parameters:
key- they attachment key used to ensure uniqueness and used for retrieval of the value.value- the value to store.- Returns:
- the previous value associated with the key or
nullif there was no previous value.
-
attachIfAbsent
public <V> V attachIfAbsent(CapabilityResolutionContext.AttachmentKey<V> key, V value)
Attaches an arbitrary object to this context only if the object was not already attached. If a value has already been attached with the key provided, the current value associated with the key is returned.- Type Parameters:
V- the value type of the attachment.- Parameters:
key- they attachment key used to ensure uniqueness and used for retrieval of the value.value- the value to store.- Returns:
- the previous value associated with the key or
nullif there was no previous value.
-
detach
public <V> V detach(CapabilityResolutionContext.AttachmentKey<V> key)
Detaches or removes the value from this context.- Type Parameters:
V- the value type of the attachment.- Parameters:
key- the key to the attachment.- Returns:
- the attachment if found otherwise
null.
-
reset
protected void reset()
Resets this object, removing all attachments.
-
copy
protected void copy(CapabilityResolutionContext source)
Update this context content with the source context.- Parameters:
source- The context to copy.
-
-