Package com.kazforge.jsonapi.patch
Record Class PatchCommand<T>
java.lang.Object
java.lang.Record
com.kazforge.jsonapi.patch.PatchCommand<T>
public record PatchCommand<T>(Class<T> resourceType, Object identity, List<PatchChange> changes)
extends Record
Immutable presence-aware resource-update command parameterized by the annotated DTO type
T.
Carries the converted DTO identifier and exactly the supplied mapped attribute and
relationship changes. Does not construct a complete DTO, resolve included, or mutate
domain state. The identity identifies the requested target but grants no access; applications
authorize the request and decide how to apply each atomic or structured change.
-
Constructor Summary
ConstructorsConstructorDescriptionPatchCommand(Class<T> resourceType, Object identity, List<PatchChange> changes) Creates an instance of aPatchCommandrecord class. -
Method Summary
Modifier and TypeMethodDescriptionchanges()Returns the value of thechangesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.identity()Returns the value of theidentityrecord component.Returns the value of theresourceTyperecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PatchCommand
Creates an instance of aPatchCommandrecord class.- Parameters:
resourceType- the value for theresourceTyperecord componentidentity- the value for theidentityrecord componentchanges- the value for thechangesrecord 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
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). -
resourceType
Returns the value of theresourceTyperecord component.- Returns:
- the value of the
resourceTyperecord component
-
identity
Returns the value of theidentityrecord component.- Returns:
- the value of the
identityrecord component
-
changes
Returns the value of thechangesrecord component.- Returns:
- the value of the
changesrecord component
-