java.lang.Object
dev.metaschema.core.model.constraint.TimingCollector
- All Implemented Interfaces:
ValidationEventListener
A
ValidationEventListener implementation that collects timing
measurements for all validation events.
Timing data is organized hierarchically:
- Overall validation timing
- Per-phase timing (keyed by
ValidationPhase) - Per-constraint timing (keyed by
IConstraint.getInternalIdentifier()) - Per-let-statement timing (keyed by
ILet.getInternalIdentifier())
This class is thread-safe. Each thread maintains its own stack of start times to handle nested events correctly (e.g., a constraint evaluation that triggers let-statement evaluations).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterConstraintEvaluation(IConstraint constraint, INodeItem target) Called after a single constraint evaluation completes.voidafterLetEvaluation(ILet let) Called after a let-statement variable binding evaluation completes.voidafterPhase(ValidationPhase phase) Called after a validation phase completes.voidafterValidation(URI document) Called after validation of a document completes.voidbeforeConstraintEvaluation(IConstraint constraint, INodeItem target) Called before a single constraint is evaluated against a target node.voidbeforeLetEvaluation(ILet let) Called before a let-statement variable binding is evaluated.voidbeforePhase(ValidationPhase phase) Called before a validation phase begins.voidbeforeValidation(URI document) Called before validation of a document begins.getConstraintTiming(String constraintId) Get the timing record for a specific constraint by its internal identifier.Get all constraint timing records.getLetTiming(ILet let) Get the timing record for a specific let-statement.Get all let-statement timing records.getPhaseTiming(ValidationPhase phase) Get the timing record for a specific validation phase.Get all phase timing records.Get the overall validation timing record.
-
Constructor Details
-
TimingCollector
public TimingCollector()Construct a new, empty timing collector.
-
-
Method Details
-
beforeValidation
Description copied from interface:ValidationEventListenerCalled before validation of a document begins.- Specified by:
beforeValidationin interfaceValidationEventListener- Parameters:
document- the URI of the document being validated
-
afterValidation
Description copied from interface:ValidationEventListenerCalled after validation of a document completes.- Specified by:
afterValidationin interfaceValidationEventListener- Parameters:
document- the URI of the document that was validated
-
beforePhase
Description copied from interface:ValidationEventListenerCalled before a validation phase begins.- Specified by:
beforePhasein interfaceValidationEventListener- Parameters:
phase- the phase about to start
-
afterPhase
Description copied from interface:ValidationEventListenerCalled after a validation phase completes.- Specified by:
afterPhasein interfaceValidationEventListener- Parameters:
phase- the phase that completed
-
beforeConstraintEvaluation
Description copied from interface:ValidationEventListenerCalled before a single constraint is evaluated against a target node.- Specified by:
beforeConstraintEvaluationin interfaceValidationEventListener- Parameters:
constraint- the constraint being evaluatedtarget- the node item the constraint is evaluated against
-
afterConstraintEvaluation
Description copied from interface:ValidationEventListenerCalled after a single constraint evaluation completes.- Specified by:
afterConstraintEvaluationin interfaceValidationEventListener- Parameters:
constraint- the constraint that was evaluatedtarget- the node item the constraint was evaluated against
-
beforeLetEvaluation
Description copied from interface:ValidationEventListenerCalled before a let-statement variable binding is evaluated.- Specified by:
beforeLetEvaluationin interfaceValidationEventListener- Parameters:
let- the let expression being evaluated
-
afterLetEvaluation
Description copied from interface:ValidationEventListenerCalled after a let-statement variable binding evaluation completes.- Specified by:
afterLetEvaluationin interfaceValidationEventListener- Parameters:
let- the let expression that was evaluated
-
getPhaseTiming
Get the timing record for a specific validation phase.- Parameters:
phase- the phase to look up- Returns:
- the timing record, or
nullif the phase was not recorded
-
getPhaseTimings
Get all phase timing records.- Returns:
- an unmodifiable map of phase to timing record
-
getConstraintTiming
Get the timing record for a specific constraint by its internal identifier.- Parameters:
constraintId- the constraint's internal identifier- Returns:
- the timing record, or
nullif the constraint was not recorded
-
getConstraintTimings
Get all constraint timing records.- Returns:
- an unmodifiable map of constraint identifier to timing record
-
getLetTiming
Get the timing record for a specific let-statement.- Parameters:
let- the let-statement to look up- Returns:
- the timing record, or
nullif the let was not recorded
-
getLetTimings
Get all let-statement timing records.- Returns:
- an unmodifiable map of let-statement to timing record
-
getValidationTiming
Get the overall validation timing record.- Returns:
- the validation timing record, or
nullif validation was not recorded
-