All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.micromata.opengis.kml.v_2_2_0.Schema Maven / Gradle / Ivy

Go to download

This is JavaAPIforKMml, Micromata's library for use with applications that want to parse, generate and operate on KML. It is an implementation of the OGC KML 2.2 standard. It is written entirely in Java and makes heavy use of JAXB.

There is a newer version: 3.0.4
Show newest version

package de.micromata.opengis.kml.v_2_2_0;

import de.micromata.opengis.kml.v_2_2_0.gx.SimpleArrayField;
import jakarta.xml.bind.annotation.*;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import java.util.ArrayList;
import java.util.List;


/**
 * {@code }
 * 

* Specifies a custom KML schema that is used to add custom data to KML Features. The * "id" attribute is required and must be unique within the KML file. {@code } is always * a child of {@code }. *

* * Syntax: *
<Schema name="string" id="ID">
 *   <SimpleField type="string" name="string">
 *     <displayName>...</displayName>            <!-- string -->
 *   </SimpleField>
 * </Schema>
* * Extends: * * * Contained By: * * * See Also: * {@code } * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SchemaType", propOrder = { "simpleField", "schemaExtension" }) @XmlRootElement(name = "Schema", namespace = "http://www.opengis.net/kml/2.2") public class Schema implements Cloneable { @XmlElement(name = "SimpleField") protected List simpleField; /** * {@code } *

* This is an abstract base class and cannot be used directly in a KML file. It provides * the id attribute, which allows unique identification of a KML element, and the targetId * attribute, which is used to reference objects that have already been loaded into * Google Earth. The id attribute must be assigned if the Update mechanism is to * be used. *

* * Syntax: *
<!-- abstract element; do not create -->
     * <!-- Object id="ID" targetId="NCName" -->
     * <!-- /Object> -->
* * * */ @XmlElement(name = "SchemaExtension") protected List schemaExtension; /** * {@code } *

* User-defined text displayed in the 3D viewer as the label for the object (for example, * for a Placemark, Folder, or NetworkLink). *

* * * */ @XmlAttribute(name = "name") protected String name; @XmlAttribute(name = "id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String id; public Schema() { super(); } /** * * */ public List getSimpleField() { if (simpleField == null) { simpleField = new ArrayList(); } return this.simpleField; } /** * * */ public List getSchemaExtension() { if (schemaExtension == null) { schemaExtension = new ArrayList(); } return this.schemaExtension; } /** * * * @return * possible object is * {@link String} * */ public String getName() { return name; } /** * * * @param value * allowed object is * {@link String} * */ public void setName(String value) { this.name = value; } /** * * * @return * possible object is * {@link String} * */ public String getId() { return id; } /** * * * @param value * allowed object is * {@link String} * */ public void setId(String value) { this.id = value; } @Override public int hashCode() { final int prime = 31; int result = 1; result = ((prime*result)+((simpleField == null)? 0 :simpleField.hashCode())); result = ((prime*result)+((schemaExtension == null)? 0 :schemaExtension.hashCode())); result = ((prime*result)+((name == null)? 0 :name.hashCode())); result = ((prime*result)+((id == null)? 0 :id.hashCode())); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if ((obj instanceof Schema) == false) { return false; } Schema other = ((Schema) obj); if (simpleField == null) { if (other.simpleField!= null) { return false; } } else { if (simpleField.equals(other.simpleField) == false) { return false; } } if (schemaExtension == null) { if (other.schemaExtension!= null) { return false; } } else { if (schemaExtension.equals(other.schemaExtension) == false) { return false; } } if (name == null) { if (other.name!= null) { return false; } } else { if (name.equals(other.name) == false) { return false; } } if (id == null) { if (other.id!= null) { return false; } } else { if (id.equals(other.id) == false) { return false; } } return true; } /** * Creates a new instance of {@link SimpleField} and adds it to simpleField. * This method is a short version for: * {@code * SimpleField simpleField = new SimpleField(); * this.getSimpleField().add(simpleField); } * * */ public SimpleField createAndAddSimpleField() { SimpleField newValue = new SimpleField(); this.getSimpleField().add(newValue); return newValue; } /** * * * @param simpleField * Objects of the following type are allowed in the list: {@link SimpleField} */ public void setSimpleField(final List simpleField) { this.simpleField = simpleField; } /** * add a value to the simpleField property collection * * @param simpleField * Objects of the following type are allowed in the list: {@link SimpleField} * @return * true (as general contract of Collection.add). */ public Schema addToSimpleField(final SimpleField simpleField) { this.getSimpleField().add(simpleField); return this; } /** * * * @param schemaExtension * Objects of the following type are allowed in the list: {@code <}{@link SimpleArrayField}{@code >}{@code <}{@link Object}{@code >} */ public void setSchemaExtension(final List schemaExtension) { this.schemaExtension = schemaExtension; } /** * add a value to the schemaExtension property collection * * @param schemaExtension * Objects of the following type are allowed in the list: {@code <}{@link SimpleArrayField}{@code >}{@code <}{@link Object}{@code >} * @return * true (as general contract of Collection.add). */ public Schema addToSchemaExtension(final Object schemaExtension) { this.getSchemaExtension().add(schemaExtension); return this; } /** * fluent setter * * * @param simpleField * required parameter */ public Schema withSimpleField(final List simpleField) { this.setSimpleField(simpleField); return this; } /** * fluent setter * * * @param schemaExtension * required parameter */ public Schema withSchemaExtension(final List schemaExtension) { this.setSchemaExtension(schemaExtension); return this; } /** * fluent setter * * * @param name * required parameter */ public Schema withName(final String name) { this.setName(name); return this; } /** * fluent setter * * * @param id * required parameter */ public Schema withId(final String id) { this.setId(id); return this; } @Override public Schema clone() { Schema copy; try { copy = ((Schema) super.clone()); } catch (CloneNotSupportedException _x) { throw new InternalError((_x.toString())); } copy.simpleField = new ArrayList((getSimpleField().size())); for (SimpleField iter: simpleField) { copy.simpleField.add(iter.clone()); } copy.schemaExtension = new ArrayList((getSchemaExtension().size())); for (Object iter: schemaExtension) { copy.schemaExtension.add(iter); } return copy; } }