company logo

TypeDefinition :: collectionName - Get reference from structure definition

The function returns the name of the reference or relationship according to the given index. The reference index corresponds to the position of the reference within the virtual list of all references in the type definition.

Calling the function by increasing the index recursively will provide all references of the type definition including those from base types.

When calling the function with an invalid type definition, the function throws an exception.

... fragment ( TypeDefinition  &td) {

  int32         count = td.collectionNameCount();

  int32         i = 0;

  while ( i < count )

    printf(td.collectionName(i++,true,false);

}

Return value:  Property name ( odaba::String & )

The property name may contain a property path that consists of a sequence of property names. Not allowed are operation paths or path properties, i.e. the property name must consist of identifiers separated by dots (.), only.

In order to pass no property name, an empty string ( String() ) has to be passed.

Implementation details

odaba::String TypeDefinition  :: collectionName ( int32 iPosition, bool bCompletePath, bool bGeneric )

References in base types or embedded complex data types are returned as property paths (e.g. address.city when address is a complex attribute in Person and city is a reference in address). The leading part for base types (usually the type name) is displayed only when passing true for the bCompletePath option.

Generic attributes can be considered as references or as attributes. The bGeneric option defines whether generic attributes are considered as references (true) or not (false).

When an reference with the position passed in iPosition has been found, the function returns the property path to the reference, otherwise it throws an exception.

  • iPosition - Position in collection

    The position of an element in a collection is beginning with 0 for the first element.

  • bCompletePath - Complete path

    The full path option is used to request the property path including base structure names.

  • bGeneric - Generic attribute option

    The option allows considering generic attributes as references.