/******************************************************************************* * 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 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; throw new RuntimeException("Cannot handle value " + returnValue.getName() + " for method " + get); } }