Skip to content

TBoldMember

The members of Bold objects are of the type TBoldMember.

Unit: BoldSystem

Declaration

TBoldMember = class(TBoldDomainElement)

Hierarchy

  1. TObject
  2. TBoldMemoryManagedObject
  3. TBoldFlaggedObject
  4. TBoldSubscribableObject
  5. TBoldElement
  6. TBoldDomainElement
  7. TBoldMember
  8. Direct subclasses
  9. TBoldAttribute
  10. TBoldList
  11. TBoldObjectReference

Description

The members of Bold objects are of the type TBoldMember. But a TBoldMember doesn't have to belong to a Bold object. It can be, and is often, used as a standalone variable or constant. In that case, its BoldMemberRtInfo and OwningObject properties are **nil**.

Properties

Name Summary Notes
AsIBoldValue The IBoldValue interface. read-only
BoldMemberRTInfo The model information for the member read-only
BoldPersistenceState The relationship between the member's value in memory and in the persistent storage.
BoldSystem The BoldSystem that the member belongs to. read-only
Derived Indicates if the member is derived. read-only
Deriver There is normally no need for the programmer to access the deriver directly. read-only
IsPartOfSystem Indicates if the member is part of a BoldSystem. read-only
OldValue Bold-internal read-only
OwningObject The Bold object the member is a member of. read-only
Touched Bold-internal read-only

AsIBoldValue

property AsIBoldValue[Mode:TBoldDomainElementProxyMode]: IBoldValue;

Use this property to get the IBoldValue for the member. This is used internally.

BoldMemberRTInfo

property BoldMemberRTInfo: TBoldMemberRTInfo;

If the TBoldMember is a member of a Bold object, the BoldMemberRTInfo property will be assigned. It contains the model information for the member.

BoldPersistenceState

property BoldPersistenceState: TBoldValuePersistenceState;

The persistence state of a Bold member reflects the relationship between its value in memory and in the persistent storage. It tells us which of the two is the most recent.

If the state of a member is bvpsInvalid it means that the value in memory is not correct. It will be fetched automatically when the member is accessed. After the value has been fetched the state will become bvpsCurrent, meaning that the value in memory is the same as the value in the persistent storage. If the value of the member is changed in memory the state will change to bvpsModified, implying that the new value should be written to the persistent storage. Finally, the bvpsTransient state tells us that the member only exists in memory, either because the object it belongs to is transient, or because the member is marked as transient in the model.

Calling Invalidate makes a member 'forget' that it has been fetched. This changes its state from bvpsCurrent to bvpsInvalid. It is not allowed to invalidate members in bvpsModified state. Similarly, Discard makes a member 'forget' that it has been modified. It changes it from bvpsModified to bvpsInvalid.

Finally, members can change state from bvpsTransient to bvpsModified. This happens automatically if the object the member belongs to becomes persistent. See TBoldObject.BoldMakePersistent.

Before a member's value is modified in memory the method CanModify is called to see if modifying the member is allowed. CanModify, among other things, checks the virtual MayModify method and the bqMayModify query-event. If the modification is allowed the virtual PrepareModify method is called and the event bePrepareModify is sent. After the value has been changed the virtual method CompleteModify is called and the event beCompleteModify is sent.

BoldSystem

property BoldSystem: TBoldSystem;

For a member that is part of a Bold object, this is the system that the object belongs to. For standalone members, it is **nil**.

Derived

property Derived: Boolean;

Indicates if the member is derived.

Deriver

property Deriver: TBoldEventPluggedDeriver;

There is normally no need for the programmer to access the deriver directly.

IsPartOfSystem

property IsPartOfSystem: Boolean;

If IsPartOfSystem is true, the BoldSystem property is valid. If not, accessing BoldSystem will raise an exception.

OldValue

property OldValue: IBoldValue;

Bold-internal.

OwningObject

property OwningObject: TBoldObject;

Returns the Bold object the member is a member of. If the member is not member of a Bold object, the function returns **nil**.

Touched

property Touched: Boolean;

Bold-internal

Methods

