Skip to main content

IModel.AddNewModelTo 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

NameTypeDescription
fieldNamestringField name
Null or an empty string cannot be specified.
classNamestringclass name
Specify the name of the class or the fully qualified name.
Null or an empty string cannot be specified.
directionstringAddition direction
-"first": First
-"last": Last
-"before": Before
-"after": After
targetIModelAdditional reference model
Determine the additional position based on the model position specified here.
If the direction is specified as "first", it will be added to the beginning regardless of the reference model.
If the direction is specified as "last", it will be added to the end regardless of the reference model.
If the direction specification is "before", the instance will be added to the specified model position, and if it is "after", the instance will be added to the next position of the specified model.
fuzzyboolclassName 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

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionWhen 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
Specified as the criterion for the additional position. If the model is not included in the field value
Field not foundExtensionFieldNotFoundExceptionIf the specified field is not found in the metaclass of this instance
Illegal field accessExtensionIllegalFieldAccessExceptionWhen this method is executed for a field with a multiplicity limit of 1
Specified field invalidExtensionInvalidTypeExceptionWhen 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 foundExtensionTypeNotFoundExceptionIf the specified class cannot be found
Illegal operationExtensionInvalidOperationExceptionIf 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