Package com.db4o.internal
Class ObjectReference
- java.lang.Object
-
- com.db4o.internal.Identifiable
-
- com.db4o.internal.ObjectReference
-
- All Implemented Interfaces:
Activator,ObjectInfo
public class ObjectReference extends Identifiable implements ObjectInfo, Activator
A weak reference to an known object. "Known" ~ has been stored and/or retrieved within a transaction. References the corresponding ClassMetaData along with further metadata: internal id, UUID/version information, ...
-
-
Field Summary
Fields Modifier and Type Field Description int_hcHashcode-
Fields inherited from class com.db4o.internal.Identifiable
_id, _state
-
-
Constructor Summary
Constructors Constructor Description ObjectReference()ObjectReference(int id)ObjectReference(ClassMetadata classMetadata, int id)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(ActivationPurpose purpose)Method to be called to activate the host object.voidactivate(Transaction ta, java.lang.Object obj, ActivationDepth depth)voidactivateOn(Transaction transaction, ActivationPurpose purpose)ClassMetadataclassMetadata()voidclassMetadata(ClassMetadata classMetadata)ObjectContainerBasecontainer()voiddeactivate(Transaction trans, ActivationDepth depth)voidflagAsHandled(int callId)voidflagForDelete(int callId)longgetCommitTimestamp()The serial timestamp the object is assigned to when it is committed.
You need to enable this feature before using it inFileConfiguration.generateCommitTimestamps(boolean).
All the objects commited within the same transaction will receive the same commitTimestamp.
db4o replication system (dRS) relies on this feature.bytegetIdentifier()longgetInternalID()returns the internal db4o ID.java.lang.ObjectgetObject()returns the object that is referenced.java.lang.ObjectgetObjectReference()Db4oUUIDgetUUID()returns a UUID representation of the referenced object.longgetVersion()returns the transaction serial number ("version") the referenced object was stored with last.ObjectReferencehc_add(ObjectReference newRef)HCTREEObjectReferencehc_find(java.lang.Object obj)static inthc_getCode(java.lang.Object obj)ObjectReferencehc_remove(ObjectReference findRef)voidhc_traverse(Visitor4 visitor)ObjectReferenceid_add(ObjectReference newRef)IDTREEObjectReferenceid_find(int id)ObjectReferenceid_remove(ObjectReference ref)booleanisFlaggedAsHandled(int callID)booleanisFlaggedForDelete()booleanisValid()static booleanisValidId(int id)protected booleanobjectCanUpdate(Transaction transaction, java.lang.Object obj)intownLength()VirtualAttributesproduceVirtualAttributes()java.lang.Objectread(Transaction trans, ByteArrayBuffer buffer, java.lang.Object obj, ActivationDepth instantiationDepth, int addToIDTree, boolean checkIDTree)java.lang.ObjectreadPrefetch(Transaction trans, ByteArrayBuffer buffer, int addToIDTree)voidreadThis(Transaction trans, ByteArrayBuffer buffer)voidref_init()voidsetObject(java.lang.Object obj)voidsetObjectWeak(ObjectContainerBase container, java.lang.Object obj)voidsetVirtualAttributes(VirtualAttributes at)java.lang.StringtoString()Transactiontransaction()VirtualAttributesvirtualAttributes()VirtualAttributesvirtualAttributes(Transaction trans)VirtualAttributesvirtualAttributes(Transaction trans, boolean lastCommitted)voidwriteThis(Transaction trans, ByteArrayBuffer buffer)voidwriteUpdate(Transaction transaction, UpdateDepth updatedepth)-
Methods inherited from class com.db4o.internal.Identifiable
beginProcessing, endProcessing, getID, hashCode, isActive, isDirty, isNew, setID, setStateClean, setStateDeactivated, setStateDirty
-
-
-
-
Constructor Detail
-
ObjectReference
public ObjectReference()
-
ObjectReference
public ObjectReference(int id)
-
ObjectReference
public ObjectReference(ClassMetadata classMetadata, int id)
-
-
Method Detail
-
activate
public void activate(ActivationPurpose purpose)
Description copied from interface:ActivatorMethod to be called to activate the host object.- Specified by:
activatein interfaceActivator- Parameters:
purpose- for which purpose is the object being activated?ActivationPurpose.WRITEwill cause the object to be saved on the nextObjectContainer.commit()operation.
-
activateOn
public void activateOn(Transaction transaction, ActivationPurpose purpose)
-
activate
public void activate(Transaction ta, java.lang.Object obj, ActivationDepth depth)
-
deactivate
public void deactivate(Transaction trans, ActivationDepth depth)
-
getIdentifier
public byte getIdentifier()
-
getInternalID
public long getInternalID()
Description copied from interface:ObjectInforeturns the internal db4o ID.- Specified by:
getInternalIDin interfaceObjectInfo
-
getObject
public java.lang.Object getObject()
Description copied from interface:ObjectInforeturns the object that is referenced.
This method may return null, if the object has been garbage collected.- Specified by:
getObjectin interfaceObjectInfo- Returns:
- the referenced object or null, if the object has been garbage collected.
-
getObjectReference
public java.lang.Object getObjectReference()
-
container
public ObjectContainerBase container()
-
transaction
public Transaction transaction()
-
getUUID
public Db4oUUID getUUID()
Description copied from interface:ObjectInforeturns a UUID representation of the referenced object. UUID generation has to be turned on, in order to be able to use this feature:FileConfiguration.generateUUIDs(com.db4o.config.ConfigScope)- Specified by:
getUUIDin interfaceObjectInfo- Returns:
- the UUID of the referenced object.
-
getVersion
public long getVersion()
Description copied from interface:ObjectInforeturns the transaction serial number ("version") the referenced object was stored with last. Version number generation has to be turned on, in order to be able to use this feature:FileConfiguration.generateVersionNumbers(com.db4o.config.ConfigScope)
This feature was replaced byObjectInfo.getCommitTimestamp(). The main difference is that the old version mechanism used to assign a serial timestamp to the object upon storing time, and the new commitTimestamp approach, assigns it upon commit time.- Specified by:
getVersionin interfaceObjectInfo- Returns:
- the version number.
-
getCommitTimestamp
public long getCommitTimestamp()
Description copied from interface:ObjectInfoThe serial timestamp the object is assigned to when it is committed.
You need to enable this feature before using it inFileConfiguration.generateCommitTimestamps(boolean).
All the objects commited within the same transaction will receive the same commitTimestamp.
db4o replication system (dRS) relies on this feature.- Specified by:
getCommitTimestampin interfaceObjectInfo- Returns:
- the serial timestamp that was given to the object upon commit.
- See Also:
FileConfiguration.generateCommitTimestamps(boolean)
-
classMetadata
public final ClassMetadata classMetadata()
-
classMetadata
public void classMetadata(ClassMetadata classMetadata)
-
ownLength
public int ownLength()
-
produceVirtualAttributes
public VirtualAttributes produceVirtualAttributes()
-
read
public final java.lang.Object read(Transaction trans, ByteArrayBuffer buffer, java.lang.Object obj, ActivationDepth instantiationDepth, int addToIDTree, boolean checkIDTree)
-
readPrefetch
public java.lang.Object readPrefetch(Transaction trans, ByteArrayBuffer buffer, int addToIDTree)
-
readThis
public final void readThis(Transaction trans, ByteArrayBuffer buffer)
-
setObjectWeak
public void setObjectWeak(ObjectContainerBase container, java.lang.Object obj)
-
setObject
public void setObject(java.lang.Object obj)
-
flagForDelete
public void flagForDelete(int callId)
-
isFlaggedForDelete
public boolean isFlaggedForDelete()
-
flagAsHandled
public void flagAsHandled(int callId)
-
isFlaggedAsHandled
public final boolean isFlaggedAsHandled(int callID)
-
isValid
public final boolean isValid()
-
isValidId
public static final boolean isValidId(int id)
-
virtualAttributes
public VirtualAttributes virtualAttributes()
-
virtualAttributes
public VirtualAttributes virtualAttributes(Transaction trans, boolean lastCommitted)
-
virtualAttributes
public VirtualAttributes virtualAttributes(Transaction trans)
-
setVirtualAttributes
public void setVirtualAttributes(VirtualAttributes at)
-
writeThis
public void writeThis(Transaction trans, ByteArrayBuffer buffer)
-
writeUpdate
public void writeUpdate(Transaction transaction, UpdateDepth updatedepth)
-
objectCanUpdate
protected boolean objectCanUpdate(Transaction transaction, java.lang.Object obj)
-
ref_init
public void ref_init()
-
hc_add
public ObjectReference hc_add(ObjectReference newRef)
HCTREE
-
hc_find
public ObjectReference hc_find(java.lang.Object obj)
-
hc_getCode
public static int hc_getCode(java.lang.Object obj)
-
hc_remove
public ObjectReference hc_remove(ObjectReference findRef)
-
hc_traverse
public void hc_traverse(Visitor4 visitor)
-
id_add
public ObjectReference id_add(ObjectReference newRef)
IDTREE
-
id_find
public ObjectReference id_find(int id)
-
id_remove
public ObjectReference id_remove(ObjectReference ref)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-