Class LabelVersionSelector

  • All Implemented Interfaces:
    VersionSelector

    public class LabelVersionSelector
    extends Object
    implements VersionSelector
    This Class implements a version selector that selects a version by label.
     V1.0
     V1.1 - "foo"
    
     new LabelVersionSelector("foo").select() --> V1.1
     new LabelVersionSelector("bar").select() --> null
    
     
    • Constructor Detail

      • LabelVersionSelector

        public LabelVersionSelector​(Name label)
        Creates a LabelVersionSelector that will try to select a version with the given label.
        Parameters:
        label - label hint
    • Method Detail

      • getLabel

        public Name getLabel()
        Returns the label hint
        Returns:
        the label hint.
      • setLabel

        public void setLabel​(Name label)
        Sets the label hint
        Parameters:
        label - label hint
      • select

        public InternalVersion select​(InternalVersionHistory versionHistory)
                               throws RepositoryException
        Selects a version of the given version history. If this VersionSelector is unable to select one, it can return null. Please note, that a version selector is not allowed to return the root version. Selects a version from the given version history using the previously assigned hint in the following order: name, label, date, latest.
        Specified by:
        select in interface VersionSelector
        Parameters:
        versionHistory - version history to select a version from
        Returns:
        A version or null.
        Throws:
        RepositoryException - if an error occurs.
      • toString

        public String toString()
        returns debug information
        Overrides:
        toString in class Object
        Returns:
        debug information