org.apache.jackrabbit.core.version
Class LabelVersionSelector

java.lang.Object
  extended by org.apache.jackrabbit.core.version.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 Summary
LabelVersionSelector(String label)
          Creates a LabelVersionSelector that will try to select a version with the given label.
 
Method Summary
 String getLabel()
          Returns the label hint
 Version select(VersionHistory versionHistory)
          Selects a version from the given version history using the previously assigned hint in the following order: name, label, date, latest.
static Version selectByLabel(VersionHistory history, String label)
          Selects a version by label
 void setLabel(String label)
          Sets the label hint
 String toString()
          returns debug information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LabelVersionSelector

public LabelVersionSelector(String label)
Creates a LabelVersionSelector that will try to select a version with the given label.

Parameters:
label -
Method Detail

getLabel

public String getLabel()
Returns the label hint

Returns:
the label hint.

setLabel

public void setLabel(String label)
Sets the label hint

Parameters:
label -

select

public Version select(VersionHistory versionHistory)
               throws RepositoryException
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 -
Returns:
Throws:
RepositoryException

selectByLabel

public static Version selectByLabel(VersionHistory history,
                                    String label)
                             throws RepositoryException
Selects a version by label

Parameters:
history -
label -
Returns:
the version with the given label or null
Throws:
RepositoryException

toString

public String toString()
returns debug information

Overrides:
toString in class Object
Returns:
debug information


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.