/*
 * Created on Aug 2, 2005
 * 
 * $Log$
 * Revision 1.1  2005/08/03 00:35:29  dsowen
 * Initial commit.
 *
 */
package ws.fugue88.jpath;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author dsowen
 */
public class MutableMethodProperty extends ImmutableMethodProperty {

	MutableMethodProperty(String name, Class clas, String get_method,
			String set_method) throws NoSuchMethodException
	{
		super(name, clas, get_method);

		_set = clas.getDeclaredMethod(set_method, new Class[] { getType() });
		_set.setAccessible(true);
	}

	public void setValue(Object that, Object value)
			throws InvocationTargetException
	{
		try {
			_set.invoke(that, new Object[] { value });
		} catch(IllegalAccessException e) {
			throw new Error(e);
		}
	}

	private Method _set;

}