public class CreateAttributeFragment extends com.sodius.mdw.internal.metamodel.doors.io.commands.CreateAttributeFragmentImpl implements EditModuleFragment
This fragment is intended to be combined into an EditModuleCommand
instance.
Below is a snippet illustrating how to use this fragment (see CommandRunner
for a full snippet):
ModuleRef module = ModuleRef.qualifiedName("/MyFolder/MyModule"); EditModuleCommand command = new EditModuleCommand(module, TerminationMode.SAVE_AND_CLOSE); command.add(new CreateAttributeFragment("myAttribute", "Real", Scope.OBJECT)); command.add(new CreateAttributeFragment("aSecondOne", "String", Scope.MODULE)); myCommandRunner.run(command);
When detailed properties need to be assigned the to attribute definition, a builder can be used to instantiate a
CreateAttributeFragment
:
CreateAttributeFragment fragment = CreateAttributeFragment.builder("myAttribute", "Integer", Scope.OBJECT) .defaultValue(10) .alterChangeBars(false); .create();
This class is not intended to be subclassed by clients but may be instantiated.
CommandRunner
,
EditModuleCommand
,
SetAttributeValueFragment
Modifier and Type | Class and Description |
---|---|
static class |
CreateAttributeFragment.Builder
Builds an instance of
CreateAttributeFragment with detailed properties. |
static class |
CreateAttributeFragment.Scope
Determines on which type of element an attribute is available.
|
Constructor and Description |
---|
CreateAttributeFragment(String name,
String type,
CreateAttributeFragment.Scope scope)
Instantiates a fragment to create a new attribute definition in a DOORS module.
|
Modifier and Type | Method and Description |
---|---|
static CreateAttributeFragment.Builder |
builder(String name,
String type,
CreateAttributeFragment.Scope scope)
Instantiates a builder which enables to create a
CreateAttributeFragment with detailed properties. |
public CreateAttributeFragment(String name, String type, CreateAttributeFragment.Scope scope)
Use the builder()
method if detailed properties needs to be assigned to the created attribute: a DXL code, whether it is
multi-valued, etc.
name
- the name of the attribute to create.type
- the DOORS type of the attribute to create (e.g. "String"
, "Real"
, etc.)scope
- the type of element on which the attribute is available:
on the module, on the objects, or on the module and the objects.builder(String, String, Scope)
public static CreateAttributeFragment.Builder builder(String name, String type, CreateAttributeFragment.Scope scope)
CreateAttributeFragment
with detailed properties.name
- the name of the attribute to create.type
- the DOORS type of the attribute to create (e.g. "String"
, "Real"
, etc.)scope
- the type of element on which the attribute is available:CreateAttributeFragment
instance.