Package io.ocfl.api.model
Class ObjectVersionId
- java.lang.Object
-
- io.ocfl.api.model.ObjectVersionId
-
public class ObjectVersionId extends Object
Points to a specific version of an object, encapsulating an object identifier and version number. When HEAD is specified, then it points to whatever the most recent version of the object is.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getObjectId()
The object idVersionNum
getVersionNum()
The version numberint
hashCode()
static ObjectVersionId
head(String objectId)
Creates an ObjectId instance that points to the HEAD version of the objectboolean
isHead()
ObjectVersionId
nextVersion()
Returns a new ObjectVersionId instance with an incremented version number.ObjectVersionId
previousVersion()
Returns a new ObjectVersionId instance with an decremented version number.String
toString()
static ObjectVersionId
version(String objectId, int versionNum)
Creates an ObjectId instance that points to a specific version of an objectstatic ObjectVersionId
version(String objectId, VersionNum versionNum)
Creates an ObjectId instance that points to a specific version of an objectstatic ObjectVersionId
version(String objectId, String versionNum)
Creates an ObjectId instance that points to a specific version of an object
-
-
-
Method Detail
-
head
public static ObjectVersionId head(String objectId)
Creates an ObjectId instance that points to the HEAD version of the object- Parameters:
objectId
- the id of the object- Returns:
- new ObjectVersionId
-
version
public static ObjectVersionId version(String objectId, String versionNum)
Creates an ObjectId instance that points to a specific version of an object- Parameters:
objectId
- the id of the objectversionNum
- the OCFL version num of the version- Returns:
- new ObjectVersionId
-
version
public static ObjectVersionId version(String objectId, int versionNum)
Creates an ObjectId instance that points to a specific version of an object- Parameters:
objectId
- the id of the objectversionNum
- the OCFL version num of the version- Returns:
- new ObjectVersionId
-
version
public static ObjectVersionId version(String objectId, VersionNum versionNum)
Creates an ObjectId instance that points to a specific version of an object- Parameters:
objectId
- the id of the objectversionNum
- the OCFL version number of the version- Returns:
- new ObjectVersionId
-
getObjectId
public String getObjectId()
The object id- Returns:
- the object id
-
getVersionNum
public VersionNum getVersionNum()
The version number- Returns:
- the version number or null if no version is specified
-
isHead
public boolean isHead()
- Returns:
- true if no version number is set
-
nextVersion
public ObjectVersionId nextVersion()
Returns a new ObjectVersionId instance with an incremented version number. This may only be called if this instance has its version number set- Returns:
- new ObjectVersionId with incremented version
- Throws:
InvalidVersionException
- if the version number is not set or the version cannot be incremented
-
previousVersion
public ObjectVersionId previousVersion()
Returns a new ObjectVersionId instance with an decremented version number. This may only be called if this instance has its version number set- Returns:
- new ObjectVersionId with decremented version
- Throws:
InvalidVersionException
- if the version number is not set or the version cannot be decremented
-
-