Anotation “NonNull” in UML?
Android Studio is showing the annotation
`@NonNull`
, how can we represent this in UML?
Similarly, how is there a standard to display annotations?
java
add a comment |
Android Studio is showing the annotation
`@NonNull`
, how can we represent this in UML?
Similarly, how is there a standard to display annotations?
java
add a comment |
Android Studio is showing the annotation
`@NonNull`
, how can we represent this in UML?
Similarly, how is there a standard to display annotations?
java
Android Studio is showing the annotation
`@NonNull`
, how can we represent this in UML?
Similarly, how is there a standard to display annotations?
java
java
asked Jan 18 at 13:42
EvOlaNdLuPiZEvOlaNdLuPiZ
11410
11410
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
If you set the multiplicity of your attribute to [1] it becomes not nullable.
- someAttribute : int [1]
And since 1 is the default multiplicity for attributes you can also leave the multiplicity undefined.
- someAttribute : int
In order to allow for null you have to explicitly set the lowerbound to 0
- someAttribute : int [0..1]
See UML 2.5 specification chapter 9.5.4 (Property.Notation)
<multiplicity-range>is the multiplicity range of the Property. If this term is omitted, it implies a multiplicity
of 1 (exactly one). (See MultiplicityElement – sub clause 7.5.)
can you please cite the reference so I can search for more information, the answer will also lead my search on other annotations for platforms like Android Studio, Netbeans, thank you.
– EvOlaNdLuPiZ
Jan 18 at 16:37
1
I've seen code generators that will not emit an attribute for unspecified multiplicity, and [CanBeNull] on 0..1 and [NotNull] on 1, so depending on your conventions and workflow leaving it undefined may not be equivalent.
– Pete Kirkham
Jan 18 at 17:03
@PeteKirkham well then those code generators are clearly ignoring the UML standard with regards to the default value for the the multiplicity of a property.
– Geert Bellekens
Jan 18 at 17:58
add a comment |
A NotNull attribute indicates that the property or association end must be present.
This is equivalent to having a multiplicity of 1 rather than 0..1 or an unspecified multiplicity.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54255246%2fanotation-nonnull-in-uml%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you set the multiplicity of your attribute to [1] it becomes not nullable.
- someAttribute : int [1]
And since 1 is the default multiplicity for attributes you can also leave the multiplicity undefined.
- someAttribute : int
In order to allow for null you have to explicitly set the lowerbound to 0
- someAttribute : int [0..1]
See UML 2.5 specification chapter 9.5.4 (Property.Notation)
<multiplicity-range>is the multiplicity range of the Property. If this term is omitted, it implies a multiplicity
of 1 (exactly one). (See MultiplicityElement – sub clause 7.5.)
can you please cite the reference so I can search for more information, the answer will also lead my search on other annotations for platforms like Android Studio, Netbeans, thank you.
– EvOlaNdLuPiZ
Jan 18 at 16:37
1
I've seen code generators that will not emit an attribute for unspecified multiplicity, and [CanBeNull] on 0..1 and [NotNull] on 1, so depending on your conventions and workflow leaving it undefined may not be equivalent.
– Pete Kirkham
Jan 18 at 17:03
@PeteKirkham well then those code generators are clearly ignoring the UML standard with regards to the default value for the the multiplicity of a property.
– Geert Bellekens
Jan 18 at 17:58
add a comment |
If you set the multiplicity of your attribute to [1] it becomes not nullable.
- someAttribute : int [1]
And since 1 is the default multiplicity for attributes you can also leave the multiplicity undefined.
- someAttribute : int
In order to allow for null you have to explicitly set the lowerbound to 0
- someAttribute : int [0..1]
See UML 2.5 specification chapter 9.5.4 (Property.Notation)
<multiplicity-range>is the multiplicity range of the Property. If this term is omitted, it implies a multiplicity
of 1 (exactly one). (See MultiplicityElement – sub clause 7.5.)
can you please cite the reference so I can search for more information, the answer will also lead my search on other annotations for platforms like Android Studio, Netbeans, thank you.
– EvOlaNdLuPiZ
Jan 18 at 16:37
1
I've seen code generators that will not emit an attribute for unspecified multiplicity, and [CanBeNull] on 0..1 and [NotNull] on 1, so depending on your conventions and workflow leaving it undefined may not be equivalent.
– Pete Kirkham
Jan 18 at 17:03
@PeteKirkham well then those code generators are clearly ignoring the UML standard with regards to the default value for the the multiplicity of a property.
– Geert Bellekens
Jan 18 at 17:58
add a comment |
If you set the multiplicity of your attribute to [1] it becomes not nullable.
- someAttribute : int [1]
And since 1 is the default multiplicity for attributes you can also leave the multiplicity undefined.
- someAttribute : int
In order to allow for null you have to explicitly set the lowerbound to 0
- someAttribute : int [0..1]
See UML 2.5 specification chapter 9.5.4 (Property.Notation)
<multiplicity-range>is the multiplicity range of the Property. If this term is omitted, it implies a multiplicity
of 1 (exactly one). (See MultiplicityElement – sub clause 7.5.)
If you set the multiplicity of your attribute to [1] it becomes not nullable.
- someAttribute : int [1]
And since 1 is the default multiplicity for attributes you can also leave the multiplicity undefined.
- someAttribute : int
In order to allow for null you have to explicitly set the lowerbound to 0
- someAttribute : int [0..1]
See UML 2.5 specification chapter 9.5.4 (Property.Notation)
<multiplicity-range>is the multiplicity range of the Property. If this term is omitted, it implies a multiplicity
of 1 (exactly one). (See MultiplicityElement – sub clause 7.5.)
edited Jan 18 at 17:54
answered Jan 18 at 16:32
Geert BellekensGeert Bellekens
7,8121035
7,8121035
can you please cite the reference so I can search for more information, the answer will also lead my search on other annotations for platforms like Android Studio, Netbeans, thank you.
– EvOlaNdLuPiZ
Jan 18 at 16:37
1
I've seen code generators that will not emit an attribute for unspecified multiplicity, and [CanBeNull] on 0..1 and [NotNull] on 1, so depending on your conventions and workflow leaving it undefined may not be equivalent.
– Pete Kirkham
Jan 18 at 17:03
@PeteKirkham well then those code generators are clearly ignoring the UML standard with regards to the default value for the the multiplicity of a property.
– Geert Bellekens
Jan 18 at 17:58
add a comment |
can you please cite the reference so I can search for more information, the answer will also lead my search on other annotations for platforms like Android Studio, Netbeans, thank you.
– EvOlaNdLuPiZ
Jan 18 at 16:37
1
I've seen code generators that will not emit an attribute for unspecified multiplicity, and [CanBeNull] on 0..1 and [NotNull] on 1, so depending on your conventions and workflow leaving it undefined may not be equivalent.
– Pete Kirkham
Jan 18 at 17:03
@PeteKirkham well then those code generators are clearly ignoring the UML standard with regards to the default value for the the multiplicity of a property.
– Geert Bellekens
Jan 18 at 17:58
can you please cite the reference so I can search for more information, the answer will also lead my search on other annotations for platforms like Android Studio, Netbeans, thank you.
– EvOlaNdLuPiZ
Jan 18 at 16:37
can you please cite the reference so I can search for more information, the answer will also lead my search on other annotations for platforms like Android Studio, Netbeans, thank you.
– EvOlaNdLuPiZ
Jan 18 at 16:37
1
1
I've seen code generators that will not emit an attribute for unspecified multiplicity, and [CanBeNull] on 0..1 and [NotNull] on 1, so depending on your conventions and workflow leaving it undefined may not be equivalent.
– Pete Kirkham
Jan 18 at 17:03
I've seen code generators that will not emit an attribute for unspecified multiplicity, and [CanBeNull] on 0..1 and [NotNull] on 1, so depending on your conventions and workflow leaving it undefined may not be equivalent.
– Pete Kirkham
Jan 18 at 17:03
@PeteKirkham well then those code generators are clearly ignoring the UML standard with regards to the default value for the the multiplicity of a property.
– Geert Bellekens
Jan 18 at 17:58
@PeteKirkham well then those code generators are clearly ignoring the UML standard with regards to the default value for the the multiplicity of a property.
– Geert Bellekens
Jan 18 at 17:58
add a comment |
A NotNull attribute indicates that the property or association end must be present.
This is equivalent to having a multiplicity of 1 rather than 0..1 or an unspecified multiplicity.
add a comment |
A NotNull attribute indicates that the property or association end must be present.
This is equivalent to having a multiplicity of 1 rather than 0..1 or an unspecified multiplicity.
add a comment |
A NotNull attribute indicates that the property or association end must be present.
This is equivalent to having a multiplicity of 1 rather than 0..1 or an unspecified multiplicity.
A NotNull attribute indicates that the property or association end must be present.
This is equivalent to having a multiplicity of 1 rather than 0..1 or an unspecified multiplicity.
edited Jan 18 at 16:59
answered Jan 18 at 15:59
Pete KirkhamPete Kirkham
43.2k379151
43.2k379151
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54255246%2fanotation-nonnull-in-uml%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown