Record Class Check
java.lang.Object
java.lang.Record
com.mojang.datafixers.types.templates.Check
- All Implemented Interfaces:
TypeTemplate
public record Check(String name, int index, TypeTemplate element)
extends Record
implements TypeTemplate
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionCheck
(String name, int index, TypeTemplate element) Creates an instance of aCheck
record class. -
Method Summary
Modifier and TypeMethodDescriptionapply
(TypeFamily family) <A,
B> FamilyOptic<A, B> applyO
(FamilyOptic<A, B> input, Type<A> aType, Type<B> bType) element()
Returns the value of theelement
record component.final boolean
Indicates whether some other object is "equal to" this one.<FT,
FR> Either<TypeTemplate, Type.FieldNotFoundException> findFieldOrType
(int index, String name, Type<FT> type, Type<FR> resultType) final int
hashCode()
Returns a hash code value for this object.IntFunction<RewriteResult<?,
?>> hmap
(TypeFamily family, IntFunction<RewriteResult<?, ?>> function) int
index()
Returns the value of theindex
record component.name()
Returns the value of thename
record component.int
size()
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mojang.datafixers.types.templates.TypeTemplate
toSimpleType
-
Constructor Details
-
Check
Creates an instance of aCheck
record class.- Parameters:
name
- the value for thename
record componentindex
- the value for theindex
record componentelement
- the value for theelement
record component
-
-
Method Details
-
size
public int size()- Specified by:
size
in interfaceTypeTemplate
-
apply
- Specified by:
apply
in interfaceTypeTemplate
-
applyO
- Specified by:
applyO
in interfaceTypeTemplate
-
findFieldOrType
public <FT,FR> Either<TypeTemplate,Type.FieldNotFoundException> findFieldOrType(int index, @Nullable String name, Type<FT> type, Type<FR> resultType) - Specified by:
findFieldOrType
in interfaceTypeTemplate
-
hmap
public IntFunction<RewriteResult<?,?>> hmap(TypeFamily family, IntFunction<RewriteResult<?, ?>> function) - Specified by:
hmap
in interfaceTypeTemplate
-
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 '=='. -
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
index
public int index()Returns the value of theindex
record component.- Returns:
- the value of the
index
record component
-
element
Returns the value of theelement
record component.- Returns:
- the value of the
element
record component
-