Class AbstractEntity

    • Constructor Detail

      • AbstractEntity

        protected AbstractEntity()
        Creates a new Entity. Typically invoked implicitly by a subclass constructor.
    • Method Detail

      • getParent

        public Entity getParent()
        Gets the parent entity of this entity. Returns null if this is the root entity.
        Specified by:
        getParent in interface Entity
        Returns:
        the parent or null.
      • setParent

        public void setParent​(Entity parent)
        Sets the parent entity of this entity.
        Specified by:
        setParent in interface Entity
        Parameters:
        parent - the parent entity or null if this will be the root entity.
      • getHeader

        public Header getHeader()
        Gets the entity header.
        Specified by:
        getHeader in interface Entity
        Returns:
        the header.
      • setHeader

        public void setHeader​(Header header)
        Sets the entity header.
        Specified by:
        setHeader in interface Entity
        Parameters:
        header - the header.
      • getBody

        public Body getBody()
        Gets the body of this entity.
        Specified by:
        getBody in interface Entity
        Returns:
        the body,
      • setBody

        public void setBody​(Body body)
        Sets the body of this entity.
        Specified by:
        setBody in interface Entity
        Parameters:
        body - the body.
        Throws:
        IllegalStateException - if the body has already been set.
      • removeBody

        public Body removeBody()
        Removes and returns the body of this entity. The removed body may be attached to another entity. If it is no longer needed it should be disposed of.
        Specified by:
        removeBody in interface Entity
        Returns:
        the removed body or null if no body was set.
      • getMimeType

        public String getMimeType()
        Description copied from interface: Entity
        Determines the MIME type of this Entity. The MIME type is derived by looking at the parent's Content-Type field if no Content-Type field is set for this Entity.
        Specified by:
        getMimeType in interface Entity
        Returns:
        the MIME type.
      • getCharset

        public String getCharset()
        Determines the MIME character set encoding of this Entity.
        Specified by:
        getCharset in interface Entity
        Returns:
        the MIME character set encoding.
      • getContentTransferEncoding

        public String getContentTransferEncoding()
        Determines the transfer encoding of this Entity.
        Specified by:
        getContentTransferEncoding in interface Entity
        Returns:
        the transfer encoding.
      • getDispositionType

        public String getDispositionType()
        Return the disposition type of the content disposition of this Entity.
        Specified by:
        getDispositionType in interface Entity
        Returns:
        the disposition type or null if no disposition type has been set.
      • getFilename

        public String getFilename()
        Returns the filename parameter of the content disposition of this Entity.
        Specified by:
        getFilename in interface Entity
        Returns:
        the filename parameter of the content disposition or null if the filename has not been set.
      • isMultipart

        public boolean isMultipart()
        Determines if the MIME type of this Entity is multipart/*. Since multipart-entities must have a boundary parameter in the Content-Type field this method returns false if no boundary exists.
        Specified by:
        isMultipart in interface Entity
        Returns:
        true on match, false otherwise.
      • dispose

        public void dispose()
        Disposes of the body of this entity. Note that the dispose call does not get forwarded to the parent entity of this Entity. Subclasses that need to free resources should override this method and invoke super.dispose().
        Specified by:
        dispose in interface Disposable
        See Also:
        Disposable.dispose()