T
- the attached data type.public class VersionedItem<T> extends java.lang.Object implements java.lang.Comparable<VersionedItem<?>>, java.io.Serializable
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(java.lang.String name,
Version version) |
VersionedItem(java.lang.String name,
Version version,
T object) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(VersionedItem<?> o) |
boolean |
equals(java.lang.Object obj) |
static <T> VersionedItem<T> |
find(java.lang.String name,
java.util.Collection<VersionedItem<T>> coll)
Convenience to find a versioned item by name in a generic collection.
|
java.lang.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.
|
java.lang.String |
toString() |
public VersionedItem(java.lang.String name, Version version, T object)
name
- the item nameversion
- the item versionobject
- the represented objectpublic VersionedItem(java.lang.String name, Version version)
name
- the nameversion
- the versionpublic int compareTo(VersionedItem<?> o)
compareTo
in interface java.lang.Comparable<VersionedItem<?>>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static <T> VersionedItem<T> find(java.lang.String name, java.util.Collection<VersionedItem<T>> coll)
name
- the name to look forcoll
- the collection to look intopublic java.lang.String getName()
public T getObject()
public Version getVersion()
public int hashCode()
hashCode
in class java.lang.Object
public void setObject(T object)
object
- the object to attach.public java.lang.String toString()
toString
in class java.lang.Object