modules/graphics/src/main/java/javafx/animation/KeyValue.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -23,10 +23,12 @@
  * questions.
  */
 
 package javafx.animation;
 
+import com.sun.javafx.animation.KeyValueHelper;
+import com.sun.javafx.animation.KeyValueType;
 import javafx.beans.NamedArg;
 import javafx.beans.value.WritableBooleanValue;
 import javafx.beans.value.WritableDoubleValue;
 import javafx.beans.value.WritableFloatValue;
 import javafx.beans.value.WritableIntegerValue;

@@ -62,30 +64,23 @@
  */
 public final class KeyValue {
 
     private static final Interpolator DEFAULT_INTERPOLATOR = Interpolator.LINEAR;
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     * @since JavaFX 2.0
-     */
-    @Deprecated
-    public static enum Type {
-        BOOLEAN, DOUBLE, FLOAT, INTEGER, LONG, OBJECT
+    static {
+        KeyValueHelper.setKeyValueAccessor(new KeyValueHelper.KeyValueAccessor() {
+            @Override public KeyValueType getType(KeyValue keyValue) {
+                return keyValue.getType();
+            }
+        });
     }
 
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated
-    public Type getType() {
+    KeyValueType getType() {
         return type;
     }
 
-    private final Type type;
+    private final KeyValueType type;
 
     /**
      * Returns the target of this {@code KeyValue}
      *
      * @return the target

@@ -139,17 +134,17 @@
         }
 
         this.target = target;
         this.endValue = endValue;
         this.interpolator = interpolator;
-        this.type = (target instanceof WritableNumberValue) ? (target instanceof WritableDoubleValue) ? Type.DOUBLE
-                : (target instanceof WritableIntegerValue) ? Type.INTEGER
-                        : (target instanceof WritableFloatValue) ? Type.FLOAT
-                                : (target instanceof WritableLongValue) ? Type.LONG
-                                        : Type.OBJECT
-                : (target instanceof WritableBooleanValue) ? Type.BOOLEAN
-                        : Type.OBJECT;
+        this.type = (target instanceof WritableNumberValue) ? (target instanceof WritableDoubleValue) ? KeyValueType.DOUBLE
+                : (target instanceof WritableIntegerValue) ? KeyValueType.INTEGER
+                        : (target instanceof WritableFloatValue) ? KeyValueType.FLOAT
+                                : (target instanceof WritableLongValue) ? KeyValueType.LONG
+                                        : KeyValueType.OBJECT
+                : (target instanceof WritableBooleanValue) ? KeyValueType.BOOLEAN
+                        : KeyValueType.OBJECT;
     }
 
     /**
      * Creates a {@code KeyValue} that uses {@link Interpolator#LINEAR}.
      *