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

YELLOW

parent a44cfd34
No related branches found
No related tags found
No related merge requests found
DerivedAnnotationBaseStaticImpl.java 60f0394ccbea9907c6f617c913bb844e84906e01 RED
DerivedAnnotationBaseStaticImpl.java 25b4a0b00fe68a1027ee81e52697e03988862373 YELLOW
LibraryElementBaseStaticImpl.java 13222726153d5159994866795b059a4cc3522434 GREEN
......@@ -37,19 +37,20 @@ public class DerivedAnnotationBaseStaticImpl {
* @return See above.
*/
public static <T> T getValue(IDerivedAnnotation<T> annotation) {
// TODO (SB): Compute derived annotated value only if user annotated value is not preferred.
T userAnnotatedValue = annotation.getUserAnnotatedValue();
if(annotation.isUserAnnotatedValuePreferred() && userAnnotatedValue != null) {
// User annotated value is preferred and exists.
return userAnnotatedValue;
}
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;
}
if(derivedValue != null) {
// User annotated value is not preferred: use the derived value.
return derivedValue;
}
return derivedValue;
// Derived value does not exist: return the user annotated value, even if it is not
// preferred. If neither the derived or the user annotated values exist, we return null.
return userAnnotatedValue;
}
}
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