Package com.fayupable.logged.test
Record Class RecordedMetric
java.lang.Object
java.lang.Record
com.fayupable.logged.test.RecordedMetric
- Record Components:
className- the simple or fully qualified name of the class declaring the invoked methodmethodName- the name of the invoked methoddurationNanos- the wall-clock duration of the invocation, in nanosecondssuccess-trueif the method returned normally,falseif it threw an exceptionexceptionType- the simple class name of the exception thrown by the method, ornullif the call succeeded
public record RecordedMetric(String className, String methodName, long durationNanos, boolean success, String exceptionType)
extends Record
A single call recorded by
InMemoryMetricsRecorder, mirroring the
parameters of MetricsRecorder.record(java.lang.String, java.lang.String, long, boolean, java.lang.String)
so a test can assert on exactly what was reported.-
Constructor Summary
ConstructorsConstructorDescriptionRecordedMetric(String className, String methodName, long durationNanos, boolean success, String exceptionType) Creates an instance of aRecordedMetricrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassNamerecord component.longReturns the value of thedurationNanosrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexceptionTyperecord component.final inthashCode()Returns a hash code value for this object.Returns the value of themethodNamerecord component.booleansuccess()Returns the value of thesuccessrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RecordedMetric
public RecordedMetric(String className, String methodName, long durationNanos, boolean success, String exceptionType) Creates an instance of aRecordedMetricrecord class.- Parameters:
className- the value for theclassNamerecord componentmethodName- the value for themethodNamerecord componentdurationNanos- the value for thedurationNanosrecord componentsuccess- the value for thesuccessrecord componentexceptionType- the value for theexceptionTyperecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
className
Returns the value of theclassNamerecord component.- Returns:
- the value of the
classNamerecord component
-
methodName
Returns the value of themethodNamerecord component.- Returns:
- the value of the
methodNamerecord component
-
durationNanos
public long durationNanos()Returns the value of thedurationNanosrecord component.- Returns:
- the value of the
durationNanosrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
exceptionType
Returns the value of theexceptionTyperecord component.- Returns:
- the value of the
exceptionTyperecord component
-