/* * Geotoolkit - An Open Source Java GIS Toolkit * http://www.geotoolkit.org * * (C) 2008 - 2009, 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; either * version 2.1 of the License, or (at your option) any later version. * * 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.gml.xml.v311; import java.util.Objects; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; import org.apache.sis.util.ComparisonMode; import org.geotoolkit.util.Utilities; /** * Basic encoding for datum objects, simplifying and restricting the DefinitionType as needed. * * <p>Java class for AbstractDatumBaseType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * <complexType name="AbstractDatumBaseType"> * <complexContent> * <restriction base="{http://www.opengis.net/gml}DefinitionType"> * <sequence> * <element ref="{http://www.opengis.net/gml}metaDataProperty" maxOccurs="unbounded" minOccurs="0"/> * <element ref="{http://www.opengis.net/gml}datumName"/> * </sequence> * <attribute ref="{http://www.opengis.net/gml}id use="required""/> * </restriction> * </complexContent> * </complexType> * </pre> * * * @module */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AbstractDatumBaseType") @XmlSeeAlso({ AbstractDatumType.class }) public abstract class AbstractDatumBaseType extends DefinitionType { @XmlElement(name = "datumName", namespace = "http://www.opengis.net/gml") private String datumName; public AbstractDatumBaseType() { } public AbstractDatumBaseType(final String id, final String datumName) { super(id); this.datumName = datumName; } /** * @return the datumName */ public String getDatumName() { return datumName; } /** * @param datumName the datumName to set */ public void setDatumName(final String datumName) { this.datumName = datumName; } @Override public String toString() { StringBuilder sb = new StringBuilder(super.toString()).append("\n"); if (datumName != null) { sb.append("datumName: ").append(datumName).append('\n'); } return sb.toString(); } /** * Verify if this entry is identical to specified object. */ @Override public boolean equals(final Object object, final ComparisonMode mode) { if (object == this) { return true; } if (object instanceof AbstractDatumType && super.equals(object, mode)) { final AbstractDatumType that = (AbstractDatumType) object; return Objects.equals(this.datumName, that.getDatumName()); } return false; } @Override public int hashCode() { int hash = 7; hash = 41 * hash + (this.datumName != null ? this.datumName.hashCode() : 0); return hash; } }