T
- the attached data type.public class VersionedItem<T> extends Object implements Comparable<VersionedItem<?>>
It is composed of a name identifying it and a version. Only these fields are used for equality and comparisons.
The represented object or any other data may be attached by the setObject(Object)
relation.
Constructor and Description |
---|
VersionedItem(String name,
Version version) |
VersionedItem(String name,
Version version,
T object) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(VersionedItem<?> o) |
boolean |
equals(Object obj) |
static <T> VersionedItem<T> |
find(String name,
Collection<VersionedItem<T>> coll)
Convenience to find a versioned item by name in a generic collection.
|
String |
getName() |
T |
getObject()
Get the represented object, or any data attached.
|
Version |
getVersion() |
int |
hashCode() |
void |
setObject(T object)
Attach the represented object or any other data.
|
String |
toString() |
public VersionedItem(String name, Version version, T object)
name
- the item nameversion
- the item versionobject
- the represented objectpublic int compareTo(VersionedItem<?> o)
compareTo
in interface Comparable<VersionedItem<?>>
public static <T> VersionedItem<T> find(String name, Collection<VersionedItem<T>> coll)
name
- the name to look forcoll
- the collection to look intopublic String getName()
public T getObject()
public Version getVersion()
public void setObject(T object)
object
- the object to attach.