// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) fieldsfirst 
// Source File Name:   FieldProvider.java

package lt.ktu.gmj.propertySheet;

import java.io.PrintStream;
import java.lang.reflect.Field;

// Referenced classes of package lt.ktu.gmj.propertySheet:
//			SimplePropertyProvider, InvalidPropertyException, SimplePropertyNotifier

public class FieldProvider extends SimplePropertyProvider
{

	private Object container;
	private Field field;

	public Object get()
	{
		try
		{
			return field.get(container);
		}
		catch(Exception exception)
		{
			System.out.println(exception);
		}
		return null;
	}

	public void set(Object obj)
		throws InvalidPropertyException
	{
		try
		{
			field.set(container, obj);
		}
		catch(Exception exception)
		{
			System.out.println(exception);
			throw new InvalidPropertyException("Invalid field");
		}
	}

	public void refreshed()
	{
		refresh();
	}

	public FieldProvider(Object obj, String s)
	{
		container = obj;
		try
		{
			field = container.getClass().getField(s);
		}
		catch(Exception exception)
		{
			field = null;
		}
	}
}
