Package dev.latvian.mods.kubejs.script
Record Class CodecTypeWrapper<T>
java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.script.CodecTypeWrapper<T>
- All Implemented Interfaces:
dev.latvian.mods.rhino.util.wrap.TypeWrapperFactory<T>
-
Constructor Summary
ConstructorsConstructorDescriptionCodecTypeWrapper(Class<T> target, com.mojang.serialization.Codec<T> codec, T defaultValue) Creates an instance of aCodecTypeWrapperrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<T> codec()Returns the value of thecodecrecord component.Returns the value of thedefaultValuerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.target()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CodecTypeWrapper
Creates an instance of aCodecTypeWrapperrecord class.- Parameters:
target- the value for thetargetrecord componentcodec- the value for thecodecrecord componentdefaultValue- the value for thedefaultValuerecord component
-
-
Method Details
-
wrap
public T wrap(dev.latvian.mods.rhino.Context cx, Object o, dev.latvian.mods.rhino.type.TypeInfo target) - Specified by:
wrapin interfacedev.latvian.mods.rhino.util.wrap.TypeWrapperFactory<T>
-
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). -
target
Returns the value of thetargetrecord component.- Returns:
- the value of the
targetrecord component
-
codec
Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-
defaultValue
Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-