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

org.geotoolkit.internal.jaxb.gco.GO_Measure Maven / Gradle / Ivy

Go to download

Basic utilities for XML marshalling and unmarshalling. Those utilities are built on top of the JAXB framework.

The newest version!
/*
 *    Geotoolkit.org - An Open Source Java GIS Toolkit
 *    http://www.geotoolkit.org
 *
 *    (C) 2008-2012, Open Source Geospatial Foundation (OSGeo)
 *    (C) 2009-2012, 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.
 */
package org.geotoolkit.internal.jaxb.gco;

import javax.measure.unit.SI;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlAdapter;


/**
 * The ISO-19103 {@code Measure} with a unit of measure defined in the {@code gco} namespace
 * associated to the {@code http://www.isotc211.org/2005/gco} URL.
 * 

* This class is identical to {@link GO_Distance} except for the name of the * element, which is {@code "Measure"}. * * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) * @version 3.17 * * @since 2.5 * @module */ public final class GO_Measure extends XmlAdapter { /** * A proxy representation of the {@code } element. */ @XmlElement(name = "Measure") private Measure measure; /** * Empty constructor used only by JAXB. */ public GO_Measure() { } /** * Constructs an adapter for the given value. * * @param value The value. */ private GO_Measure(final Double value) { measure = new Measure(value, SI.METRE); } /** * Allows JAXB to generate a Double object using the value found in the adapter. * * @param value The value wrapped in an adapter. * @return The double value extracted from the adapter. */ @Override public Double unmarshal(final GO_Measure value) { if (value != null) { final Measure measure = value.measure; if (measure != null) { return measure.value; } } return null; } /** * Allows JAXB to change the result of the marshalling process, according to the * ISO-19139 standard and its requirements about {@code measures}. * * @param value The double value we want to integrate into a {@code } element. * @return An adaptation of the double value, that is to say a double value surrounded * by {@code } element, with an {@code uom} attribute. */ @Override public GO_Measure marshal(final Double value) { return (value != null) ? new GO_Measure(value) : null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy