org.neodatis.odb.core.layers.layer2.meta
Class NonNativeObjectInfo

java.lang.Object
  extended by org.neodatis.odb.core.layers.layer2.meta.AbstractObjectInfo
      extended by org.neodatis.odb.core.layers.layer2.meta.NonNativeObjectInfo
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ClientNonNativeObjectInfo, NonNativeDeletedObjectInfo, NonNativeNullObjectInfo

public class NonNativeObjectInfo
extends AbstractObjectInfo

To keep info about a non native object. The NonNativeObjectInfo is the meta representation and is a class of the Layer in NeoDatis architecture (http://wiki.neodatis.org/odb-layers). The NonNativeObjectInfo (nnoi) contains all the data of the attributes of an objects.

 
      * The object
 The type of the object (org.neodatis.odb.core.meta.ODBType)
 The ClassInfo of the object
 The list of attributes (list of AbstractObjectInfo)
 The ObjectInfoHeader that holds :
           o The object position (in the ODB file)
           o The Object OID
           o The previous Object OID
           o The next object OID
           o The ClassInfo OID
           o The ids (local id, to idenitfy the attribute) of the attributes
           o The OID or position of the attributes
 
 

Author:
olivier s
See Also:
Serialized Form

Field Summary
protected  java.lang.Object object
          The object being represented
 
Fields inherited from class org.neodatis.odb.core.layers.layer2.meta.AbstractObjectInfo
odbType, odbTypeId, position
 
Constructor Summary
NonNativeObjectInfo()
           
NonNativeObjectInfo(ClassInfo classInfo)
           
NonNativeObjectInfo(java.lang.Object object, ClassInfo info, AbstractObjectInfo[] values, long[] attributesIdentification, int[] attributeIds)
           
NonNativeObjectInfo(ObjectInfoHeader oip, ClassInfo classInfo)
           
 
Method Summary
 void clear()
           
 AbstractObjectInfo createCopy(java.util.Map<OID,AbstractObjectInfo> cache, boolean onlyData)
          Create a copy oh this meta object
 boolean equals(java.lang.Object obj)
           
 long getAttributeDefinitionPosition(int attributeId)
          Return the position where the position of an attribute is stored.
 int getAttributeId(AbstractObjectInfo aoi)
          The performance of this method is bad.
 AbstractObjectInfo getAttributeValueFromId(int attributeId)
          Return The meta representation of an attribute from its attribute id.
 AbstractObjectInfo[] getAttributeValues()
           
 ClassInfo getClassInfo()
          Return the class info of the object.
 ObjectInfoHeader getHeader()
           
 int getMaxNbattributes()
           
 AbstractObjectInfo getMetaValueOf(java.lang.String attributeName)
          Return the value of the attribute 'attribute name'.
 OID getNextObjectOID()
          Returns the oid of the next object of the same type
 java.lang.Object getObject()
          Gets the actual java object.
 OID getOid()
          Return the oid of the object
 long getPosition()
          Gets the physical position of the object in the NeoDatis database file
 OID getPreviousObjectOID()
          Returns the oid of the previous object of the same type
 java.lang.Object getValueOf(java.lang.String attributeName)
          Return the value of the attribute 'attribute name'
 int hashCode()
           
 boolean isNonNativeObject()
          To indicate that this is a non native object info
 boolean isNull()
           
 void setAttributeValue(int attributeId, AbstractObjectInfo aoi)
           
 void setClassInfo(ClassInfo classInfo)
           
 void setHeader(ObjectInfoHeader header)
           
 void setNextObjectOID(OID nextObjectOID)
           
 void setObject(java.lang.Object object)
           
 void setOid(OID oid)
          Sets the oid of the object
 void setPosition(long position)
           
 void setPreviousInstanceOID(OID previousObjectOID)
           
 void setValueOf(java.lang.String attributeName, AbstractObjectInfo aoi)
          Used to change the value of an attribute
 java.lang.String toString()
           
 
Methods inherited from class org.neodatis.odb.core.layers.layer2.meta.AbstractObjectInfo
getOdbType, getOdbTypeId, isArrayObject, isAtomicNativeObject, isCollectionObject, isDeletedObject, isEnumObject, isGroup, isMapObject, isNative, isObjectReference, setOdbType, setOdbTypeId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

object

protected transient java.lang.Object object
The object being represented

Constructor Detail

NonNativeObjectInfo

public NonNativeObjectInfo()

NonNativeObjectInfo

public NonNativeObjectInfo(ObjectInfoHeader oip,
                           ClassInfo classInfo)

NonNativeObjectInfo

public NonNativeObjectInfo(ClassInfo classInfo)

NonNativeObjectInfo

public NonNativeObjectInfo(java.lang.Object object,
                           ClassInfo info,
                           AbstractObjectInfo[] values,
                           long[] attributesIdentification,
                           int[] attributeIds)
Method Detail

getHeader

public ObjectInfoHeader getHeader()

getAttributeValueFromId

public AbstractObjectInfo getAttributeValueFromId(int attributeId)
Return The meta representation of an attribute from its attribute id. Attribute ids are sequencial number(starting from 1) set by the classIntropector to identify attributes

Parameters:
attributeId -
Returns:

getClassInfo

public ClassInfo getClassInfo()
Return the class info of the object. The Class Info is a meta representation of the java class

Returns:

setClassInfo

public void setClassInfo(ClassInfo classInfo)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNextObjectOID

public OID getNextObjectOID()
Returns the oid of the next object of the same type

Returns:

setNextObjectOID

public void setNextObjectOID(OID nextObjectOID)

getPreviousObjectOID

public OID getPreviousObjectOID()
Returns the oid of the previous object of the same type

Returns:

setPreviousInstanceOID

public void setPreviousInstanceOID(OID previousObjectOID)

getPosition

public long getPosition()
Gets the physical position of the object in the NeoDatis database file

Overrides:
getPosition in class AbstractObjectInfo

setPosition

public void setPosition(long position)
Overrides:
setPosition in class AbstractObjectInfo

getObject

public java.lang.Object getObject()
Gets the actual java object. May return null on client server mode as Client Server mode does work with java objects (layer1)

Specified by:
getObject in class AbstractObjectInfo

getValueOf

public java.lang.Object getValueOf(java.lang.String attributeName)
Return the value of the attribute 'attribute name'
 For example, if  the class User has 2 attributes (name of type String, and profile of type Profile) calling getValueOf("name") on a nnoi (NonNativeObjectInfo) 
 that represents an instance of User will return its name
 

Parameters:
attributeName -
Returns:

getMetaValueOf

public AbstractObjectInfo getMetaValueOf(java.lang.String attributeName)
Return the value of the attribute 'attribute name'. Same as getValueOf, except that the object return is a meta representation of the real object : an AbstractObjectInfo (NonNative ObjectInfo, NativeObjectnfo,....)
 For example, if  the class User has 2 attributes (name of type String, and profile of type Profile) calling getValueOf("name") on a nnoi (NonNativeObjectInfo) 
 that represents an instance of User will return its name
 

Parameters:
attributeName -
Returns:

setValueOf

public void setValueOf(java.lang.String attributeName,
                       AbstractObjectInfo aoi)
Used to change the value of an attribute

Parameters:
attributeName -
aoi -

getOid

public OID getOid()
Return the oid of the object

Returns:
The oid

setOid

public void setOid(OID oid)
Sets the oid of the object

Parameters:
oid -

isNonNativeObject

public boolean isNonNativeObject()
To indicate that this is a non native object info

Overrides:
isNonNativeObject in class AbstractObjectInfo

isNull

public boolean isNull()
Overrides:
isNull in class AbstractObjectInfo

clear

public void clear()

createCopy

public AbstractObjectInfo createCopy(java.util.Map<OID,AbstractObjectInfo> cache,
                                     boolean onlyData)
Create a copy oh this meta object

Specified by:
createCopy in class AbstractObjectInfo
Parameters:
onlyData - if true, only copy attributes values
Returns:

setAttributeValue

public void setAttributeValue(int attributeId,
                              AbstractObjectInfo aoi)

getAttributeValues

public AbstractObjectInfo[] getAttributeValues()

getMaxNbattributes

public int getMaxNbattributes()

getAttributeId

public int getAttributeId(AbstractObjectInfo aoi)
The performance of this method is bad. But it is not used by the engine, only in the ODBExplorer

Parameters:
aoi -
Returns:

getAttributeDefinitionPosition

public long getAttributeDefinitionPosition(int attributeId)
Return the position where the position of an attribute is stored.
        If a object has 3 attributes and if it is stored at position x
 Then the number of attributes (3) is stored at x+StorageEngineConstant.OBJECT_OFFSET_NB_ATTRIBUTES
 and first attribute id definition is stored at x+StorageEngineConstant.OBJECT_OFFSET_NB_ATTRIBUTES+size-of(int)
 and first attribute position is stored at x+StorageEngineConstant.OBJECT_OFFSET_NB_ATTRIBUTES+size-of(int)+size-of(int)
 
 the second attribute id is stored at x+StorageEngineConstant.OBJECT_OFFSET_NB_ATTRIBUTES+size-of(int)+size-of(int)+size-of(long)
 the second attribute position is stored at x+StorageEngineConstant.OBJECT_OFFSET_NB_ATTRIBUTES+size-of(int)+size-of(int)+size-of(long)+size-of(int)
 
 
 FIXME Remove dependency of StorageEngineConstant!

Parameters:
attributeId -
Returns:
The position where this attribute is stored

setObject

public void setObject(java.lang.Object object)
Specified by:
setObject in class AbstractObjectInfo

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setHeader

public void setHeader(ObjectInfoHeader header)
Parameters:
header -