Class PositionInfo


public final class PositionInfo extends Object
A holder class for the full information to position an element in a list.
René Brandstetter
  • Field Details

  • Constructor Details

    • PositionInfo

      public PositionInfo(Position position, String positionReference)
      Creates an instance of the PositionInfo.
      position - the kind of the positioning
      positionReference - additional information which is need to position an element (e.g.: index, ID of another element)
      NullPointerException - if the position is null
  • Method Details

    • getPosition

      public Position getPosition()
      Returns the kind/type of positioning which should be used.
      the position
    • getPositionReference

      public String getPositionReference()
      Returns additional information which is needed to place an element.
      the positionReference, or null if no additional information is given
    • getPositionReferenceAsInteger

      public int getPositionReferenceAsInteger()
      Returns the additional information which is needed to place an element as an int.
      the positionReference as an int
      NumberFormatException - if the positionReference can't be parsed to an int
      NullPointerException - if the positionReference is null
    • parse

      public static PositionInfo parse(String positionInfo)
      Creates a PositionInfo object out of the given positioning string.

      Examples for a positioning string:

      • last - place an element to the end of a list
      • first - place an element to the beginning of a list
      • index:3 - place an element at the provided index 3 in a list
      • - place an element in a list in front of the element with the ID ""
      • - place an element in a list after the element with the ID ""
      positionInfo - the positioning string
      a PositionInfo which holds all the data mentioned in the positioning string, or null if the positioning string doesn't hold a positioning information
    • toString

      public String toString()
      toString in class Object