X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fproperty%2FDefaultPropertyManipulatorFactory.java;h=5d7e121d134a9ce2983733b1e9c70ba18e63deec;hb=2041d6564531fe794072ddfe345773de1cab60a3;hp=c6074f276914afbb0eb0ce72463580ed435c06e0;hpb=87b3241ec277ba3d8e414b26186a032c9cdcaeed;p=simantics%2F3d.git diff --git a/org.simantics.g3d/src/org/simantics/g3d/property/DefaultPropertyManipulatorFactory.java b/org.simantics.g3d/src/org/simantics/g3d/property/DefaultPropertyManipulatorFactory.java index c6074f27..5d7e121d 100644 --- a/org.simantics.g3d/src/org/simantics/g3d/property/DefaultPropertyManipulatorFactory.java +++ b/org.simantics.g3d/src/org/simantics/g3d/property/DefaultPropertyManipulatorFactory.java @@ -1,38 +1,53 @@ -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); - } - -} +/******************************************************************************* + * 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; + if (double[].class.equals(returnValue)) + return DoubleArrayPropertyManipulator.class; + if (returnValue.isEnum()) + return ComboPropertyManipulator.class; + throw new RuntimeException("Cannot handle value " + returnValue.getName() + " for method " + get); + } + +}