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

org.ogema.serialization.jaxb.Resource Maven / Gradle / Ivy

There is a newer version: 2.2.1_1
Show newest version
/**
 * Copyright 2011-2018 Fraunhofer-Gesellschaft zur Förderung der angewandten Wissenschaften e.V.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
// See http://java.sun.com/xml/jaxb 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2013.09.13 at 08:01:54 AM CEST 
//
package org.ogema.serialization.jaxb;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;

import org.ogema.serialization.JaxbResource;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

/**
 *
 * Common basis class for a resource. All resources are either primitive
 * (FloatResource, BooleanResource, ...) or non-primitive (type Resource) or
 * schedules (FloatSchedule, ...). This defines common entries that all
 * resources can have. The same xml structures are used for PUT/POST and GET
 * commands. Therefore, few of the fields are defined as required, allowing
 * PUT/POST commands to be reduced to the minimum amount of information. For GET
 * requests, however, OGEMA should send as complete documents as possible.
 *
 *
 * 

* Java class for Resource complex type. * *

* The following schema fragment specifies the expected content contained within * this class. * *

 * <complexType name="Resource">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <group ref="{http://www.ogema-source.net/REST}CommonResourceElements"/>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Resource", propOrder = { "name", "type", "path", "decorating", "active", "referencing", "subresources" }) @XmlSeeAlso( { OpaqueResource.class, FloatResource.class, IntegerResource.class, StringResource.class, BooleanResource.class, ScheduleResource.class, TimeResource.class, BooleanSchedule.class, FloatSchedule.class, IntegerSchedule.class, StringSchedule.class, TimeSchedule.class, ResourceList.class, BooleanArrayResource.class, ByteArrayResource.class, FloatArrayResource.class, IntegerArrayResource.class, StringArrayResource.class, TimeArrayResource.class }) @XmlRootElement(name = "resource", namespace = JaxbResource.NS_OGEMA_REST) @JsonSubTypes( { @JsonSubTypes.Type(BooleanResource.class), @JsonSubTypes.Type(FloatResource.class), @JsonSubTypes.Type(IntegerResource.class), @JsonSubTypes.Type(OpaqueResource.class), @JsonSubTypes.Type(StringResource.class), @JsonSubTypes.Type(TimeResource.class), @JsonSubTypes.Type(ScheduleResource.class), @JsonSubTypes.Type(FloatSchedule.class), @JsonSubTypes.Type(IntegerSchedule.class), @JsonSubTypes.Type(TimeSchedule.class), @JsonSubTypes.Type(StringSchedule.class), @JsonSubTypes.Type(BooleanSchedule.class), @JsonSubTypes.Type(ResourceList.class), @JsonSubTypes.Type(BooleanArrayResource.class), @JsonSubTypes.Type(ByteArrayResource.class), @JsonSubTypes.Type(FloatArrayResource.class), @JsonSubTypes.Type(IntegerArrayResource.class), @JsonSubTypes.Type(StringArrayResource.class), @JsonSubTypes.Type(TimeArrayResource.class) }) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY) public class Resource { @XmlElement(required = true) protected String name; @XmlElement(required = true) protected String type; protected String path; protected Boolean decorating; protected Boolean active; @XmlSchemaType(name = "anyURI") protected String referencing; @XmlElements( { @XmlElement(name = "resource", type = Resource.class), @XmlElement(name = "resourcelink", type = ResourceLink.class) }) protected List subresources; /** * Gets the value of the name property. * * @return possible object is {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value allowed object is {@link String } * */ public void setName(String value) { this.name = value; } /** * Gets the value of the type property. * * @return possible object is {@link String } * */ public String getType() { return type; } /** * Sets the value of the type property. * * @param value allowed object is {@link String } * */ public void setType(String value) { this.type = value; } public void setType(Class clazz) { this.type = clazz.getCanonicalName(); } /** * Gets the value of the path property. * * @return possible object is {@link String } * */ public String getPath() { return path; } /** * Sets the value of the path property. * * @param value allowed object is {@link String } * */ public void setPath(String value) { this.path = value; } /** * Gets the value of the decorating property. * * @return possible object is {@link Boolean } * */ public Boolean isDecorating() { return decorating; } /** * Sets the value of the decorating property. * * @param value allowed object is {@link Boolean } * */ public void setDecorating(Boolean value) { this.decorating = value; } /** * Gets the value of the active property. * * @return possible object is {@link Boolean } * */ public Boolean isActive() { return active; } /** * Sets the value of the active property. * * @param value allowed object is {@link Boolean } * */ public void setActive(Boolean value) { this.active = value; } /** * Gets the value of the referencing property. * * @return possible object is {@link String } * */ public String getReferencing() { return referencing; } /** * Sets the value of the referencing property. * * @param value allowed object is {@link String } * */ public void setReferencing(String value) { this.referencing = value; } /** * Gets the value of the subresources property. * *

* This accessor method returns a reference to the live list, not a * snapshot. Therefore any modification you make to the returned list will * be present inside the JAXB object. This is why there is not a * set method for the subresources property. * *

* For example, to add a new item, do as follows: * *

	 * getSubresources().add(newItem);
	 * 
* * *

* Objects of the following type(s) are allowed in the list {@link Resource } {@link ResourceLink * } * * */ public List getSubresources() { if (subresources == null) { subresources = new ArrayList(); } return this.subresources; } public Resource get(String subresource) { for (Object o : getSubresources()) { if (o instanceof Resource) { if (((Resource) o).getName().equals(subresource)) { return (Resource) o; } } } return null; } }