Record Class Sum
java.lang.Object
java.lang.Record
com.mojang.datafixers.types.templates.Sum
- All Implemented Interfaces:
TypeTemplate
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionSum
(TypeTemplate f, TypeTemplate g) Creates an instance of aSum
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) final boolean
Indicates whether some other object is "equal to" this one.f()
Returns the value of thef
record component.<FT,
FR> Either<TypeTemplate, Type.FieldNotFoundException> findFieldOrType
(int index, String name, Type<FT> type, Type<FR> resultType) g()
Returns the value of theg
record component.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.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
-
Sum
Creates an instance of aSum
record class.- Parameters:
f
- the value for thef
record componentg
- the value for theg
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)
. -
f
Returns the value of thef
record component.- Returns:
- the value of the
f
record component
-
g
Returns the value of theg
record component.- Returns:
- the value of the
g
record component
-