package mirror;

import java.lang.reflect.Field;

public class ReflectedField implements Printable<ReflectedField> {

	private Field f;
	private ReflectedClass<?> rc;
	
	protected ReflectedField(ReflectedClass<?> rc, Class<?> c, String name){
		try {
			f = c.getDeclaredField(name);
			f.setAccessible(true);
			this.rc = rc;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	
	@SuppressWarnings("unchecked")
	protected <T> T get(){
		try {
			return (T) f.get(rc.getObject());
		} catch (IllegalArgumentException | IllegalAccessException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	protected void set(Object value2) {
		try {
			f.set(rc.getObject(), value2);
		} catch (IllegalArgumentException | IllegalAccessException e) {
			e.printStackTrace();
		}
	}

	@Override
	public ReflectedField print() {
		System.out.println(this.toString());
		return this;
	}
	
}
@@ -773,16 +773,101 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09@Override%0A%09public String toString()%7B%0A%09%09return f.get(rc.getObject()).toString();%0A%09%7D%0A%0A
 %09@Overri
@@ -962,8 +962,9 @@
 ;%0A%09%7D%0A%09%0A%7D
+%0A

add toString() to ReflectedField