Class PartData

  • All Implemented Interfaces:
    PartSeries

    class PartData
    extends java.lang.Object
    implements PartSeries
    The PartData object represents an ordered list of parts that were uploaded within a HTTP entity body. This allows the parts to be iterated over, or if required accessed by name. In order to access the Part object by name it must have had a name within the Content-Disposition header.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<Part> list
      This is the list of attachments for this part list object.
      private KeyMap<Part> map
      This is the key map that is used to store the part objects.
    • Constructor Summary

      Constructors 
      Constructor Description
      PartData()
      Constructor for the PartData object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addPart​(Part part)
      This is used to add a part to the list.
      Part getPart​(java.lang.String name)
      This method is used to acquire a Part from the list using a known name for the part.
      java.util.List<Part> getParts()
      This is used to acquire the attachments associated with this list.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • map

        private final KeyMap<Part> map
        This is the key map that is used to store the part objects.
      • list

        private final java.util.List<Part> list
        This is the list of attachments for this part list object.
    • Constructor Detail

      • PartData

        public PartData()
        Constructor for the PartData object. This is used to create an order list of parts that is used by the request to access the individual parts uploaded with a HTTP body.
    • Method Detail

      • getParts

        public java.util.List<Part> getParts()
        This is used to acquire the attachments associated with this list. If no parts have been collected by this list then it will return an empty list. The order of the parts in the list are the insertion order for consistency.
        Specified by:
        getParts in interface PartSeries
        Returns:
        this returns the parts collected in iteration order
      • addPart

        public boolean addPart​(Part part)
        This is used to add a part to the list. The order the parts are added to the list is the iteration order. If the part has a name that is not null then it is added to an internal map using that name. This allows it to be accesses by name at a later time.
        Specified by:
        addPart in interface PartSeries
        Parameters:
        part - this is the part that is to be added to the list
        Returns:
        returns true if the list has changed due to the add
      • getPart

        public Part getPart​(java.lang.String name)
        This method is used to acquire a Part from the list using a known name for the part. This is a convenient way to access a part when the name for the part is known.
        Specified by:
        getPart in interface PartSeries
        Parameters:
        name - this is the name of the part to acquire
        Returns:
        the named part or null if the part does not exist