org.persvr.data
Class Identification<T>
java.lang.Object
org.persvr.data.Identification<T>
- Type Parameters:
T - base type of objects that can be referred to
- All Implemented Interfaces:
- TargetRetriever<T>
- Direct Known Subclasses:
- JsonPath, LazyPropertyId, ObjectId, ObjectPath
public abstract class Identification<T>
- extends java.lang.Object
- implements TargetRetriever<T>
An Identification represents an id of object or a value. This allows objects or values to be reference
without the actual object being loaded into the object graph yet. When the object or value
is needed, the identification object can retrieve it (by calling getTarget)
- Author:
- Kris Zyp
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
subObjectId
public java.lang.String subObjectId
source
public DataSource source
Identification
public Identification()
idForString
public static Identification<? extends java.lang.Object> idForString(java.lang.String value)
idForRelativeString
public static Identification<? extends java.lang.Object> idForRelativeString(java.lang.String startingId,
java.lang.String targetId)
isLoaded
public boolean isLoaded()
isForeign
public boolean isForeign()
resolveTarget
protected abstract T resolveTarget()
- Implementations should implement this to resolve a target when it has not been loaded yet
- Returns:
- object referred to by identification
getTarget
public T getTarget()
- Retrieves the value or object referred to by this identification
- Specified by:
getTarget in interface TargetRetriever<T>
- Returns:
- object referred to by identification
getSubObjectId
public java.lang.String getSubObjectId()
getSource
public DataSource getSource()
relativePath
protected java.lang.String relativePath(java.lang.String originalPath,
java.lang.String newPath)
toString
public java.lang.String toString(DataSource relativeSource,
java.lang.String relativeSubPath)
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object