package com.amazonaws.a2s.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 <p>Java class for Image complex type.
 
 <p>The following schema fragment specifies the expected content contained within this class.
 
 <pre>
 * &lt;complexType name="Image">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="URL" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="Height" type="{http://webservices.amazon.com/AWSECommerceService/2007-10-29}DecimalWithUnits"/>
 *         &lt;element name="Width" type="{http://webservices.amazon.com/AWSECommerceService/2007-10-29}DecimalWithUnits"/>
 *         &lt;element name="IsVerified" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 </pre>
 * Generated by AWS Code Generator
 <p/>
 * Thu Jan 10 05:27:59 PST 2008
 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Image", propOrder = {
    "url",
    "height",
    "width",
    "isVerified"
})
public class Image {

    @XmlElement(name = "URL", required = true)
    protected String url;
    @XmlElement(name = "Height", required = true)
    protected DecimalWithUnits height;
    @XmlElement(name = "Width", required = true)
    protected DecimalWithUnits width;
    @XmlElement(name = "IsVerified")
    protected String isVerified;

    /**
     * Gets the value of the url property.
     
     @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getURL() {
        return url;
    }

    /**
     * Sets the value of the url property.
     
     @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setURL(String value) {
        this.url = value;
    }

    public boolean isSetURL() {
        return (this.url!= null);
    }

    /**
     * Gets the value of the height property.
     
     @return
     *     possible object is
     *     {@link DecimalWithUnits }
     *     
     */
    public DecimalWithUnits getHeight() {
        return height;
    }

    /**
     * Sets the value of the height property.
     
     @param value
     *     allowed object is
     *     {@link DecimalWithUnits }
     *     
     */
    public void setHeight(DecimalWithUnits value) {
        this.height = value;
    }

    public boolean isSetHeight() {
        return (this.height!= null);
    }

    /**
     * Gets the value of the width property.
     
     @return
     *     possible object is
     *     {@link DecimalWithUnits }
     *     
     */
    public DecimalWithUnits getWidth() {
        return width;
    }

    /**
     * Sets the value of the width property.
     
     @param value
     *     allowed object is
     *     {@link DecimalWithUnits }
     *     
     */
    public void setWidth(DecimalWithUnits value) {
        this.width = value;
    }

    public boolean isSetWidth() {
        return (this.width!= null);
    }

    /**
     * Gets the value of the isVerified property.
     
     @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getIsVerified() {
        return isVerified;
    }

    /**
     * Sets the value of the isVerified property.
     
     @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setIsVerified(String value) {
        this.isVerified = value;
    }

    public boolean isSetIsVerified() {
        return (this.isVerified!= null);
    }

    /**
     * Sets the value of the URL property.
     
     @param value
     @return
     *     this instance
     */
    public Image withURL(String value) {
        setURL(value);
        return this;
    }

    /**
     * Sets the value of the Height property.
     
     @param value
     @return
     *     this instance
     */
    public Image withHeight(DecimalWithUnits value) {
        setHeight(value);
        return this;
    }

    /**
     * Sets the value of the Width property.
     
     @param value
     @return
     *     this instance
     */
    public Image withWidth(DecimalWithUnits value) {
        setWidth(value);
        return this;
    }

    /**
     * Sets the value of the IsVerified property.
     
     @param value
     @return
     *     this instance
     */
    public Image withIsVerified(String value) {
        setIsVerified(value);
        return this;
    }
    

    /**
     
     * XML fragment representation of this object
     
     @return XML fragment for this object. Name for outer
     * tag expected to be set by calling method. This fragment
     * returns inner properties representation only
     */
    protected String toXMLFragment() {
        StringBuffer xml = new StringBuffer();
        if (isSetURL()) {
            xml.append("<URL>");
            xml.append(escapeXML(getURL()));
            xml.append("</URL>");
        }
        if (isSetHeight()) {
            DecimalWithUnits  height = getHeight();
            xml.append("<Height Units=" "\"" +  escapeXML(height.getUnits())  "\"" +  ">");
            xml.append(height.getValue());
            xml.append("</Height>");
        
        if (isSetWidth()) {
            DecimalWithUnits  width = getWidth();
            xml.append("<Width Units=" "\"" +  escapeXML(width.getUnits())  "\"" +  ">");
            xml.append(width.getValue());
            xml.append("</Width>");
        
        if (isSetIsVerified()) {
            xml.append("<IsVerified>");
            xml.append(escapeXML(getIsVerified()));
            xml.append("</IsVerified>");
        }
        return xml.toString();
    }

    /**
     
     * Escape XML special characters
     */
    private String escapeXML(String string) {
        StringBuffer sb = new StringBuffer();
        int length = string.length();
        for (int i = 0; i < length; ++i) {
            char c = string.charAt(i);
            switch (c) {
            case '&':
                sb.append("&amp;");
                break;
            case '<':
                sb.append("&lt;");
                break;
            case '>':
                sb.append("&gt;");
                break;
            case '\'':
                sb.append("&#039;");
                break;
            case '"':
                sb.append("&quot;");
                break;
            default:
                sb.append(c);
            }
        }
        return sb.toString();
    }


}