java.lang.Object
java.lang.Record
org.elasticsearch.cluster.routing.allocation.decider.Decision.Single
All Implemented Interfaces:
Decision, Writeable, ToXContent, ToXContentObject
Enclosing interface:
Decision

public static record Decision.Single(Decision.Type type, String label, String explanationString) extends Record implements Decision, ToXContentObject
Simple class representing a single decision
  • Constructor Details

    • Single

      public Single(Decision.Type type, @Nullable String label, @Nullable String explanation, @Nullable Object... explanationParams)
      Creates a new Decision.Single decision of a given type
      Parameters:
      type - Decision.Type of the decision
      explanation - An explanation of this Decision
      explanationParams - A set of additional parameters
    • Single

      public Single(Decision.Type type, String label, String explanationString)
      Creates an instance of a Single record class.
      Parameters:
      type - the value for the type record component
      label - the value for the label record component
      explanationString - the value for the explanationString record component
  • Method Details

    • getDecisions

      public List<Decision> getDecisions()
      Description copied from interface: Decision
      Return the list of all decisions that make up this decision
      Specified by:
      getDecisions in interface Decision
    • getExplanation

      @Nullable public String getExplanation()
      Returns the explanation string, fully formatted. Only formats the string once.
      Specified by:
      getExplanation in interface Decision
    • 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
    • toXContent

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface ToXContent
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • 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.
    • type

      public Decision.Type type()
      Returns the value of the type record component.
      Specified by:
      type in interface Decision
      Returns:
      the value of the type record component
    • label

      public String label()
      Returns the value of the label record component.
      Specified by:
      label in interface Decision
      Returns:
      the value of the label record component
    • explanationString

      public String explanationString()
      Returns the value of the explanationString record component.
      Returns:
      the value of the explanationString record component