com.orientechnologies.jdo
Class oDynaObject

java.lang.Object
  extended bycom.orientechnologies.jdo.oDynaObject

public class oDynaObject
extends java.lang.Object

Allows the dynamic manipulation of a persistent object without instance it.

Generally the use of oDynaObject instances allows to work with persistent objects without involve the class loader.

This class works like a proxy to the real object implementation.

To use oDynaObject instead of real Java objects, then set this features to the PersistenceManager level by calling oPersistenceManager.setUsingDynaObjects( boolean iValue ).

See Also:
oPersistenceManager.setUsingDynaObjects, oPersistenceManager.isUsingDynaObjects

Field Summary
static int STATUS_DELETED
           
static int STATUS_EMBEDDED
           
static int STATUS_LOADED
           
static int STATUS_NEW
           
static int STATUS_UPDATED
           
 
Constructor Summary
oDynaObject(oPersistenceManager iManager, oOID iOid)
          Create a dynamic object from an OID.
oDynaObject(oPersistenceManager iManager, oOID iOid, oBinary iStream)
          Create a dynamic object from a stream object.
oDynaObject(oPersistenceManager iManager, java.lang.String iClassName)
          Create an empty dyna object of class iClass.
oDynaObject(oPersistenceManager iManager, java.lang.String iClassName, oBinary iStream)
          Create a dyna object of embedded type
 
Method Summary
 void delete()
          Delete the object persistently from datastore.
 java.lang.String getClassName()
          Get the class name
 java.util.Enumeration getDeclaredMembers()
          Get the enumeration containing all class attributes.
 java.lang.String getFullClassName()
          Get full name of class including package.
 oPersistenceManager getManager()
          Get the PersistenceManager owner.
 oSysProperty getMember(java.lang.String iMemberName)
          Get attribute information.
 java.util.Enumeration getMembers()
          Get the enumeration containing attributes of current class and all base classes.
 oOID getOid()
          Get the OID of dynamic object.
 int getStatus()
          Get current status.
 oBinary getStream()
          Get binary stream of serialized object.
 java.lang.Object getValue(java.lang.String iMemberName)
          Get the value of an attribute.
 boolean isNew()
          Know if the object is new and is not yet persistent.
 boolean isValid()
          Know if the object is valid.
 void reset()
          Reset object information.
 void setClassName(java.lang.String iClassName)
          Force class name setting.
 void setValue(java.lang.String iMemberName, java.lang.Object iMemberValue)
          Set the value for the attribute.
 void store()
          Store the object in datastore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_NEW

public static final int STATUS_NEW
See Also:
Constant Field Values

STATUS_EMBEDDED

public static final int STATUS_EMBEDDED
See Also:
Constant Field Values

STATUS_LOADED

public static final int STATUS_LOADED
See Also:
Constant Field Values

STATUS_UPDATED

public static final int STATUS_UPDATED
See Also:
Constant Field Values

STATUS_DELETED

public static final int STATUS_DELETED
See Also:
Constant Field Values
Constructor Detail

oDynaObject

public oDynaObject(oPersistenceManager iManager,
                   oOID iOid)
Create a dynamic object from an OID.

See Also:
#oPersistenceManager.setUsingDynaObjects

oDynaObject

public oDynaObject(oPersistenceManager iManager,
                   oOID iOid,
                   oBinary iStream)
Create a dynamic object from a stream object.

See Also:
#oPersistenceManager.setUsingDynaObjects

oDynaObject

public oDynaObject(oPersistenceManager iManager,
                   java.lang.String iClassName)
Create an empty dyna object of class iClass.

See Also:
#oPersistenceManager.setUsingDynaObjects

oDynaObject

public oDynaObject(oPersistenceManager iManager,
                   java.lang.String iClassName,
                   oBinary iStream)
Create a dyna object of embedded type

See Also:
#oPersistenceManager.setUsingDynaObjects
Method Detail

getManager

public oPersistenceManager getManager()
Get the PersistenceManager owner.

Returns:
oPersistenceManager instance

getStream

public oBinary getStream()
Get binary stream of serialized object.

Returns:
Binary stream with serialized object content

getOid

public oOID getOid()
Get the OID of dynamic object. If the object is new, then oid is null

Returns:
Object's OID

getMember

public oSysProperty getMember(java.lang.String iMemberName)
Get attribute information.

Parameters:
iMemberName - Member name
Returns:
oSysProperty object containing property information
See Also:
oSysProperty

getMembers

public java.util.Enumeration getMembers()
Get the enumeration containing attributes of current class and all base classes.

Returns:
Enumeration containing all class and base classes attributes
See Also:
getDeclaredMembers

getDeclaredMembers

public java.util.Enumeration getDeclaredMembers()
Get the enumeration containing all class attributes.

Returns:
Enumeration containing all class attributes
See Also:
getMembers

getFullClassName

public java.lang.String getFullClassName()
Get full name of class including package.

Returns:
full name of class
See Also:
getClassName()

getStatus

public int getStatus()
Get current status.
  • STATUS_NEW = 0
  • STATUS_EMBEDDED = 1
  • STATUS_LOADED = 2
  • STATUS_UPDATED = 3
  • STATUS_DELETED = 4

Returns:

getClassName

public java.lang.String getClassName()
Get the class name

Returns:
Class name
See Also:
getFullClassName()

setClassName

public void setClassName(java.lang.String iClassName)
Force class name setting.

Parameters:
iClassName - Class name

getValue

public java.lang.Object getValue(java.lang.String iMemberName)
Get the value of an attribute.

Parameters:
iMemberName - Member name
Returns:
The value of attribute. You may cast it by know the attribute type.
See Also:
getMember(java.lang.String)

setValue

public void setValue(java.lang.String iMemberName,
                     java.lang.Object iMemberValue)
Set the value for the attribute.

Parameters:
iMemberName - Member name
iMemberValue - New value to assign. The value must be coherent with the member type

store

public void store()
Store the object in datastore. If the object is new, then the object is created and the OID is assigned. Otherwise the object is updated.


delete

public void delete()
Delete the object persistently from datastore.


reset

public void reset()
Reset object information. The object becomes empty.


isNew

public boolean isNew()
Know if the object is new and is not yet persistent.

Returns:
TRUE if the object is new, otherwise FALSE

isValid

public boolean isValid()
Know if the object is valid.

Returns:
TRUE if the object is valid, otherwise FALSE