/******************************************************************************* * 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 java.util.List; public class MethodComboValueProvider implements ComboValueProvider { Method getter; Method setter; Method values; public MethodComboValueProvider(Method getter, Method setter, Method values) { this.getter = getter; this.setter = setter; this.values = values; } @Override public Object getValue(Object obj) throws Exception{ return getter.invoke(obj); } @Override public void setValue(Object obj, Object value) throws Exception { setter.invoke(obj,value); } public List getValues(Object obj) throws Exception { return (List)values.invoke(obj); } }