OCLOperators Size () : Integer
This page was created by Peter on 2019-11-25. Last edited by Wikiadmin on 2026-07-29.
Use size() in an OCL or EAL expression when you need an Integer count of the elements in a collection.
Syntax
collection->size()
object.size()
The result is an Integer.
Example
The following expression counts the orders associated with the first customer:
Customer.allInstances->first.Orders->size()
In this expression:
Customer.allInstancesreturns the customers in the system.->firstselects the first customer..Ordersfollows that customer'sOrdersassociation.->size()returns the number of order objects in that collection.
Behavior for a single object
If the operand is not already a list, MDriven treats it as a list containing that one element before counting it. The operator is designed to be null-safe in the MDriven/EAL environment.
For the complete operator definition and collection behavior, see size().
