Provide safe API for getTaggedValue

Description

The class StereotypeAPI contains various helper methods for working with EMFProfiles. Unfortunately, some of them cannot be used in a convenient way because you have to do all the steps the utility methods does in order to avoid exceptions to the thrown.

The most prominent example is getTaggedValue that can be used to get a tagged value from an EObject. In order to avoid exceptions, you have to ensure that the profile and the stereotype are both applied. This degrades the benefit of using the method.

My suggestion is to introduce a getTaggedValueSafe method that performs these tests and returns en empty Optional instead of throwing an exception in case of an error. This would heavily improve the usability of the method.

There might be other methods that could benefit from these steps as well but this should be a separate task instead of integrating this investigation in this issue.

Environment

None
Fixed

Assignee

Yves Kirschner

Reporter

Stephan Seifermann

Labels

None

Requirement Category

None

External issue URL

None

Fix versions

Affects versions

Priority

Major