All Known Implementing Classes:
EmptyCollectionContext, StandardCollectionContext

public sealed interface CollectionContext permits StandardCollectionContext, EmptyCollectionContext
Represents the context for a data collection operation for use with a DataCollector. This interface defines a property-based context model where contexts can have different sets of properties. Standard contexts have a complete set of properties, while empty contexts have minimal or no properties.
  • Method Details

    • hasProperty

      boolean hasProperty(Property<?> property)
    • getValue

      <T> Optional<T> getValue(Property<T> property)
    • getProperties

      PropertySet getProperties()
    • collectionId

      default Optional<String> collectionId()
      Returns a unique identifier for this collection operation. (e.g., tag group name)
      Returns:
      An Optional containing the collection identifier, or empty if not available
    • collectionSource

      default Optional<String> collectionSource()
      Returns the source or initiator of this collection operation. (e.g., tag provider name)
      Returns:
      An Optional containing the collection source, or empty if not available
    • collectionInterval

      default Optional<Duration> collectionInterval()
      Returns the time interval for periodic collections. If present, it indicates a recurring collection; if absent, it signifies a one-time or event-driven collection, such as on-value change or manual trigger.
      Returns:
      An Optional containing the collection interval, or empty if not available
    • collectionTime

      default Optional<Instant> collectionTime()
      Returns the timestamp indicating when the collection occurred.
      Returns:
      The collection time, or the current time if not available
    • isHeartbeat

      default boolean isHeartbeat()
      Indicates whether this is a heartbeat collection operation, representing system health.
      Returns:
      true if this is a heartbeat collection, false otherwise
    • valueOrigin

      default Optional<ValueOrigin> valueOrigin()
      Returns the origin of the collected values, specifying whether they are direct from the source or observed/derived by the collector.
      Returns:
      An Optional containing the value origin, or empty if not available
    • isEmpty

      boolean isEmpty()
      Checks if this context is empty (has no properties or only default ones).
      Returns:
      true if this is an empty context, false otherwise
    • empty

      static CollectionContext empty()
      Returns an empty collection context that doesn't apply any specific collection parameters.
      Returns:
      An empty CollectionContext instance
    • builder

      Creates a new builder for constructing StandardCollectionContext instances.
      Returns:
      A new builder instance