Package dev.enola.common
Record Class ImmutableObjectWithTypeToken<T>
java.lang.Object
java.lang.Record
dev.enola.common.ImmutableObjectWithTypeToken<T>
- All Implemented Interfaces:
ObjectWithTypeToken<T>
public record ImmutableObjectWithTypeToken<T>(T object, TypeToken<T> typeToken)
extends Record
implements ObjectWithTypeToken<T>
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableObjectWithTypeToken(T object) ImmutableObjectWithTypeToken(T object, TypeToken<T> typeToken) Creates an instance of aImmutableObjectWithTypeTokenrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.object()Returns the value of theobjectrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetypeTokenrecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.enola.common.ObjectWithTypeToken
as
-
Constructor Details
-
ImmutableObjectWithTypeToken
-
ImmutableObjectWithTypeToken
Creates an instance of aImmutableObjectWithTypeTokenrecord class.- Parameters:
object- the value for theobjectrecord componenttypeToken- the value for thetypeTokenrecord component
-
-
Method Details
-
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
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). -
object
Returns the value of theobjectrecord component.- Specified by:
objectin interfaceObjectWithTypeToken<T>- Returns:
- the value of the
objectrecord component
-
typeToken
Returns the value of thetypeTokenrecord component.- Specified by:
typeTokenin interfaceObjectWithTypeToken<T>- Returns:
- the value of the
typeTokenrecord component
-