/* * Geotoolkit - An Open Source Java GIS Toolkit * http://www.geotoolkit.org * * (C) 2008 - 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; 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.ogc.xml.v200; import java.util.Objects; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlType; import org.geotoolkit.util.Utilities; import org.opengis.filter.FilterVisitor; /** * <p>Java class for PropertyIsNullType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * <complexType name="PropertyIsNullType"> * <complexContent> * <extension base="{http://www.opengis.net/fes/2.0}ComparisonOpsType"> * <sequence> * <element ref="{http://www.opengis.net/fes/2.0}expression" minOccurs="0"/> * </sequence> * </extension> * </complexContent> * </complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PropertyIsNullType", propOrder = { "expression" }) public class PropertyIsNullType extends ComparisonOpsType { @XmlElementRef(name = "expression", namespace = "http://www.opengis.net/fes/2.0", type = JAXBElement.class) private JAXBElement<?> expression; public PropertyIsNullType() { } public PropertyIsNullType(final PropertyIsNullType that) { if (that != null) { if (that.expression != null) { final ObjectFactory factory = new ObjectFactory(); final Object exp = that.expression.getValue(); if (exp instanceof String) { this.expression = factory.createValueReference((String)exp); } else if (exp instanceof LiteralType) { final LiteralType lit = new LiteralType((LiteralType)exp); this.expression = factory.createLiteral(lit); } else if (exp instanceof FunctionType) { final FunctionType func = new FunctionType((FunctionType)exp); this.expression = factory.createFunction(func); } else { throw new IllegalArgumentException("Unexpected type for expression in PropertyIsNullType:" + expression.getClass().getName()); } } } } public String getPropertyName() { if (expression != null && expression.getValue() instanceof String) { return (String)expression.getValue(); } return null; } /** * Gets the value of the expression property. * * @return * possible object is * {@link JAXBElement }{@code <}{@link LiteralType }{@code >} * {@link JAXBElement }{@code <}{@link Object }{@code >} * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link JAXBElement }{@code <}{@link FunctionType }{@code >} * */ public JAXBElement<?> getExpression() { return expression; } /** * Sets the value of the expression property. * * @param value * allowed object is * {@link JAXBElement }{@code <}{@link LiteralType }{@code >} * {@link JAXBElement }{@code <}{@link Object }{@code >} * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link JAXBElement }{@code <}{@link FunctionType }{@code >} * */ public void setExpression(JAXBElement<?> value) { this.expression = ((JAXBElement<?> ) value); } @Override public boolean evaluate(final Object object) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object accept(final FilterVisitor visitor, final Object extraData) { throw new UnsupportedOperationException("Not supported yet."); } @Override public ComparisonOpsType getClone() { return new PropertyIsNullType(this); } @Override public String toString() { final StringBuilder s = new StringBuilder(super.toString()); if (expression != null) { s.append("expression: ").append(expression.getValue()).append('\n'); } return s.toString(); } @Override public int hashCode() { int hash = 3; hash = 67 * hash + (this.expression != null ? this.expression.hashCode() : 0); return hash; } @Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (obj instanceof PropertyIsNullType) { final PropertyIsNullType that = (PropertyIsNullType) obj; if (this.expression == null && that.expression == null) { return true; } else if (this.expression != null && that.expression != null) { return Objects.equals(this.expression.getValue(), that.expression.getValue()); } else { return false; } } return false; } }