Module org.elasticsearch.server
Record Class Decision.Single
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.cluster.routing.allocation.decider.Decision
Decision.Multi, Decision.Single, Decision.TypeNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.elasticsearch.cluster.routing.allocation.decider.Decision
ALWAYS, NO, THROTTLE, YESFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionSingle(Decision.Type type, String label, String explanationString) Creates an instance of aSinglerecord class.Single(Decision.Type type, String label, String explanation, Object... explanationParams) Creates a newDecision.Singledecision of a given type -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theexplanationStringrecord component.Return the list of all decisions that make up this decisionReturns the explanation string, fully formatted.final inthashCode()Returns a hash code value for this object.label()Returns the value of thelabelrecord component.toString()Returns a string representation of this record class.toXContent(XContentBuilder builder, ToXContent.Params params) type()Returns the value of thetyperecord component.voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Constructor Details
-
Single
public Single(Decision.Type type, @Nullable String label, @Nullable String explanation, @Nullable Object... explanationParams) Creates a newDecision.Singledecision of a given type- Parameters:
type-Decision.Typeof the decisionexplanation- An explanation of thisDecisionexplanationParams- A set of additional parameters
-
Single
Creates an instance of aSinglerecord class.- Parameters:
type- the value for thetyperecord componentlabel- the value for thelabelrecord componentexplanationString- the value for theexplanationStringrecord component
-
-
Method Details
-
getDecisions
Description copied from interface:DecisionReturn the list of all decisions that make up this decision- Specified by:
getDecisionsin interfaceDecision
-
getExplanation
Returns the explanation string, fully formatted. Only formats the string once.- Specified by:
getExplanationin interfaceDecision
-
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. -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- 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. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
type
Returns the value of thetyperecord component. -
label
Returns the value of thelabelrecord component. -
explanationString
Returns the value of theexplanationStringrecord component.- Returns:
- the value of the
explanationStringrecord component
-