1 /*******************************************************************************
\r
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g3d.property;
\r
14 import java.lang.reflect.Method;
\r
16 import javax.vecmath.Quat4d;
\r
17 import javax.vecmath.Vector3d;
\r
19 public class DefaultPropertyManipulatorFactory implements PropertyManipulatorFactory {
\r
22 public Class<? extends PropertyManipulator> get(Method get, Object value) {
\r
23 Class<?> returnValue = null;
\r
25 returnValue = get.getReturnType();
\r
27 returnValue = value.getClass();
\r
28 if (Double.class.equals(returnValue))
\r
29 return DoublePropertyManipulator.class;
\r
30 if (Vector3d.class.equals(returnValue))
\r
31 return VectorPropertyManipulator.class;
\r
32 if (Quat4d.class.equals(returnValue))
\r
33 return QuatPropertyManipulator.class;
\r
34 if (String.class.equals(returnValue))
\r
35 return StringPropertyManipulator.class;
\r
36 if (Integer.class.equals(returnValue))
\r
37 return IntegerPropertyManipulator.class;
\r
38 if (Boolean.class.equals(returnValue))
\r
39 return BooleanPropertyManipulator.class;
\r
40 if(double.class.equals(returnValue))
\r
41 return DoublePropertyManipulator.class;
\r
42 if(int.class.equals(returnValue))
\r
43 return IntegerPropertyManipulator.class;
\r
44 if(boolean.class.equals(returnValue))
\r
45 return BooleanPropertyManipulator.class;
\r
46 throw new RuntimeException("Cannot handle value " + returnValue.getName() + " for method " + get);
\r