Record Class Hook
java.lang.Object
java.lang.Record
com.mojang.datafixers.types.templates.Hook
- All Implemented Interfaces:
TypeTemplate
public record Hook(TypeTemplate element, Hook.HookFunction preRead, Hook.HookFunction postWrite)
extends Record
implements TypeTemplate
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static final class
-
Constructor Summary
ConstructorDescriptionHook
(TypeTemplate element, Hook.HookFunction preRead, Hook.HookFunction postWrite) Creates an instance of aHook
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) Returns the value of thepostWrite
record component.preRead()
Returns the value of thepreRead
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
-
Hook
Creates an instance of aHook
record class.- Parameters:
element
- the value for theelement
record componentpreRead
- the value for thepreRead
record componentpostWrite
- the value for thepostWrite
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
element
Returns the value of theelement
record component.- Returns:
- the value of the
element
record component
-
preRead
Returns the value of thepreRead
record component.- Returns:
- the value of the
preRead
record component
-
postWrite
Returns the value of thepostWrite
record component.- Returns:
- the value of the
postWrite
record component
-