Skip to main content

IModel.AddNewModelAt method

Namespace: NextDesign.Core

Description

Adds an instance of the specified class at the specified add position as a field value to the specified field of this instance.
Allows instantiation even if the specified class is an abstract class, and adds it as a field value at the specified position.
The specified field must be an owning field of the class type.
Note that no exception is thrown even if the upper multiplicity constraint of a field with a multiplicity of 2 or greater is violated.

The class name you specify must specify a type that is compatible with the data type of the field.
Also, when doing a fuzzy match, if there are multiple matching classes, add the instance of the first type-compatible class found.

argument

NameTypeDescription
fieldNamestringField name
You cannot specify null or an empty string.
classNamestringClass Name
Specify the name or fully qualified name of the class.
Null or empty string cannot be specified.
directionstringAdditional direction
- "first" : beginning
- "last" : end
- "before" : before
- "after" : after
indexintAdditional reference position
Specifies the index with 0 as the starting position.
If direction is specified as "first", it will be added to the beginning regardless of the index value.
If the direction is "last", it will be added to the end regardless of the index value.
If the direction is "before", add the instance at the specified position, and if it is "after", add the instance at the next position after the specified position.
Whether to treat thefuzzybool

Return value

Exceptions

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionIf null or an empty string is specified for fieldName or className
If a string other than the default string is specified for direction
Field not foundExtensionFieldNotFoundExceptionIf the specified field is not found in this instance's metaclass
Illegal field accessExtensionIllegalFieldAccessExceptionIf this method is executed for a field with a maximum multiplicity of 1
Invalid index rangeExtensionOutOfRangeExceptionWhen a negative number is specified for index
or when a value greater than the number of elements in the corresponding field is specified for index
Specified field is invalidExtensionInvalidTypeExceptionIf a value that cannot be set in the specified field is specified
- The specified field is not an owned field
- The data type of the specified field is not a class type< br/>- the type of the specified field and the specified class are incompatible
Class not foundExtensionTypeNotFoundExceptionIf the specified class is not found
Illegal operationExtensionInvalidOperationExceptionIf the model itself is a deleted model or a temporary proxy
If an inoperable field is specified in the field name
- Product line feature assignment field
- System. Fields tagged with Core