Class CapabilityResolutionContext

java.lang.Object
org.jboss.as.controller.capability.registry.CapabilityResolutionContext

public abstract class CapabilityResolutionContext extends Object
Contextual object that the ModelController and CapabilityScope implementations can use to temporarily store data during the course of a capability resolution.
Author:
Brian Stansberry
  • Constructor Details

    • CapabilityResolutionContext

      public CapabilityResolutionContext()
  • Method Details

    • 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 null if 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 null if 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.