Package com.io7m.cardant.model
Record Class CAItem
java.lang.Object
java.lang.Record
com.io7m.cardant.model.CAItem
- Record Components:
id- The item IDname- The item namecountTotal- The item count across all storage locations in the inventorycountHere- The item count in the context of a storage locationmetadata- The item metadataattachments- The item attachmentstypes- The item types
- All Implemented Interfaces:
CAInventoryObjectType<CAItemSummary>
public record CAItem(CAItemID id, String name, long countTotal, long countHere, SortedMap<com.io7m.lanark.core.RDottedName,CAMetadataType> metadata, SortedMap<CAAttachmentKey,CAAttachment> attachments, SortedSet<com.io7m.lanark.core.RDottedName> types)
extends Record
implements CAInventoryObjectType<CAItemSummary>
An item in the inventory.
-
Constructor Summary
ConstructorsConstructorDescriptionCAItem(CAItemID id, String name, long countTotal, long countHere, SortedMap<com.io7m.lanark.core.RDottedName, CAMetadataType> metadata, SortedMap<CAAttachmentKey, CAAttachment> attachments, SortedSet<com.io7m.lanark.core.RDottedName> types) Construct an item. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattachmentsrecord component.longReturns the value of thecountHererecord component.longReturns the value of thecountTotalrecord component.static CAItemcreate()Create an empty item with a pseudorandom ID.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.SortedMap<com.io7m.lanark.core.RDottedName, CAMetadataType> metadata()Returns the value of themetadatarecord component.name()Returns the value of thenamerecord component.summary()final StringtoString()Returns a string representation of this record class.SortedSet<com.io7m.lanark.core.RDottedName> types()Returns the value of thetypesrecord component.withCountHere(long newCountHere) Set the count in the current storage location context for this item.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.cardant.model.CAInventoryObjectType
attachmentsWithRelation, firstAttachmentWithRelation, hasAttachmentWithRelation
-
Constructor Details
-
CAItem
public CAItem(CAItemID id, String name, long countTotal, long countHere, SortedMap<com.io7m.lanark.core.RDottedName, CAMetadataType> metadata, SortedMap<CAAttachmentKey, CAAttachment> attachments, SortedSet<com.io7m.lanark.core.RDottedName> types) Construct an item.- Parameters:
id- The item IDname- The item namecountTotal- The item countcountHere- The item count in the context of a storage locationmetadata- The item metadataattachments- The item attachmentstypes- The types assigned to the item
-
-
Method Details
-
create
Create an empty item with a pseudorandom ID.- Returns:
- The item
-
withCountHere
Set the count in the current storage location context for this item.- Parameters:
newCountHere- The item count- Returns:
- This item with the given count
-
summary
- Specified by:
summaryin interfaceCAInventoryObjectType<CAItemSummary>- Returns:
- A summary of the object
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
countTotal
public long countTotal()Returns the value of thecountTotalrecord component.- Returns:
- the value of the
countTotalrecord component
-
countHere
public long countHere()Returns the value of thecountHererecord component.- Returns:
- the value of the
countHererecord component
-
metadata
Returns the value of themetadatarecord component.- Specified by:
metadatain interfaceCAInventoryObjectType<CAItemSummary>- Returns:
- the value of the
metadatarecord component
-
attachments
Returns the value of theattachmentsrecord component.- Specified by:
attachmentsin interfaceCAInventoryObjectType<CAItemSummary>- Returns:
- the value of the
attachmentsrecord component
-
types
Returns the value of thetypesrecord component.- Specified by:
typesin interfaceCAInventoryObjectType<CAItemSummary>- Returns:
- the value of the
typesrecord component
-