package com.jxml.quick.util.qjmlExpand;
import com.jxml.quick.model.qjml.*;
import com.jxml.quick.*;
import org.xml.sax.*;
import java.util.*;
import com.jxml.quick.ocm.*;
import java.io.*;

/**
 * Extracts QJML data.
 */
public class QCProperty extends OCMpeerSupport
{
	/**
	 * User-provided code to perform the conversion.
	 */
	public void cvt(Object coin)
		throws SAXException, IOException
	{
		QMProperty dm=(QMProperty)dataModel;
		QMCoin enclosingCoin=(QMCoin)coin;
		Counter.SubCounter subCounter=(Counter.SubCounter)context;

		subCounter.addIDAttribute(this);
		addStringAttribute("name",dm.name);

		HashMap accessors=enclosingCoin.accessors;
		String key="get_"+dm.name;
		boolean read=!accessors.containsKey(key);
		key="set_"+dm.name;
		boolean write=!accessors.containsKey(key);
		if (read && write)
			addStringAttribute("inherited","both");
		else if (read)
			addStringAttribute("inherited","get");
		else if (write)
			addStringAttribute("inherited","set");

		addIntAttribute("size",dm.size);
		addStringAttribute("coin",dm.coin);
		addStringAttribute("key",dm.key);
		addStringAttribute("kind",dm.kind);
		addStringAttribute("initializer",dm.initializer);
		addBooleanAttribute("abstract",dm.abst);
		addBooleanAttribute("read",dm.read);
		addBooleanAttribute("write",dm.write);

		emptyElement("property");
	}
}
