Record Class Const
java.lang.Object
java.lang.Record
com.mojang.datafixers.types.templates.Const
- All Implemented Interfaces:
TypeTemplate
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapply
(TypeFamily family) <A,
B> FamilyOptic<A, B> applyO
(FamilyOptic<A, B> input, Type<A> aType, Type<B> bType) 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
size()
toString()
Returns a string representation of this record class.Type<?>
type()
Returns the value of thetype
record component.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
-
Const
Creates an instance of aConst
record class.- Parameters:
type
- the value for thetype
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)
. -
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-