Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add nullable attribute to a class in enterprise architect

I am using enterprise architect for UML. I need to generate code from the model. I need have a nullable double attribute in a class. I am able to add a double attribute but don't know how to make it nullable.

Do anyone have any idea how to add a nullable attribute.

like image 868
Vaibhav Jain Avatar asked Feb 18 '11 19:02

Vaibhav Jain


1 Answers

There is a small problems with your question, let me first answer the part about the EA, and get to it later.

In UML you denote nullable type as

  • +attributeName : TypeName [0..1]
  • +fromUser : User [0..1]

in EA this is done in the Multiplicity section Select the class->Hit F9->Select the attribute->Click detail

Lower bound and Upper bound are the fields you are looking for, if each are 1 this attribute has a single value [1] usually not depicted in the diagram

  • [0..1] can have a value of null.
  • [*] can have any amount of values.
  • [1..*] collection that contains at least one value
  • [n..m] collection that contains between n and m values. n and m are replaced by concrete numbers

in many languages double is a primitive/value type you can not make it null. If you need to, you have to use Double. Note the first letter is capital.

like image 148
Jan Avatar answered Sep 19 '22 03:09

Jan