Record Class ConditionalCodecTest.Record.SimpleRecord
java.lang.Object
java.lang.Record
net.neoforged.neoforge.oldtest.conditions.ConditionalCodecTest.Record.SimpleRecord
- Enclosing class:
ConditionalCodecTest.Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic com.mojang.serialization.Codec
<ConditionalCodecTest.Record.SimpleRecord> static com.mojang.serialization.Codec
<Optional<ConditionalCodecTest.Record.SimpleRecord>> static com.mojang.serialization.Codec
<Optional<WithConditions<ConditionalCodecTest.Record.SimpleRecord>>> private final int
The field for thei
record component.private final String
The field for thes
record component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
SimpleRecord
(int i, String s) Creates an instance of aSimpleRecord
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
i()
Returns the value of thei
record component.s()
Returns the value of thes
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
i
private final int iThe field for thei
record component. -
s
The field for thes
record component. -
CODEC
-
CONDITIONAL_CODEC
public static com.mojang.serialization.Codec<Optional<ConditionalCodecTest.Record.SimpleRecord>> CONDITIONAL_CODEC -
CONDITIONS_CODEC
public static com.mojang.serialization.Codec<Optional<WithConditions<ConditionalCodecTest.Record.SimpleRecord>>> CONDITIONS_CODEC
-
-
Constructor Details
-
SimpleRecord
Creates an instance of aSimpleRecord
record class.- Parameters:
i
- the value for thei
record components
- the value for thes
record component
-
-
Method Details
-
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 '=='. -
i
public int i()Returns the value of thei
record component.- Returns:
- the value of the
i
record component
-
s
Returns the value of thes
record component.- Returns:
- the value of the
s
record component
-