View Javadoc
1   package nl.mineleni.openls.databinding.openls;
2   
3   import nl.mineleni.openls.XmlNamespaceConstants;
4   
5   /**
6    * OLS Building.
7    * 
8    * http://schemas.opengis.net/ols/1.2.0/ADT.xsd
9    * 
10   * <pre>
11   * 
12   * &lt;element name="Building" type="xls:BuildingLocatorType" 
13   * 		substitutionGroup="xls:_StreetLocation"&gt;
14   *   &lt;annotation&gt;
15   *     &lt;documentation&gt;An addressable place; normally a location on a street: number, 
16   *     subdivision name and/or building name.&lt;/documentation&gt;
17   *   &lt;/annotation&gt;
18   * &lt;/element&gt;
19   * &lt;complexType name="BuildingLocatorType"&gt;
20   *   &lt;annotation&gt;
21   *     &lt;documentation&gt;A type of AbstractStreetLocatorType&lt;/documentation&gt;
22   *   &lt;/annotation&gt;
23   *   &lt;complexContent&gt;
24   *     &lt;extension base="xls:AbstractStreetLocatorType"&gt;
25   *       &lt;attribute name="number" type="string" use="optional" /&gt;
26   *       &lt;attribute name="subdivision" type="string" use="optional" /&gt;
27   *       &lt;attribute name="buildingName" type="string" use="optional" /&gt;
28   *     &lt;/extension&gt;
29   *   &lt;/complexContent&gt;
30   * &lt;/complexType&gt;
31   * 
32   * </pre>
33   * 
34   * @author mprins
35   */
36  public class Building implements XmlNamespaceConstants {
37  	/**
38  	 * serialization id.
39  	 */
40  	private static final long serialVersionUID = -6760538060544745111L;
41  	/**
42  	 * building number.
43  	 */
44  	private String number;
45  
46  	/** number subdivision. */
47  	private String subdivision;
48  	/**
49  	 * name of the building.
50  	 */
51  	private String buildingName;
52  
53  	/** The has number. */
54  	private boolean hasNumber;
55  
56  	/** The has subdivision. */
57  	private boolean hasSubdivision;
58  
59  	/** The has building name. */
60  	private boolean hasBuildingName;
61  
62  	/**
63  	 * Instantiates a new building.
64  	 */
65  	public Building() {
66  		this.hasNumber = false;
67  		this.hasSubdivision = false;
68  		this.hasBuildingName = false;
69  	}
70  
71  	/**
72  	 * Sets the number.
73  	 * 
74  	 * @param number
75  	 *            the new number
76  	 */
77  	public void setNumber(final String number) {
78  		this.hasNumber = true;
79  		this.number = number;
80  	}
81  
82  	/**
83  	 * Gets the number.
84  	 * 
85  	 * @return the number
86  	 */
87  	public String getNumber() {
88  		return this.number;
89  	}
90  
91  	/**
92  	 * Checks for number.
93  	 * 
94  	 * @return true, if successful
95  	 */
96  	public boolean hasNumber() {
97  		return this.hasNumber;
98  	}
99  
100 	/**
101 	 * Sets the subdivision.
102 	 * 
103 	 * @param subdivision
104 	 *            the new subdivision
105 	 */
106 	public void setSubdivision(final String subdivision) {
107 		this.hasSubdivision = true;
108 		this.subdivision = subdivision;
109 	}
110 
111 	/**
112 	 * Gets the subdivision.
113 	 * 
114 	 * @return the subdivision
115 	 */
116 	public String getSubdivision() {
117 		return this.subdivision;
118 	}
119 
120 	/**
121 	 * Checks for subdivision.
122 	 * 
123 	 * @return true, if successful
124 	 */
125 	public boolean hasSubdivision() {
126 		return this.hasSubdivision;
127 	}
128 
129 	/**
130 	 * Sets the building name.
131 	 * 
132 	 * @param buildingName
133 	 *            the new building name
134 	 */
135 	public void setBuildingName(final String buildingName) {
136 		this.hasBuildingName = true;
137 		this.buildingName = buildingName;
138 	}
139 
140 	/**
141 	 * Gets the building name.
142 	 * 
143 	 * @return the building name
144 	 */
145 	public String getBuildingName() {
146 		return this.buildingName;
147 	}
148 
149 	/**
150 	 * Checks for building name.
151 	 * 
152 	 * @return true, if successful
153 	 */
154 	public boolean hasBuildingName() {
155 		return this.hasBuildingName;
156 	}
157 
158 	/*
159 	 * (non-Javadoc)
160 	 * 
161 	 * @see nl.mineleni.openls.databinding.common.XmlNamespaceConstants#toXML()
162 	 */
163 	@Override
164 	public String toXML() {
165 		String xml = "<" + XmlNamespaceConstants.OPENLS_NAMESPACE_PREFIX
166 				+ ":Building";
167 		if (this.hasNumber()) {
168 			xml += " number=\"" + this.getNumber() + "\"";
169 		}
170 		xml += ">";
171 		xml += "</" + XmlNamespaceConstants.OPENLS_NAMESPACE_PREFIX
172 				+ ":Building>";
173 		return xml;
174 	}
175 }