//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2009.05.15 at 12:16:57 PM MSD 
//


package org.spbu.benchmark.app;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import com.progress.open4gl.Parameter;
import com.progress.open4gl.ProResultSetMetaDataImpl;
import com.progress.open4gl.ProSQLException;



/**
 * <p>Java class for TableParameter complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="TableParameter">
 *   &lt;complexContent>
 *     &lt;extension base="{}OEParameter">
 *       &lt;sequence>
 *         &lt;element name="meta" type="{}TableMetaData" maxOccurs="unbounded"/>
 *       &lt;/sequence>
 *     &lt;/extension>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TableParameter", propOrder = {
    "meta"
})
public class TableParameter
    extends OEParameter
{

    @XmlElement(required = true)
    protected List<TableMetaData> meta;

    /**
     * Gets the value of the meta property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the meta property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getMeta().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link TableMetaData }
     * 
     * 
     */
    public List<TableMetaData> getMeta() {
        if (meta == null) {
            meta = new ArrayList<TableMetaData>();
        }
        return this.meta;
    }
    public ProResultSetMetaDataImpl getMetaData() throws ProSQLException{
    	ProResultSetMetaDataImpl metaData = new ProResultSetMetaDataImpl(meta.size());
    	for(TableMetaData m : meta){
    		metaData.setFieldMetaData(m.getIndex(), m.getName(), 0, m.getType().get());
    	}
    	return metaData;
    }
    public int get(){
    	return Parameter.PRO_TEMPTABLE;
    }
    public TableParameter addMeta(TableMetaData meta){
    	if(this.meta==null) this.meta = new ArrayList<TableMetaData>();
    	this.meta.add(meta);
    	return this;
    }
}
