Skip to content
Node.java 3.78 KiB
Newer Older
Sara Bertocco's avatar
Sara Bertocco committed
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2020.10.24 at 09:39:16 AM CEST 
//
package net.ivoa.xml.vospace.v2;

import com.fasterxml.jackson.annotation.JsonProperty;
Sara Bertocco's avatar
Sara Bertocco committed
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
import it.inaf.oats.vospace.datamodel.NodeTypeJsonResolver;
import java.util.ArrayList;
import java.util.List;
Sara Bertocco's avatar
Sara Bertocco committed
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
Sara Bertocco's avatar
Sara Bertocco committed
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
Sara Bertocco's avatar
Sara Bertocco committed
import javax.xml.bind.annotation.XmlType;

/**
 * 
 *         The base class for all nodes.
 *       
 * 
 * <p>Java class for Node complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
Sara Bertocco's avatar
Sara Bertocco committed
 * <pre>
 * &lt;complexType name="Node">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="properties" type="{http://www.ivoa.net/xml/VOSpace/v2.0}PropertyList" minOccurs="0"/>
 *       &lt;/sequence>
 *       &lt;attribute name="uri" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
Sara Bertocco's avatar
Sara Bertocco committed
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Node", propOrder = {
    "properties"
})
@XmlSeeAlso({
    LinkNode.class,
    DataNode.class
})
Sara Bertocco's avatar
Sara Bertocco committed
@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, property = "type", include = JsonTypeInfo.As.EXISTING_PROPERTY)
@JsonTypeIdResolver(NodeTypeJsonResolver.class)
Sara Bertocco's avatar
Sara Bertocco committed
public class Node {

    // Auto-generated class defined a PropertyList wrapper class.
Sonia Zorba's avatar
Sonia Zorba committed
    @XmlElement(name = "property")
    @XmlElementWrapper(name = "properties", required = false)
    protected List<Property> properties;

    // Used for generating missing type attribute for root node. For child nodes it is filled automatically.
    @XmlAttribute(name = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance", required = false)
    private String type;

    /* This method exists to fix the issue with type attribute. See RemoveDuplicateTypeAdapter class. */
    public void removeType() {
        this.type = null;
    }
    
    public Node() {
        type = getType();
    }
    
    // Needed for handling inheritance in JSON (in XML, type attribute is automatically generated by JAXB).
    @JsonProperty
    @XmlTransient
    public final String getType() {
        return "vos:" + getClass().getSimpleName();
Sara Bertocco's avatar
Sara Bertocco committed
    }
Sara Bertocco's avatar
Sara Bertocco committed

    @XmlAttribute(name = "uri", required = true)
    @XmlSchemaType(name = "anyURI")
    protected String uri;

    // <edit>
    public List<Property> getProperties() {
        if (properties == null) {
            properties = new ArrayList<>();
        }
Sara Bertocco's avatar
Sara Bertocco committed
        return properties;
    }

    public void setProperties(List<Property> value) {
Sara Bertocco's avatar
Sara Bertocco committed
        this.properties = value;
    }
Sara Bertocco's avatar
Sara Bertocco committed

    /**
     * Gets the value of the uri property.
     *
     * @return possible object is {@link String }
     *
     */
    public String getUri() {
        return uri;
    }

    /**
     * Sets the value of the uri property.
     *
     * @param value allowed object is {@link String }
     *
     */
    public void setUri(String value) {
        this.uri = value;
    }

}