Package com.tnsai.quality.cost
Record Class CostScope
java.lang.Object
java.lang.Record
com.tnsai.quality.cost.CostScope
public record CostScope(String tenantId, Optional<String> agentId, Optional<String> capabilityId)
extends Record
Per-spend scope key — a (tenantId, agentId, capabilityId) triple
used by
CostBudgetStore to bucket recorded spend (issue #82).
The store tracks spend at the finest scope it sees and rolls up
for budgets defined at coarser scopes. Caller hands a fully-populated
scope on CostBudgetStore.record(com.tnsai.quality.cost.CostScope, java.math.BigDecimal); lookup queries match by
exact scope OR by any prefix subset that satisfies the budget's
scope filter.
- Since:
- 0.5.0 (issue #82)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CostScopeConvenience: tenant + agent scope.agentId()Returns the value of theagentIdrecord component.Returns the value of thecapabilityIdrecord component.booleantruewhenotherfalls within this scope — i.e.final booleanIndicates whether some other object is "equal to" this one.static CostScopeConvenience: full tenant + agent + capability scope.final inthashCode()Returns a hash code value for this object.static CostScopeConvenience: tenant-only scope (no agent / capability narrowing).tenantId()Returns the value of thetenantIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CostScope
Creates an instance of aCostScoperecord class.- Parameters:
tenantId- the value for thetenantIdrecord componentagentId- the value for theagentIdrecord componentcapabilityId- the value for thecapabilityIdrecord component
-
-
Method Details
-
tenant
Convenience: tenant-only scope (no agent / capability narrowing). -
agent
Convenience: tenant + agent scope. -
full
Convenience: full tenant + agent + capability scope. -
contains
truewhenotherfalls within this scope — i.e. this scope's populated fields all matchother's. Used byCostBudgetStoreto roll up finer-scoped spend records into coarser-scoped budgets. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
tenantId
Returns the value of thetenantIdrecord component.- Returns:
- the value of the
tenantIdrecord component
-
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
capabilityId
Returns the value of thecapabilityIdrecord component.- Returns:
- the value of the
capabilityIdrecord component
-