PropertyHandle :: CreateAttribute - Create attribute extension
The function allows creating ad hoc properties to the property handle. The property definition is passed in vExpression . The property definition must follow the rules for a parameter specification ( parm_spec ) as being defined in ODL. Property definitions may refer to simple or complex attributes or reference collections.
The property definition at least requires a data type (e.g. " string name" or "SET< Person > friends" ). The property must not yet exist in the data type definition for the property handle or in one of its generalizations or extensions. Attribute extensions may be defined with or without data source (assignment expression) and as static or non-static properties. When defining a data source, the extension property will be evaluated always when being accessed.
After being created, extension properties may be referred to as regular properties in OSI functions or expressions and other property access functions (e.g. value() or property() ).
After creating an attribute extension for a property handle, it becomes a member of the current property handle, but not a member of the property's type definition. In order to remove an attribute extension, one may call removeAttributeExtension() .
When the property handle is not valid or when the attribute definition is invalid, the function throws an exception.
// add age_grup a Person type property handle
createAttributeExtension("static int sum_age");
createAttributeExtension("static int pcount = count");
createAttributeExtension("STRING(10) agegroup = ( age <= 20 ? 'young' :
age <= 60 ? 'medium': 'old')");
Implementation details
- nexpression - - internal feature (not documented)