View Javadoc
1   package nl.mineleni.openls.databinding.openls;
2   
3   import nl.mineleni.openls.XmlNamespaceConstants;
4   
5   /**
6    * OLS Place. http://schemas.opengis.net/ols/1.2.0/ADT.xsd
7    * 
8    * <pre>
9    * 
10   *  &lt;element name="Place" type="xls:NamedPlaceType"&gt;
11   *   &lt;annotation&gt;
12   *     &lt;documentation&gt;Place represents a hierarchical set of
13   *     geographic regions/placenames: country subdivision, country
14   *     secondary subdivision, municipality, and municipality
15   *     subdivision.&lt;/documentation&gt;
16   *   &lt;/annotation&gt;
17   * &lt;/element&gt;
18   * &lt;complexType name="NamedPlaceType"&gt;
19   *   &lt;annotation&gt;
20   *     &lt;documentation&gt;The NamedPlaceType defines a named place within
21   *     an AddressType. A named place has a classification (such as
22   *     country, country subdivision, or municipality).&lt;/documentation&gt;
23   *   &lt;/annotation&gt;
24   *   &lt;simpleContent&gt;
25   *     &lt;extension base="string"&gt;
26   *       &lt;attribute name="type" type="xls:NamedPlaceClassification" use="required" /&gt;
27   *     &lt;/extension&gt;
28   *   &lt;/simpleContent&gt;
29   * &lt;/complexType&gt;
30   * 
31   * </pre>
32   * 
33   * @author mprins
34   */
35  public class Place implements XmlNamespaceConstants {
36  	/**
37  	 * serialization id.
38  	 */
39  	private static final long serialVersionUID = -3969318615339164005L;
40  
41  	/** The type. */
42  	private String type;
43  
44  	/** The place. */
45  	private String place;
46  
47  	/** The has type. */
48  	private boolean hasType;
49  
50  	/** The has place. */
51  	private boolean hasPlace;
52  
53  	/**
54  	 * Instantiates a new place.
55  	 */
56  	public Place() {
57  		this.hasType = false;
58  		this.hasPlace = false;
59  	}
60  
61  	/**
62  	 * Sets the type.
63  	 * 
64  	 * @param type
65  	 *            the new type
66  	 */
67  	public void setType(final String type) {
68  		this.hasType = true;
69  		this.type = type;
70  	}
71  
72  	/**
73  	 * Gets the type.
74  	 * 
75  	 * @return the type
76  	 */
77  	public String getType() {
78  		return this.type;
79  	}
80  
81  	/**
82  	 * Checks for type.
83  	 * 
84  	 * @return true, if successful
85  	 */
86  	public boolean hasType() {
87  		return this.hasType;
88  	}
89  
90  	/**
91  	 * Sets the place.
92  	 * 
93  	 * @param place
94  	 *            the new place
95  	 */
96  	public void setPlace(final String place) {
97  		this.hasPlace = true;
98  		this.place = place;
99  	}
100 
101 	/**
102 	 * Gets the place.
103 	 * 
104 	 * @return the place
105 	 */
106 	public String getPlace() {
107 		return this.place;
108 	}
109 
110 	/**
111 	 * Checks for place.
112 	 * 
113 	 * @return true, if successful
114 	 */
115 	public boolean hasPlace() {
116 		return this.hasPlace;
117 	}
118 
119 	/*
120 	 * (non-Javadoc)
121 	 * 
122 	 * @see nl.mineleni.openls.XmlNamespaceConstants#toXML()
123 	 */
124 	@Override
125 	public String toXML() {
126 		String xml = "<" + XmlNamespaceConstants.OPENLS_NAMESPACE_PREFIX
127 				+ ":Place";
128 		if (this.hasType()) {
129 			xml += " type=\"" + this.getType() + "\"";
130 		}
131 		xml += ">";
132 		if (this.hasPlace()) {
133 			xml += this.getPlace();
134 		}
135 		xml += "</" + XmlNamespaceConstants.OPENLS_NAMESPACE_PREFIX + ":Place>";
136 		return xml;
137 	}
138 }