/******************************************************************************* | |
* Copyright (c) 2013-2015 LAAS-CNRS (www.laas.fr) | |
* 7 Colonel Roche 31077 Toulouse - France | |
* | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v1.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v10.html | |
* | |
* Contributors: | |
* Thierry Monteil (Project co-founder) - Management and initial specification, | |
* conception and documentation. | |
* Mahdi Ben Alaya (Project co-founder) - Management and initial specification, | |
* conception, implementation, test and documentation. | |
* Christophe Chassot - Management and initial specification. | |
* Khalil Drira - Management and initial specification. | |
* Yassine Banouar - Initial specification, conception, implementation, test | |
* and documentation. | |
* Guillaume Garzone - Conception, implementation, test and documentation. | |
* Francois Aissaoui - Conception, implementation, test and documentation. | |
******************************************************************************/ | |
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 | |
// 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: 2014.01.25 at 05:56:27 PM CET | |
// | |
package org.eclipse.om2m.commons.resource; | |
import java.util.Arrays; | |
import javax.persistence.Column; | |
import javax.persistence.Embeddable; | |
import javax.xml.bind.annotation.XmlAccessType; | |
import javax.xml.bind.annotation.XmlAccessorType; | |
import javax.xml.bind.annotation.XmlAttribute; | |
import javax.xml.bind.annotation.XmlType; | |
import javax.xml.bind.annotation.XmlValue; | |
import org.eclipse.om2m.commons.utils.XmlMapper; | |
/** | |
* <p>Java class for base64Binary complex type. | |
* | |
* <p>The following schema fragment specifies the expected content contained within this class. | |
* | |
* <pre> | |
* <complexType name="base64Binary"> | |
* <simpleContent> | |
* <extension base="<http://www.w3.org/2001/XMLSchema>base64Binary"> | |
* <attribute ref="{http://www.w3.org/2005/05/xmlmime}contentType"/> | |
* </extension> | |
* </simpleContent> | |
* </complexType> | |
* </pre> | |
* | |
* | |
*/ | |
@XmlAccessorType(XmlAccessType.FIELD) | |
@XmlType(name = "base64Binary", namespace = "http://www.w3.org/2005/05/xmlmime", propOrder = { | |
"value" | |
}) | |
@Embeddable | |
public class Base64Binary { | |
@XmlValue | |
protected byte[] value; | |
@XmlAttribute(name = "contentType", namespace = "http://www.w3.org/2005/05/xmlmime") | |
@Column(name="contentTypeBase64Binary") | |
protected String contentType; | |
/** | |
* Gets the value of the value property. | |
* | |
* @return | |
* possible object is | |
* byte[] | |
*/ | |
public byte[] getValue() { | |
return value; | |
} | |
/** | |
* Sets the value of the value property. | |
* | |
* @param value | |
* allowed object is | |
* byte[] | |
*/ | |
public void setValue(byte[] val) { | |
if (val == null) { | |
this.value = new byte[0]; | |
} else { | |
this.value = Arrays.copyOf(val, val.length); | |
} | |
} | |
public void setValue(Resource resource) { | |
this.value= XmlMapper.getInstance().objectToXml(resource).getBytes(); | |
} | |
/** | |
* Gets the value of the contentType property. | |
* | |
* @return | |
* possible object is | |
* {@link String } | |
* | |
*/ | |
public String getContentType() { | |
return contentType; | |
} | |
/** | |
* Sets the value of the contentType property. | |
* | |
* @param value | |
* allowed object is | |
* {@link String } | |
* | |
*/ | |
public void setContentType(String value) { | |
this.contentType = value; | |
} | |
public String toString() { | |
return "Base64Binary [value=" + Arrays.toString(value) | |
+ ", contentType=" + contentType + "]"; | |
} | |
} |