package com.jxml.quick.tf;
import com.jxml.quick.*;
import com.jxml.quick.access.*;
import java.beans.*;
import java.lang.reflect.*;

public class QFieldTF extends QPropertyTF
{
    public Object create(QContext context)
	throws QPE
    {
	return new QFieldAccess();
    }

    public boolean isInstance(Object object, QContext context)
    {
	return object instanceof QFieldAccess;
    }

    public String getText(Object object, 
			  QContext context)
	throws QPE
    {
	return ((QFieldAccess)object).field;
    }

    public void add(Object object, 
		    String name, 
		    String text,
		    QAccess access,
		    Object parent,
		    QTargetFactory parentFactory,
		    QContext context)
	throws QPE
    {
	if (!isInstance(object,context))
	    context.throwPE("Class mismatch: "+text);
	QFieldAccess pa=(QFieldAccess)object;
	pa.field=text;
	if (parent==null)
	    context.doc.setRoot(object);
	else
	    access.add(parent,parentFactory,object,context);
    }
}
