Set unique names
We can set unique names for resources.
To set the unique name for a resource...
- Obtain a modifiable instance of the resource for which to set the unique name.
- Check whether the resource implements the ModifiableIdentifiable interface. To do this, use the operator instanceof. If the resource does not implement the ModifiableIdentifiable interface, we cannot modify it.
- Obtain a modifiable instance of the resource object ID, that is ModifiableObjectID. To do this, use the getModifiableObjectID.
- Set the unique name using the setUniqueName() method of the ModifiableObjectID.
Example
Example - Setting unique names:final Modifiable modifiable = controller.getModifiableNode(node); // Obtain modifiable instance of the resource's object id. Note that modifiable // instances of all model nodes implement the ModifiableIdentifiable interface final ModifiableObjectID modifiableObjectID = ((ModifiableIdentifiable) modifiable).getModifiableObjectID(); modifiableObjectID.setUniqueName("MyUniqueName");
Parent Modify properties