IModel.AddNewModelAt method
Namespace: NextDesign.Core
Description
Adds an instance of the specified class as a field value to the specified field of this instance by specifying the additional position. Allows instantiation even if the specified class is an abstract class and adds it as a field value at the specified position. The field you specify must be a class-owned field. Note that no exception is thrown if the multiplicity upper bound constraint for a field with a multiplicity of 2 or more is violated.
The class name you specify must be a type that is compatible with the data type of the field. Also, when making an ambiguous match, if there are multiple matching classes, add the first instance of the type-compatible class found.
argument
Name | Type | Description |
---|---|---|
fieldName | string | Field name Null or an empty string cannot be specified. |
className | string | class name Specify the name of the class or the fully qualified name. Null or an empty string cannot be specified. |
direction | string | Addition direction -"first": First -"last": Last -"before": Before -"after": After |
index | int | Additional reference position Specify the index with the start position as 0. If the direction is specified as "first", it will be added to the beginning regardless of the index value. If the direction is specified as "last", it will be added to the end regardless of the index value. If the direction specification is "before", the instance will be added to the specified position, and if it is "after", the instance will be added to the position next to the specified position. |
fuzzy | bool | className Whether to treat the argument as a class name rather than a fully qualified name. If False, evaluate as specifying a class whose fully qualified name matches className. If True, evaluate as specifying a class whose class name matches className. The default value is True. |
Return value
Exception
Name | Exception Class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | When null or an empty string is specified for fieldName or className When a character string other than the default character string is specified for direction |
Field not found | ExtensionFieldNotFoundException | If the specified field is not found in the metaclass of this instance |
Illegal field access | ExtensionIllegalFieldAccessException | When this method is executed for a field with a multiplicity limit of 1 |
Invalid index range | ExtensionOutOfRangeException | When a negative number is specified for index or when a value greater than or equal to the number of elements in the corresponding field is specified for index |
Specified field invalid | ExtensionInvalidTypeException | When a value that cannot be set for the specified field is specified -The specified field is not a owned field -The data type of the specified field is not a class type br/>-The specified field type and the specified class are incompatible |
Class not found | ExtensionTypeNotFoundException | If the specified class cannot be found |
Illegal operation | ExtensionInvalidOperationException | If it is a deleted model or temporary proxy If an inoperable field is specified in the field name -Product line feature assignment field -System. Fields with Core tags |