Package org.intermine.objectstore.proxy
Class ProxyReference
- java.lang.Object
-
- org.intermine.objectstore.proxy.ProxyReference
-
- All Implemented Interfaces:
FastPathObject
,InterMineFastPathObject
,InterMineObject
,Lazy
public class ProxyReference extends java.lang.Object implements InterMineObject, Lazy
Class which holds a reference to an object in the database- Author:
- Matthew Wakeling
-
-
Constructor Summary
Constructors Constructor Description ProxyReference(ObjectStore os, java.lang.Integer id, java.lang.Class<? extends InterMineObject> clazz)
Construct a ProxyReference object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<? extends FastPathObject>
getElementType(java.lang.String fieldName)
Returns the element type of a collection by name.java.lang.Object
getFieldProxy(java.lang.String fieldName)
Returns the value of a field without dereferencing any ProxyReference objects.java.lang.Class<?>
getFieldType(java.lang.String fieldName)
Returns the type of a field by name.java.lang.Object
getFieldValue(java.lang.String fieldName)
Returns the value of a field by name.java.lang.Integer
getId()
Gets the ID valueStringConstructor
getoBJECT()
Returns the NotXml serialised version of this object.InterMineObject
getObject()
Gets the real object from the database.ObjectStore
getObjectStore()
Returns the ObjectStore that this proxy will usevoid
setFieldValue(java.lang.String fieldName, java.lang.Object value)
Sets the value of a field by name.void
setId(java.lang.Integer id)
Sets the ID valuevoid
setoBJECT(java.lang.String[] notXml, ObjectStore os)
Sets the values of the fields to the values in the given split NotXml.void
setoBJECT(java.lang.String notXml, ObjectStore os)
Sets the values of the fields to the values in the given NotXml.java.lang.String
toString()
-
-
-
Constructor Detail
-
ProxyReference
public ProxyReference(ObjectStore os, java.lang.Integer id, java.lang.Class<? extends InterMineObject> clazz)
Construct a ProxyReference object.- Parameters:
os
- the ObjectStore to retrieve the object fromid
- the internal id of the real objectclazz
- a hint of the class that this object is - use InterMineObject if unsure
-
-
Method Detail
-
getObject
public InterMineObject getObject()
Gets the real object from the database.- Returns:
- a InterMineObject
-
getId
public java.lang.Integer getId()
Gets the ID value- Specified by:
getId
in interfaceInterMineFastPathObject
- Specified by:
getId
in interfaceInterMineObject
- Returns:
- the id
-
setId
public void setId(java.lang.Integer id)
Sets the ID value- Specified by:
setId
in interfaceInterMineFastPathObject
- Specified by:
setId
in interfaceInterMineObject
- Parameters:
id
- the id
-
getObjectStore
public ObjectStore getObjectStore()
Returns the ObjectStore that this proxy will use- Specified by:
getObjectStore
in interfaceLazy
- Returns:
- an ObjectStore
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getoBJECT
public StringConstructor getoBJECT()
Returns the NotXml serialised version of this object.- Specified by:
getoBJECT
in interfaceInterMineFastPathObject
- Specified by:
getoBJECT
in interfaceInterMineObject
- Returns:
- a StringConstructor containing the NotXml
-
setoBJECT
public void setoBJECT(java.lang.String notXml, ObjectStore os)
Sets the values of the fields to the values in the given NotXml.- Specified by:
setoBJECT
in interfaceInterMineObject
- Parameters:
notXml
- a String containing NotXml for this classos
- an ObjectStore from which to create proxies
-
setoBJECT
public void setoBJECT(java.lang.String[] notXml, ObjectStore os)
Sets the values of the fields to the values in the given split NotXml.- Specified by:
setoBJECT
in interfaceInterMineObject
- Parameters:
notXml
- a String array containing the NotXml split with the delimiteros
- an ObjectStore from which to create proxies
-
getFieldValue
public java.lang.Object getFieldValue(java.lang.String fieldName)
Returns the value of a field by name.- Specified by:
getFieldValue
in interfaceFastPathObject
- Parameters:
fieldName
- the name of the field- Returns:
- the value of the field
-
getFieldProxy
public java.lang.Object getFieldProxy(java.lang.String fieldName)
Returns the value of a field without dereferencing any ProxyReference objects.- Specified by:
getFieldProxy
in interfaceFastPathObject
- Parameters:
fieldName
- the name of the field- Returns:
- the value of the field, or a ProxyReference representing it
-
setFieldValue
public void setFieldValue(java.lang.String fieldName, java.lang.Object value)
Sets the value of a field by name.- Specified by:
setFieldValue
in interfaceFastPathObject
- Parameters:
fieldName
- the name of the fieldvalue
- the value of the field, or a ProxyReference representing it
-
getFieldType
public java.lang.Class<?> getFieldType(java.lang.String fieldName)
Returns the type of a field by name.- Specified by:
getFieldType
in interfaceFastPathObject
- Parameters:
fieldName
- the name of the field- Returns:
- the type of the field
-
getElementType
public java.lang.Class<? extends FastPathObject> getElementType(java.lang.String fieldName)
Returns the element type of a collection by name.- Specified by:
getElementType
in interfaceInterMineFastPathObject
- Specified by:
getElementType
in interfaceInterMineObject
- Parameters:
fieldName
- the name of the collection- Returns:
- the type of the elements of the collection
-
-