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 att开发者_JS百科ribute 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.
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.
精彩评论