Record Class EventValueRegistry.Resolution<E extends org.bukkit.event.Event,V>
java.lang.Object
java.lang.Record
org.skriptlang.skript.bukkit.lang.eventvalue.EventValueRegistry.Resolution<E,V>
- Type Parameters:
E- the event typeV- the value type- Record Components:
all- all candidates found during resolutionerrored- whether the resolution failed due to an abort validation
- Enclosing interface:
EventValueRegistry
public static record EventValueRegistry.Resolution<E extends org.bukkit.event.Event,V> (List<EventValue<E extends org.bukkit.event.Event,V>> all, boolean errored)
extends Record
Result of a registry resolve operation. May contain multiple candidates or be empty.
When
errored() is true, at least one candidate failed validation
with EventValue.Validation.ABORT and no result should be used.-
Constructor Summary
ConstructorsConstructorDescriptionResolution(List<EventValue<E, V>> all, boolean errored) Creates an instance of aResolutionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionList<EventValue<E, V>> all()Returns the value of theallrecord component.EventValue<E, V> any()Optional<EventValue<E, V>> EventValue<E, V> static <E extends org.bukkit.event.Event,V>
EventValueRegistry.Resolution<E, V> empty()Creates an empty, non-error resolution.final booleanIndicates whether some other object is "equal to" this one.static <E extends org.bukkit.event.Event,V>
EventValueRegistry.Resolution<E, V> error()Creates an error resolution (e.g., a candidate failed validation).booleanerrored()Returns the value of theerroredrecord component.final inthashCode()Returns a hash code value for this object.booleanmultiple()static <E extends org.bukkit.event.Event,V>
EventValueRegistry.Resolution<E, V> of(List<EventValue<E, V>> eventValues) Creates a successful resolution from candidates.intsize()booleanfinal StringtoString()Returns a string representation of this record class.EventValue<E, V> unique()Optional<EventValue<E, V>> EventValue<E, V>
-
Constructor Details
-
Method Details
-
of
public static <E extends org.bukkit.event.Event,V> EventValueRegistry.Resolution<E,V> of(List<EventValue<E, V>> eventValues) Creates a successful resolution from candidates.- Type Parameters:
E- the event typeV- the value type- Parameters:
eventValues- the candidates- Returns:
- a new resolution
-
empty
Creates an empty, non-error resolution.- Type Parameters:
E- the event typeV- the value type- Returns:
- an empty resolution
-
error
Creates an error resolution (e.g., a candidate failed validation).- Type Parameters:
E- the event typeV- the value type- Returns:
- an error resolution
-
successful
public boolean successful()- Returns:
trueif at least one candidate exists
-
multiple
public boolean multiple()- Returns:
trueif multiple candidates are available
-
unique
- Returns:
- the single candidate
- Throws:
IllegalStateException- if the resolution is not unique
-
uniqueOrNull
- Returns:
- the single candidate or
nullif not unique
-
uniqueOptional
- Returns:
- the single candidate as an
Optional, empty if not unique
-
any
- Returns:
- any candidate
- Throws:
IllegalStateException- if the resolution is empty
-
anyOrNull
- Returns:
- any candidate or
nullif none
-
anyOptional
- Returns:
- any candidate as an
Optional, empty if none
-
size
public int size()- Returns:
- number of candidates contained
-
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 '=='. -
all
Returns the value of theallrecord component.- Returns:
- the value of the
allrecord component
-
errored
public boolean errored()Returns the value of theerroredrecord component.- Returns:
- the value of the
erroredrecord component
-