Name Summary Notes
AtTime virtual
CanModify If the member is allowed to be modified
CanRead Indicates if the value of the member may be read
CanUpdate If the member is allowed to be updated
Changed Called internally when the value of the member has changed. protected
Clone Makes a copy of the member.
CloneIfPossible This will create a clone of the member and copy the contents. protected, override
CompleteModify Occurs directly after the member is modified. protected, virtual
CompleteUpdate Virtual method that is called after a member has been updated in the persistent storage protected, virtual
Create Creates an element that is not part of a Bold object.
CreateWithTypeInfo Constructor with Bold type information
Destroy Destructor override
Discard Discards changes in memory
DoStartModify Bold-internal method that performs preparations needed before modifying the value of a member. protected
EndModify Called by member subclasses after the value has been modified. protected
EnsureContentsCurrent If the value of the member is not current, make it current.
FailModify Called by member subclasses if a modification fails. protected
FreeContent Releases the memory used for the data value. protected, virtual
GetAsList Overrides TBoldElement.GetAsList override
GetAsValue Bold-internal override
GetBoldDirty Overrides TBoldDomainElement.GetBoldDirty protected, override
GetBoldPersistenceState Get-method for the BoldPersistenceState property protected
GetBoldType Overrides TBoldElement.GetBoldType protected, override
GetDisplayName Overrides TBoldElement.GetDisplayName protected, override
GetEvaluator Overrides TBoldElement.GetEvaluator protected, override
GetStreamName Name that identifies the type of the object for the streaming mechanisms. protected, virtual
InitializeMember Bold-internal protected, virtual
Invalidate
IsEqualToValue Similar to IsEqual, but compares with a IBoldValue. virtual
MayModify Override this function and return false to prohibit the modify state transition. protected, virtual
MayUpdate Override this function and return false to prohibit the update state transition. protected, virtual
MemberHasSubscribers True if there is anything subscribing to the member.
ObserverMayModify override
PreChange Called by subclasses before the data value changes. protected
PrepareModify Override this method to add behaviour before a member is modified. protected, virtual
PrepareUpdate Override this method to add behaviour before a member is saved to persistent storage. protected, virtual
ProxyClass The Delphi class used by ProxyInterface protected, abstract
ProxyInterface Overrides TBoldElement.ProxyInterface override
Refetch Fetches the value from persistent storage.
RetrieveProxyInterface Internal. Called by subclasses. protected
SetBoldPersistenceState Bold-internal. Sets the persistence state. protected
StartModify protected, virtual
StateError Overrides TBoldDomainElement.StateError protected, override
StoreInUndo Bold-internal

AtTime

function AtTime(Time: TBoldTimestampType): TBoldMember; virtual;

Returns the member as it looked at the time point identified by the Time time stamp.

Note
This feature is only available in the Object Versioning Extension to Bold for Delphi.

CanModify

function CanModify: Boolean;

Returns True if the member is allowed to be modified. A programmer can disallow modify either by overriding the virtual MayModify function or subscribing to the bqMayModify query.

CanRead

function CanRead(Subscriber: TBoldSubscriber): Boolean;

Returns True if the value of the member may be read. A programmer can disallow reading a member by subscribing to the bqMayRead query. If a Subscriber is passed to the function, subscriptions will be placed to notify when the result of MayRead may have changed.

CanUpdate

function CanUpdate: Boolean;

Returns True if the member is allowed to be updated. A programmer can disallow update either by overriding the virtual MayUpdate function or subscribing to the bqMayUpdate query.

Changed

procedure Changed(Event: TBoldEvent; const Args: array of const);

This method shall be called whenever the contents (technical value) of the member has changed. The Event and Args parameters should contain the values corresponding to a call to SendExtendedEvent. The event will be sent unless BoldPersistenceState is bvpsInvalid.

It is important that all subclasses to TBoldMember, i.e. custom attributes call this method.

Clone

function Clone: TBoldMember;

Makes a copy of the member. The resulting member will be of the same type and will contain the same value as the original.

CloneIfPossible

function CloneIfPossible: TBoldElement; override; See also Ancestor Method

This will create a clone of the member and copy the contents.

CompleteModify

procedure CompleteModify; virtual;

Override this method to add behaviour after a member is modified. The default implementation is empty.

See Also

  • TBoldValuePersistenceState

CompleteUpdate

procedure CompleteUpdate; virtual;

Override this method to add behaviour after a member is updated in the persistent storage. The default implementation is empty.

Create

constructor Create;

Contructor for member. Will create a member that is freestanding from any Bold object or system.

CreateWithTypeInfo

constructor CreateWithTypeInfo(ElementTypeInfo: TBoldElementTypeInfo);

As TBoldMember is an abstract class, CreateWithTypeInfo should not be called directly on TBoldMember, but on one of its concrete subclasses. Use this constructor instead of Create to explicitly specify the type info for the member. This is useful for creating members with types that are not in the default BoldSystem.

Destroy

destructor Destroy; override; See also Ancestor Method

Destructor

Discard

procedure Discard;

If any changes have been made to the member since it was fetched from persistent storage, or updated to persistent storage, these changes will be lost. This means that a member with BoldPersistenceState = bvpsModified will have its persistence state changed to bvpsInvalid.

DoStartModify

procedure DoStartModify;

Bold-internal method that performs preparations needed before modifying the value of a member.

EndModify

procedure EndModify;

Triggers the EndModify state transition. EndModify will be called automatically when a member is modified.

See Also

  • TBoldValuePersistenceState

EnsureContentsCurrent

procedure EnsureContentsCurrent;

If the value of the member is not current, make it current. A persistent member will be fetched, and a derived attribute will be derived.

FailModify

