-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g3d.property;\r
-\r
-import java.lang.reflect.Method;\r
-\r
-import javax.vecmath.Quat4d;\r
-import javax.vecmath.Vector3d;\r
-\r
-public class DefaultPropertyManipulatorFactory implements PropertyManipulatorFactory {\r
- \r
- @Override\r
- public Class<? extends PropertyManipulator> get(Method get, Object value) {\r
- Class<?> returnValue = null;\r
- if (get != null)\r
- returnValue = get.getReturnType();\r
- else\r
- returnValue = value.getClass();\r
- if (Double.class.equals(returnValue))\r
- return DoublePropertyManipulator.class;\r
- if (Vector3d.class.equals(returnValue))\r
- return VectorPropertyManipulator.class;\r
- if (Quat4d.class.equals(returnValue))\r
- return QuatPropertyManipulator.class;\r
- if (String.class.equals(returnValue))\r
- return StringPropertyManipulator.class;\r
- if (Integer.class.equals(returnValue))\r
- return IntegerPropertyManipulator.class;\r
- if (Boolean.class.equals(returnValue))\r
- return BooleanPropertyManipulator.class;\r
- if(double.class.equals(returnValue)) \r
- return DoublePropertyManipulator.class;\r
- if(int.class.equals(returnValue))\r
- return IntegerPropertyManipulator.class;\r
- if(boolean.class.equals(returnValue))\r
- return BooleanPropertyManipulator.class;\r
- throw new RuntimeException("Cannot handle value " + returnValue.getName() + " for method " + get);\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g3d.property;
+
+import java.lang.reflect.Method;
+
+import javax.vecmath.Quat4d;
+import javax.vecmath.Vector3d;
+
+public class DefaultPropertyManipulatorFactory implements PropertyManipulatorFactory {
+
+ @Override
+ public Class<? extends PropertyManipulator> get(Method get, Object value) {
+ Class<?> returnValue = null;
+ if (get != null)
+ returnValue = get.getReturnType();
+ else
+ returnValue = value.getClass();
+ if (Double.class.equals(returnValue))
+ return DoublePropertyManipulator.class;
+ if (Vector3d.class.equals(returnValue))
+ return VectorPropertyManipulator.class;
+ if (Quat4d.class.equals(returnValue))
+ return QuatPropertyManipulator.class;
+ if (String.class.equals(returnValue))
+ return StringPropertyManipulator.class;
+ if (Integer.class.equals(returnValue))
+ return IntegerPropertyManipulator.class;
+ if (Boolean.class.equals(returnValue))
+ return BooleanPropertyManipulator.class;
+ if(double.class.equals(returnValue))
+ return DoublePropertyManipulator.class;
+ if(int.class.equals(returnValue))
+ return IntegerPropertyManipulator.class;
+ if(boolean.class.equals(returnValue))
+ return BooleanPropertyManipulator.class;
+ if (double[].class.equals(returnValue))
+ return DoubleArrayPropertyManipulator.class;
+ throw new RuntimeException("Cannot handle value " + returnValue.getName() + " for method " + get);
+ }
+
+}