package com.jxml.quick.engine;
import com.jxml.quick.*;
import com.jxml.quick.access.*;
import com.jxml.quick.tf.*;

public class QDefaultAccess extends QFixedAccess
{
    protected Object get(Object parent, QContext context)
	throws QPE
    {
	validateParent(parent,context);
	QCElementFactory cef=(QCElementFactory)parent;
	return cef.defaultValue;
    }

    protected void validateChild(Object child, QContext context)
	throws QPE
    {
	if (!(child instanceof String))
	    context.throwPE("requires String child, not"+
			    child.getClass());
    }

    public void add(Object parent, 
		    QTargetFactory parentFactory,
		    Object child, 
		    QContext context)
	throws QPE
    {
	validateParent(parent,context);
	validateChild(child,context);
	QCElementFactory cef=(QCElementFactory)parent;
	cef.defaultValue=(String)child;
    }
}
