public class LabelVersionSelector extends Object implements VersionSelector
V1.0 V1.1 - "foo" new LabelVersionSelector("foo").select() --> V1.1 new LabelVersionSelector("bar").select() --> null
Constructor and Description |
---|
LabelVersionSelector(Name label)
Creates a
LabelVersionSelector that will try to select a
version with the given label. |
Modifier and Type | Method and Description |
---|---|
Name |
getLabel()
Returns the label hint
|
InternalVersion |
select(InternalVersionHistory versionHistory)
Selects a version of the given version history.
|
static InternalVersion |
selectByLabel(InternalVersionHistory history,
Name label)
Selects a version by label
|
void |
setLabel(Name label)
Sets the label hint
|
String |
toString()
returns debug information
|
public LabelVersionSelector(Name label)
LabelVersionSelector
that will try to select a
version with the given label.label
- label hintpublic Name getLabel()
public void setLabel(Name label)
label
- label hintpublic InternalVersion select(InternalVersionHistory versionHistory) throws RepositoryException
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.select
in interface VersionSelector
versionHistory
- version history to select a version fromnull
.RepositoryException
- if an error occurs.public static InternalVersion selectByLabel(InternalVersionHistory history, Name label) throws RepositoryException
history
- history to select fromlabel
- desired labelnull
RepositoryException
- if an error occursCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.