Skip to content

TBoldAttribute

Superclass to all attribute classes in Bold

Unit: BoldSystem

Declaration

TBoldAttribute = class(TBoldMember)

Hierarchy

  1. TObject
  2. TBoldMemoryManagedObject
  3. TBoldFlaggedObject
  4. TBoldSubscribableObject
  5. TBoldElement
  6. TBoldDomainElement
  7. TBoldMember
  8. TBoldAttribute
  9. Direct subclasses
  10. TBABlob
  11. TBAMoment
  12. TBANumeric
  13. TBAString
  14. TBAValueSet

Description

Attributes are used for two different purposes.

First of all they are used to be attributes of business objects (subclasses of TBoldObject). In this role they can be persistent, or transient, they can also be derived (calculated). When used as the attribute of a business object, the property BoldAttributeRTInfo will always be assigned, and indicate the role of the attribute in the model.

TBoldAttribute can also be created independent of a business object. This happens frequently when OCL expressions are evaluated, and the result is a calculated value (concatenation of two strings for example). It is also allowed to call the constructor of a concrete subclass of TBoldAttribute. Often however when attributes are used stand-alone, it is more convenient to use the TBoldVariableHandle, or the TBoldMemberFactory to create the attribute-object.

Every subclass of TBoldAttribute has its own internal data, and usually it has an access-property to read and write the contents of the attribute object in the native format. Most attribute types also implement the AsString property to allow reading and writing the string representation of the attribute.

To subclass TBoldAttribute, the easiest way is to use the Attribute-wizard found in the Bold menu in the Delphi/C++Builder IDE.

Properties

Name Summary Notes
BoldAttributeRTInfo read-only
ContentIsNull Bold-internal check for NULL protected, read-only
IsNull If the attribute has the special 'empty' value NULL. read-only

BoldAttributeRTInfo

property BoldAttributeRTInfo: TBoldAttributeRTInfo;

This property is the same as BoldMemberRTInfo, but downcasted to TBoldAttributeRTInfo.

ContentIsNull

property ContentIsNull: Boolean;

Bold-internal variant of IsNull

IsNull

property IsNull: Boolean;

Note that Null is a special value and that it in most cases is an error to access the basic representation of the attribute, e.g. AsInteger, if IsNull is True.

An attribute can be set to Null with SetToNull. An attribute is set to a non-Null value by setting the value.

Methods

Name Summary Notes
Assign Overridden from Assign override
AssignContentValue Assigns the internal value protected, abstract
AssignValue Assigns the internal state protected, abstract
CanSetToNull
CompareToAs Overriddden from CompareToAs override
DefaultSubscribe Subscribes to default events on the attribute. override
DoSetInitialValue Bold-internal protected, override
EitherIsNull True if IsNull is true for either of the arguments. protected
EnsureNotNull Called by subclasses to guard against NULL values. protected
FormatFailure Convenience function for subclasses for setting the failure reason. protected
GetContentIsNull Get-method for ContentIsNull property protected
GetStreamName Overrides TBoldMember.GetStreamName protected, override
IsEqualToValue Overrides TBoldMember.IsEqualToValue. override
NullBiggest Internal convenience method for comparing NULL values. protected
NullSmallest Internal convenience method for comparing NULL values. protected
ProxyInterface Overrides TBoldDomainElement.ProxyInterface. override
RecycleValue Bold-internal
SetContentToNull Sets the internal data value to NULL. protected
SetEmptyValue Set the attribute to an 'empty' value virtual
SetToNonNull Set the attribute to a non-null value. protected
SetToNull Sets the attribute to the special value Null. virtual
SubscribeToStringRepresentation Overrides TBoldElement.SubscribeToStringRepresentation override

Assign

procedure Assign(Source: TBoldElement); override; See also Ancestor Method

Overridden from Assign

AssignContentValue

procedure AssignContentValue(Source: IBoldValue); virtual; abstract;

This is an internal assigning method. It sets the internal data value of the attribute only.

AssignValue

procedure AssignValue(Source: IBoldValue); virtual; abstract;

This is an internal assigning method. It sets the internal data value of the attribute and the persistence state from the source value.

CanSetToNull

function CanSetToNull(Subscriber: TBoldSubscriber): Boolean;

Returns True if the member may be set to Null. A programmer can disallow reading a member by subscribing to the bqMaySetToNull query. If a Subscriber is passed to the function, subscriptions will be placed to notify when the result of MaySetToNull may have changed. The mode information for the attribute may indicate that the attribute is not allowed to be set to null.

CompareToAs

function CompareToAs(CompType: TBoldCompareType; BoldElement: TBoldElement): Integer; override; See also Ancestor Method

Overriddden from CompareToAs

DefaultSubscribe

procedure DefaultSubscribe(Subscriber: TBoldSubscriber; RequestedEvent: TBoldEvent = breReEvaluate); override; See also Ancestor Method

Subscribes to default events on the attribute. This will give a subscription on beValueChanged.

See Also

  • Subscriptions

DoSetInitialValue

procedure DoSetInitialValue; override; See also Ancestor Method

Bold-internal

EitherIsNull

class function EitherIsNull(Attribute1, Attribute2: TBoldAttribute): Boolean;

True if IsNull is true for either of the arguments.

EnsureNotNull

procedure EnsureNotNull;

Called by subclasses to guard against NULL values. If the attribute is NULL the exception EBoldAccessNullValue is raised.

FormatFailure

procedure FormatFailure(const value, ExpectedDataType: String);

Convenience function for subclasses for setting the failure reason. See SetBoldLastFailureReason.

GetContentIsNull

function GetContentIsNull: Boolean;

Get-method for ContentIsNull property

GetStreamName

function GetStreamName: string; override; See also Ancestor Method

Overrides GetStreamName

IsEqualToValue

function IsEqualToValue(Value: IBoldValue): Boolean; override; See also Ancestor Method

Overrides IsEqualToValue.

NullBiggest

function NullBiggest(BoldElement: TBoldElement): Integer;

Internal convenience method for comparing NULL values. NULL is considered bigger than any other value.

NullSmallest

function NullSmallest(BoldElement: TBoldElement): Integer;

Internal convenience method for comparing NULL values. NULL is considered smaller than any other value.

ProxyInterface

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

Overrides ProxyInterface.

RecycleValue

procedure RecycleValue;

Bold-internal

SetContentToNull

procedure SetContentToNull;

Sets the internal data value to NULL. Used by subclasses and persistence mechanisms. To set an attribute to NULL normally, use SetToNull.

SetEmptyValue

procedure SetEmptyValue; virtual;

All attributes (descendents of TBoldAttribute), such as TBAString, should implement this method and set the value of the attribute to an 'empty' value, such as an empty string or zero. This is to support the assign operation with no source argument.

SetToNonNull

procedure SetToNonNull;

This method should only be called by descendents of TBoldAttribute, such as TBAString, in the implementation of the Set-method(s) when the attribute is set to a non-NULL value.

SetToNull

procedure SetToNull; virtual;

Sets the attribute to the special value Null. This requires that AllowNull for the attribute is True in the model. See also CanSetToNull.

See Also

  • Related Topics

SubscribeToStringRepresentation

procedure SubscribeToStringRepresentation(Representation: TBoldRepresentation; Subscriber: TBoldSubscriber; RequestedEvent: TBoldEvent = breReEvaluate); override; See also Ancestor Method

This is equivalent to calling DefaultSubscribe unless overridden by a concrete subclass.

See Also

  • Subscriptions

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.