Class Position

    • Constructor Detail

      • Position

        public Position​(java.lang.String type)
        Create a new Position object with the specified type. Since any type except for first and last must be combined with a segment, only the mentioned types are valid arguments.
        Parameters:
        type - first or last
        Throws:
        java.lang.IllegalArgumentException - if the given type is other than OrderingConstants.XML_FIRST or OrderingConstants.XML_LAST.
      • Position

        public Position​(java.lang.String type,
                        java.lang.String segment)
        Create a new Position object with the specified type and segment.
        Parameters:
        type -
        segment -
        Throws:
        java.lang.IllegalArgumentException - if the specified type and segment do not form a valid pair.
    • Method Detail

      • getType

        public java.lang.String getType()
        Return the type of this Position object, which may be any of the following valid types: first, last, after, before
        Returns:
        type
      • getSegment

        public java.lang.String getSegment()
        Returns the segment used to create this Position object or null if no segment is present with the type.
        Returns:
        segment or null
        See Also:
        getType()
      • toXml

        public org.w3c.dom.Element toXml​(org.w3c.dom.Document document)
        Description copied from interface: XmlSerializable
        Returns the xml representation of the implementing object as Element. The given Document is used as factory and represents the owner document of the returned DOM element.
        Specified by:
        toXml in interface XmlSerializable
        Parameters:
        document -
        Returns:
        a w3c element representing this object
        See Also:
        XmlSerializable.toXml(Document)
      • createFromXml

        public static Position createFromXml​(org.w3c.dom.Element positionElement)
        Create a new Position object from the specified position element. The element must fulfill the following structure:
         <!ELEMENT position (first | last | before | after) >
         <!ELEMENT segment (#PCDATA) >
         <!ELEMENT first EMPTY >
         <!ELEMENT last EMPTY >
         <!ELEMENT before segment >
         <!ELEMENT after segment >
         
        Parameters:
        positionElement - Xml element defining the position.
        Throws:
        java.lang.IllegalArgumentException - if the given Xml element is not valid.