org.geotoolkit.metadata.iso.citation.DefaultAddress Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geotk-metadata Show documentation
Show all versions of geotk-metadata Show documentation
Implementations of metadata derived from ISO 19115. This module provides both an implementation
of the metadata interfaces defined in GeoAPI, and a framework for handling those metadata through
Java reflection.
/*
* Geotoolkit.org - An Open Source Java GIS Toolkit
* http://www.geotoolkit.org
*
* (C) 2004-2011, Open Source Geospatial Foundation (OSGeo)
* (C) 2009-2011, Geomatys
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* This package contains documentation from OpenGIS specifications.
* OpenGIS consortium's work is fully acknowledged here.
*/
package org.geotoolkit.metadata.iso.citation;
import java.util.Collection;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import net.jcip.annotations.ThreadSafe;
import org.opengis.util.InternationalString;
import org.opengis.metadata.citation.Address;
import org.geotoolkit.metadata.iso.MetadataEntity;
/**
* Location of the responsible individual or organization.
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @author Touraïvane (IRD)
* @author Cédric Briançon (Geomatys)
* @version 3.18
*
* @since 2.1
* @module
*/
@ThreadSafe
@XmlType(name = "CI_Address_Type", propOrder={
"deliveryPoints",
"city",
"administrativeArea",
"postalCode",
"country",
"electronicMailAddresses"
})
@XmlRootElement(name = "CI_Address")
public class DefaultAddress extends MetadataEntity implements Address {
/**
* Serial number for inter-operability with different versions.
*/
private static final long serialVersionUID = 2278687294173262546L;
/**
* State, province of the location.
*/
private InternationalString administrativeArea;
/**
* The city of the location
*/
private InternationalString city;
/**
* Country of the physical address.
*/
private InternationalString country;
/**
* ZIP or other postal code.
*/
private String postalCode;
/**
* Address line for the location (as described in ISO 11180, Annex A).
*/
private Collection deliveryPoints;
/**
* Address of the electronic mailbox of the responsible organization or individual.
*/
private Collection electronicMailAddresses;
/**
* Constructs an initially empty address.
*/
public DefaultAddress() {
}
/**
* Constructs a metadata entity initialized with the values from the specified metadata.
*
* @param source The metadata to copy, or {@code null} if none.
*
* @since 2.4
*/
public DefaultAddress(final Address source) {
super(source);
}
/**
* Returns a Geotk metadata implementation with the same values than the given arbitrary
* implementation. If the given object is {@code null}, then this method returns {@code null}.
* Otherwise if the given object is already a Geotk implementation, then the given object is
* returned unchanged. Otherwise a new Geotk implementation is created and initialized to the
* attribute values of the given object, using a shallow copy operation
* (i.e. attributes are not cloned).
*
* @param object The object to wrap in a Geotk implementation, or {@code null} if none.
* @return A Geotk implementation containing the values of the given object (may be the
* given object itself), or {@code null} if the argument was null.
*
* @since 3.18
*/
public static DefaultAddress wrap(final Address object) {
return (object == null) || (object instanceof DefaultAddress)
? (DefaultAddress) object : new DefaultAddress(object);
}
/**
* Return the state, province of the location.
* Returns {@code null} if unspecified.
*/
@Override
@XmlElement(name = "administrativeArea")
public synchronized InternationalString getAdministrativeArea() {
return administrativeArea;
}
/**
* Sets the state, province of the location.
*
* @param newValue The new administrative area.
*/
public synchronized void setAdministrativeArea(final InternationalString newValue) {
checkWritePermission();
administrativeArea = newValue;
}
/**
* Returns the city of the location.
* Returns {@code null} if unspecified.
*/
@Override
@XmlElement(name = "city")
public synchronized InternationalString getCity() {
return city;
}
/**
* Sets the city of the location.
*
* @param newValue The new city.
*/
public synchronized void setCity(final InternationalString newValue) {
checkWritePermission();
city = newValue;
}
/**
* Returns the country of the physical address.
* Returns {@code null} if unspecified.
*/
@Override
@XmlElement(name = "country")
public synchronized InternationalString getCountry() {
return country;
}
/**
* set the country of the physical address.
*
* @param newValue The new country.
*/
public synchronized void setCountry(final InternationalString newValue) {
checkWritePermission();
country = newValue;
}
/**
* Returns the address line for the location (as described in ISO 11180, Annex A).
*/
@Override
@XmlElement(name = "deliveryPoint")
public synchronized Collection getDeliveryPoints() {
return xmlOptional(deliveryPoints = nonNullCollection(deliveryPoints, String.class));
}
/**
* Sets the address line for the location (as described in ISO 11180, Annex A).
*
* @param newValues The new delivery points.
*/
public synchronized void setDeliveryPoints(final Collection extends String> newValues) {
deliveryPoints = copyCollection(newValues, deliveryPoints, String.class);
}
/**
* Returns the address of the electronic mailbox of the responsible organization or individual.
*/
@Override
@XmlElement(name = "electronicMailAddress")
public synchronized Collection getElectronicMailAddresses() {
return xmlOptional(electronicMailAddresses = nonNullCollection(electronicMailAddresses, String.class));
}
/**
* Sets the address of the electronic mailbox of the responsible organization or individual.
*
* @param newValues The new electronic mail addresses.
*/
public synchronized void setElectronicMailAddresses(final Collection extends String> newValues) {
electronicMailAddresses = copyCollection(newValues, electronicMailAddresses, String.class);
}
/**
* Returns ZIP or other postal code.
* Returns {@code null} if unspecified.
*/
@Override
@XmlElement(name = "postalCode")
public synchronized String getPostalCode() {
return postalCode;
}
/**
* Sets ZIP or other postal code.
*
* @param newValue The new postal code.
*/
public synchronized void setPostalCode(final String newValue) {
checkWritePermission();
postalCode = newValue;
}
}