package org.geotools.wms.v1_1_1.bindings;


import java.util.HashSet;

import javax.xml.namespace.QName;

import org.geotools.metadata.iso.citation.AddressImpl;
import org.geotools.util.SimpleInternationalString;
import org.geotools.xml.AbstractComplexBinding;
import org.geotools.xml.ElementInstance;
import org.geotools.xml.Node;

/**
 * Binding object for the type :_ContactAddress.
 *
 * <p>
 *	<pre>
 *	 <code>
 *  &lt;xs:complexType name="_ContactAddress"&gt;
 *      &lt;xs:sequence&gt;
 *          &lt;xs:element ref="AddressType"/&gt;
 *          &lt;xs:element ref="Address"/&gt;
 *          &lt;xs:element ref="City"/&gt;
 *          &lt;xs:element ref="StateOrProvince"/&gt;
 *          &lt;xs:element ref="PostCode"/&gt;
 *          &lt;xs:element ref="Country"/&gt;
 *      &lt;/xs:sequence&gt;
 *  &lt;/xs:complexType&gt; 
 *		
 *	  </code>
 *	 </pre>
 * </p>
 *
 * @generated
 */
public class _ContactAddressBinding extends AbstractComplexBinding {

	/**
	 * @generated
	 */
	public QName getTarget() {
		return WMSV1_1_1._ContactAddress;
	}
	
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 *	
	 * @generated modifiable
	 */	
	public Class getType() {
		return AddressImpl.class;
	}
	
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 *	
	 * @generated modifiable
	 */	
	public Object parse(ElementInstance instance, Node node, Object value) 
		throws Exception {
		AddressImpl ret = new AddressImpl();
		ret.setCity(new SimpleInternationalString((String)node.getChildValue("City")));
		ret.setCountry(new SimpleInternationalString((String)node.getChildValue("Country")));
		ret.setPostalCode((String)node.getChildValue("PostCode"));
		ret.setElectronicMailAddresses(new HashSet());
		ret.setAdministrativeArea(new SimpleInternationalString((String)node.getChildValue("StateOrProvince")));
		
		HashSet addrs = new HashSet();
		addrs.addAll(node.getChildValues("Address"));
		
		ret.setDeliveryPoints(addrs);
		
		return ret;
	}

}