Interface CollectionContext
- All Known Implementing Classes:
EmptyCollectionContext
,StandardCollectionContext
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.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final class
static final class
Key constants for standard context properties -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a new builder for constructing StandardCollectionContext instances.Returns a unique identifier for this collection operation.Returns the time interval for periodic collections.Returns the source or initiator of this collection operation.Returns the timestamp indicating when the collection occurred.static CollectionContext
empty()
Returns an empty collection context that doesn't apply any specific collection parameters.<T> Optional<T>
boolean
hasProperty
(Property<?> property) boolean
isEmpty()
Checks if this context is empty (has no properties or only default ones).default boolean
Indicates whether this is a heartbeat collection operation, representing system health.default Optional<ValueOrigin>
Returns the origin of the collected values, specifying whether they are direct from the source or observed/derived by the collector.
-
Method Details
-
hasProperty
-
getValue
-
getProperties
PropertySet getProperties() -
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
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
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
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
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
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
-