procedure FailModify;

Triggers the FailModify state transition. FailModify will be called automatically when a modify operation fails.

See Also

  • TBoldValuePersistenceState

FreeContent

procedure FreeContent; virtual;

This method is implemented by memory consuming subclasses, such as blob attributes and multilinks, to release memory. It will be called when the value is not needed any more.

GetAsList

procedure GetAsList(ResultList: TBoldIndirectElement); override; See also Ancestor Method

Sets ResultList to point to a TBoldMemberList containing the member.

GetAsValue

procedure GetAsValue(ResultElement: TBoldIndirectElement); override; See also Ancestor Method

Bold-internal. Overrides GetAsValue.

GetBoldDirty

function GetBoldDirty: Boolean; override; See also Ancestor Method

Overrides GetBoldDirty. A member is dirty if its persistence state is bvpsModified; if its value has been modified in memory.

GetBoldPersistenceState

function GetBoldPersistenceState: TBoldValuePersistenceState;

Get-method for the BoldPersistenceState property

GetBoldType

function GetBoldType: TBoldElementTypeInfo; override; See also Ancestor Method

Overrides TBoldElement.GetBoldType

GetDisplayName

function GetDisplayName: String; override; See also Ancestor Method

Overrides GetDisplayName. The display name for a member that is part of a Bold object is ".".

GetEvaluator

function GetEvaluator: TBoldEvaluator; override; See also Ancestor Method

Overrides GetEvaluator. If the member belongs to a system, that system's evaluator is used.

GetStreamName

function GetStreamName: string; virtual;

Name that identifies the type of the object for the streaming mechanisms.

InitializeMember

procedure InitializeMember(AOwningElement: TBoldDomainElement; ElementTypeInfo: TBoldElementTypeInfo); virtual;

Bold-internal

Invalidate

procedure Invalidate;

Call this method if you beleive that the value of the member may have changed in the persistent storage. This will cause the member to be refetched the next time its value is accessed. Members with BoldValuePersistenceState = bvpsCurrent will have their persistence state changed to bvpsInvalid. Calling Invalidate on modified or transient members will cause an exception to be raised.

IsEqualToValue

function IsEqualToValue(Value: IBoldValue): Boolean; virtual;

Similar to IsEqual, but compares with an IBoldValue.

MayModify

function MayModify: Boolean; virtual;

Override this function and return false to prohibit the modify state transition. See also CanModify and StartModify.

MayUpdate

function MayUpdate: Boolean; virtual;

Override this function and return false to prohibit the update state transition. See also CanUpdate.

MemberHasSubscribers

function MemberHasSubscribers: Boolean;

True if there is anything subscribing to the member. See Subscription.

ObserverMayModify

function ObserverMayModify(Observer: TObject): Boolean; override; See also Ancestor Method

Overrides ObserverMayModify

PreChange

procedure PreChange;

Called by subclasses before the data value changes.

PrepareModify

procedure PrepareModify; virtual;

Override this method to add behaviour before a member is modified. The default implementation is empty.

See Also

  • TBoldValuePersistenceState

PrepareUpdate

procedure PrepareUpdate; virtual;

Override this method to add behaviour before a member is saved to persistent storage. The default implementation is empty.

See Also

  • TBoldValuePersistenceState

ProxyClass

function ProxyClass: TBoldMember_ProxyClass; virtual; abstract;

The Delphi class used by ProxyInterface. Implemented by subclasses.

ProxyInterface

function ProxyInterface(const IId: TGUID; Mode: TBoldDomainElementProxyMode; out Obj): Boolean; override; See also Ancestor Method

Overrides ProxyInterface.

Refetch

procedure Refetch;

Fetches the value from persistent storage regardless of whether the member is already fetched. This does not discard the value of a modified member. Modified members are not affected by a call to Refetch.

RetrieveProxyInterface

function RetrieveProxyInterface(const IId: TGUID; Mode: TBoldDomainElementProxyMode; out Obj; const InterfaceName: string): Boolean;

Internal. This method is called by subclasses to implement ProxyInterfaces.

SetBoldPersistenceState

procedure SetBoldPersistenceState(Value: TBoldValuePersistenceState);

Bold-internal. Sets the persistence state. Normally there is no need to call this method.

StartModify

function StartModify: Boolean; virtual;

Triggers the StartModify state transition. StartModify will be called automatically before a member is updated. The result will be True if the state transition was succesful. CanModify will return the same value as StartModify without performing the state transition.

See Also

  • TBoldValuePersistenceState

StateError

procedure StateError(S: String); override; See also Ancestor Method

Overrides TBoldDomainElement

StoreInUndo

function StoreInUndo: Boolean;

Bold-internal. Used by the undo-mechanism.


Generated from the Bold 4.0 help (Help/BfD.chm) by Tools/chm2mkdocs.py; member lists reflect Bold 4.0, see the source for members added since.