Record Class GraphQLDuration

java.lang.Object
java.lang.Record
codes.grow.packages.skywalking.GraphQLDuration
Record Components:
start - formatted start
end - formatted end
step - step

public record GraphQLDuration(String start, String end, Step step) extends Record
The GraphQL Duration input: bounds in the OAP time zone, formatted per step (DAY yyyy-MM-dd, HOUR yyyy-MM-dd HH, MINUTE yyyy-MM-dd HHmm, SECOND yyyy-MM-dd HHmmss).
  • Constructor Details

    • GraphQLDuration

      public GraphQLDuration(String start, String end, Step step)
      Creates an instance of a GraphQLDuration record class.
      Parameters:
      start - the value for the start record component
      end - the value for the end record component
      step - the value for the step record component
  • Method Details

    • parseTimezone

      public static int parseTimezone(String tz)
      Parses an OAP time zone (+0000, -0530, +08:00) into minutes east of UTC; unknown text → 0.
      Parameters:
      tz - time zone text (may be null)
      Returns:
      minutes east of UTC
    • format

      public static String format(Instant instant, Step step, int offsetMinutes)
      Formats an instant for a Duration field.
      Parameters:
      instant - time
      step - step
      offsetMinutes - OAP offset in minutes east of UTC
      Returns:
      the formatted time
    • of

      public static GraphQLDuration of(GraphQLDuration.Resolved range, int offsetMinutes)
      Builds the GraphQL Duration for a resolved window.
      Parameters:
      range - the window
      offsetMinutes - OAP offset in minutes east of UTC
      Returns:
      the duration
    • toVariable

      public Map<String,Object> toVariable()
      The GraphQL variable value.
      Returns:
      {start, end, step}
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • start

      public String start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • end

      public String end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component
    • step

      public Step step()
      Returns the value of the step record component.
      Returns:
      the value of the step record component