/*
* 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.sml.xml.v100;
import java.util.Objects;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import org.geotoolkit.sml.xml.Component;
import org.apache.sis.util.ComparisonMode;
/**
* <p>Java class for ComponentType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ComponentType">
* <complexContent>
* <extension base="{http://www.opengis.net/sensorML/1.0}AbstractComponentType">
* <sequence>
* <element ref="{http://www.opengis.net/sensorML/1.0}method" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
* @module
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ComponentType")
public class ComponentType extends AbstractComponentType implements Component {
private MethodPropertyType method;
public ComponentType() {
}
public ComponentType(final Component cp) {
super(cp);
if (cp != null && cp.getMethod() != null) {
this.method = new MethodPropertyType(cp.getMethod());
}
}
/**
* @return the method
*/
public MethodPropertyType getMethod() {
return method;
}
/**
* @param method the method to set
*/
public void setMethod(final MethodPropertyType method) {
this.method = method;
}
/**
* 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 ComponentType && super.equals(object, mode)) {
final ComponentType that = (ComponentType) object;
return Objects.equals(this.method, that.method);
}
return false;
}
@Override
public int hashCode() {
int hash = 3;
hash = 17 * hash + (this.method != null ? this.method.hashCode() : 0);
return hash;
}
@Override
public String toString() {
StringBuilder s = new StringBuilder(super.toString());
if (method != null)
s.append("method:").append(method).append('\n');
return s.toString();
}
}