Refactor: move method to get annotated double value

- Move to AnnotationKeys to remove code duplication

Change-Id: Icf8b4322fc88e43ab531402d0e403a38d186f48e
diff --git a/core/api/src/main/java/org/onlab/onos/net/intent/constraint/AnnotationConstraint.java b/core/api/src/main/java/org/onlab/onos/net/intent/constraint/AnnotationConstraint.java
index ac76303..a093be9 100644
--- a/core/api/src/main/java/org/onlab/onos/net/intent/constraint/AnnotationConstraint.java
+++ b/core/api/src/main/java/org/onlab/onos/net/intent/constraint/AnnotationConstraint.java
@@ -21,6 +21,8 @@
 
 import java.util.Objects;
 
+import static org.onlab.onos.net.AnnotationKeys.getAnnotatedValue;
+
 /**
  * Constraint that evaluates an arbitrary link annotated value is under the specified threshold.
  */
@@ -65,25 +67,6 @@
         return value <= threshold;
     }
 
-    /**
-     * Returns the annotated value of the specified link. The annotated value
-     * is expected to be String that can be parsed as double. If parsing fails,
-     * the returned value will be 1.0.
-     *
-     * @param link link whose annotated value is obtained
-     * @param key key of link annotation
-     * @return double value of link annotation for the specified key
-     */
-    private double getAnnotatedValue(Link link, String key) {
-        double value;
-        try {
-            value = Double.parseDouble(link.annotations().value(key));
-        } catch (NumberFormatException e) {
-            value = 1.0;
-        }
-        return value;
-    }
-
     @Override
     public double cost(Link link, LinkResourceService resourceService) {
         if (isValid(link, resourceService)) {