Skip to content
Snippets Groups Projects
Commit ad57f4ef authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Simplify the retrieval of derived values

parent 181755cd
No related branches found
No related tags found
1 merge request!69DiagramEditors: Overwrite eclipse zoom class for fixed height
This commit is part of merge request !69. Comments created here will be created in the context of that merge request.
DerivedAnnotationBaseStaticImpl.java 0b5a8e36f66c937b1659f0b73a0cf0428337e364 GREEN
DerivedAnnotationBaseStaticImpl.java d1b98d0c06b781fe297f63b0bfdc5dc72fe462c0 YELLOW
LibraryElementBaseStaticImpl.java 13222726153d5159994866795b059a4cc3522434 GREEN
......@@ -37,21 +37,18 @@ public class DerivedAnnotationBaseStaticImpl {
* @return See above.
*/
public static <T> T getValue(IDerivedAnnotation<T> annotation) {
T derivedValue = null;
if(annotation.getUserAnnotatedValue() != null) {
if(annotation.isUserAnnotatedValuePreferred()) {
// User annotated value is available and preferred -> return it
return annotation.getUserAnnotatedValue();
}
derivedValue = annotation.getDerivedValue();
if(derivedValue == null) {
// Derived value would be preferred, but it is not available -> return user
// annotated value
return annotation.getUserAnnotatedValue();
T derivedValue = annotation.getDerivedValue();
if(annotation.isUserAnnotatedValuePreferred() || derivedValue == null) {
// User annotated value is preferred, or the derived value is not available
// --> return user annotated value
T userAnnotatedValue = annotation.getUserAnnotatedValue();
if(userAnnotatedValue != null) {
// Only return the user annotated value if it is present, or a derived value is not
// present.
return userAnnotatedValue;
}
}
// Use cached result of derived value if it is available
return derivedValue != null ? derivedValue : annotation.getDerivedValue();
return derivedValue;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment