Skip to main content

IModel.SetFieldAt method

Namespace: NextDesign.Core

Description

Sets the specified value at the specified index position in the specified field of this instance. If a value that cannot be set in the specified field is specified, an exception will be thrown. An exception will not be thrown even if the field multiplicity upper limit constraint or path constraint is violated.

argument

NameTypeDescription
fieldNamestringField name
Null or an empty string cannot be specified.
valueobjectfield value
indexintPosition
Specify the index whose start position is 0.

Return value

  • void

Exception

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionWhen null or an empty string is specified for fieldName
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
Invalid index rangeExtensionOutOfRangeExceptionWhen 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
If a value that cannot be set in the specified field is specified forExtensionInvalidTypeExceptionvalue that does not match the field type
-Primitive type value or enumeration value is specified in the class type field.
-Incompatible class type specified
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
Circular referenceExtensionCircularReferenceExceptionWhen calling for a class-type owned field, if the argument value specifies the callee of this method or its ancestors
Invalid model specifiedExtensionInvalidModelExceptionWhen the deleted model or temporary proxy is specified in the field value

Annotation

Values that can be set depending on the field type

The values that can be set are determined by the field type as follows.

  • Primitive field (integer, real, boolean, string, rich text)

    It cannot be set with this method.

  • Enumerated fields

    It cannot be set with this method.

  • Class type field

    Class type fields can be set to an instance of the IModel interface and null.

    If a value of type IModel is specified, it will set the specified model instead of the model that was already set. At this time, the behavior differs depending on whether the field is owned or referenced.

    • If owned, move the model specified by the argument as a child of the model that called the method. It also deletes the model that has already been set.

    • For references, add a reference association with the model specified by the argument. It also removes the reference association that existed with the model that was already set. The model itself that has already been set will not be deleted.

      If null is specified, only the model that has already been set will be unset.

    • If owned, the model that has already been set will be deleted.

    • For references, delete the reference association that existed with the model that was already set. The model itself that has already been set will not be deleted.

      When null is specified, the specified th element is deleted and subsequent elements are padded.