Package google.registry.whois
Record Class WhoisMetrics.WhoisMetric
java.lang.Object
java.lang.Record
google.registry.whois.WhoisMetrics.WhoisMetric
- Enclosing class:
WhoisMetrics
public static record WhoisMetrics.WhoisMetric(Optional<String> commandName, int numResults, int status, org.joda.time.DateTime startTimestamp, org.joda.time.DateTime endTimestamp)
extends Record
A value class for recording attributes of a WHOIS metric.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A builder to create instances ofWhoisMetrics.WhoisMetric
. -
Constructor Summary
ConstructorDescriptionWhoisMetric
(Optional<String> commandName, int numResults, int status, org.joda.time.DateTime startTimestamp, org.joda.time.DateTime endTimestamp) Creates an instance of aWhoisMetric
record class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Create aWhoisMetrics.WhoisMetric.Builder
.builderForRequest
(Clock clock) Create aWhoisMetrics.WhoisMetric.Builder
for a request context, with the start and end timestamps taken from the given clock.Returns the value of thecommandName
record component.org.joda.time.DateTime
Returns the value of theendTimestamp
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of thenumResults
record component.org.joda.time.DateTime
Returns the value of thestartTimestamp
record component.int
status()
Returns the value of thestatus
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
WhoisMetric
public WhoisMetric(Optional<String> commandName, int numResults, int status, org.joda.time.DateTime startTimestamp, org.joda.time.DateTime endTimestamp) Creates an instance of aWhoisMetric
record class.- Parameters:
commandName
- the value for thecommandName
record componentnumResults
- the value for thenumResults
record componentstatus
- the value for thestatus
record componentstartTimestamp
- the value for thestartTimestamp
record componentendTimestamp
- the value for theendTimestamp
record component
-
-
Method Details
-
builderForRequest
Create aWhoisMetrics.WhoisMetric.Builder
for a request context, with the start and end timestamps taken from the given clock.The start timestamp is recorded now, and the end timestamp at
build()
. -
builder
Create aWhoisMetrics.WhoisMetric.Builder
. -
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 '=='. -
commandName
Returns the value of thecommandName
record component.- Returns:
- the value of the
commandName
record component
-
numResults
public int numResults()Returns the value of thenumResults
record component.- Returns:
- the value of the
numResults
record component
-
status
public int status()Returns the value of thestatus
record component.- Returns:
- the value of the
status
record component
-
startTimestamp
public org.joda.time.DateTime startTimestamp()Returns the value of thestartTimestamp
record component.- Returns:
- the value of the
startTimestamp
record component
-
endTimestamp
public org.joda.time.DateTime endTimestamp()Returns the value of theendTimestamp
record component.- Returns:
- the value of the
endTimestamp
record component
-