Record Class NamedRange

java.lang.Object
java.lang.Record
io.kroxylicious.proxy.config.NamedRange

public record NamedRange(String name, int start, int end) extends Record
Represents the inclusive set of integers between two integer endpoints. So the range with start 1 and end 3 contains the integers 1, 2, and 3. A Range must be non-empty, end must be greater than start
  • Constructor Details

    • NamedRange

      public NamedRange(String name, int start, int end)
      Constructs a Range
      Parameters:
      name - range name
      start - the inclusive lower value
      end - the inclusive upper bound
      Throws:
      IllegalArgumentException - if end is before start
  • Method Details

    • values

      public IntStream values()
      Provides a Stream of values contained in the range
      Returns:
      stream of values
    • isDistinctFrom

      public boolean isDistinctFrom(NamedRange range)
      Return true if this range does not overlap with other range. If either range ends before the other starts then they must not overlap.
      Parameters:
      range - range to compare
      Returns:
      true if this range does not overlap with other range
    • toString

      public 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
    • toIntervalNotationString

      public String toIntervalNotationString()
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • name

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

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

      public int end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component