/**
* Squidy Interaction 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 3 of the License,
* or (at your option) any later version.
*
* Squidy Interaction 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.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Squidy Interaction Library. If not, see
* <http://www.gnu.org/licenses/>.
*
* 2009 Human-Computer Interaction Group, University of Konstanz.
* <http://hci.uni-konstanz.de>
*
* Please contact info@squidy-lib.de or visit our website
* <http://www.squidy-lib.de> for further information.
*/
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.3-b01-fcs
// 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: 2007.06.29 at 11:07:26 AM CEST
//
package org.squidy.nodes.laserpointer.config.xml;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import org.squidy.nodes.laserpointer.configclient.config.PropertyTypeException;
/**
* <p>Java class for property complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="property">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="type" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="msg" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "property", propOrder = {
"content"
})
public class Property {
public static final String TYPE_FLOAT = "float";
public static final String TYPE_BOOLEAN = "boolean";
public static final String TYPE_STRING = "string";
public static final String TYPE_INT = "int";
public static final String CAM_AOIY = "aoiY";
public static final String CAM_AOIX = "aoiX";
public static final String CAM_AOIH = "aoiH";
public static final String CAM_AOIW = "aoiW";
public static final String CAM_PATTERNH = "patternH";
public static final String CAM_PATTERNW = "patternW";
public static final String CAM_PIXELCLOCK = "pixelclock";
public static final String CAM_EXPOSURE = "exposure";
public static final String CAM_FRAMERATE = "framerate";
public static final String CAM_PIXELCLOCK_CALIB = "pixelclock_calib";
public static final String CAM_EXPOSURE_CALIB = "exposure_calib";
public static final String CAM_FRAMERATE_CALIB = "framerate_calib";
public static final String CAM_PIXELCLOCK_TRACK = "pixelclock_track";
public static final String CAM_EXPOSURE_TRACK = "exposure_track";
public static final String CAM_FRAMERATE_TRACK = "framerate_track";
@XmlValue
protected String content;
@XmlAttribute(required = true)
protected String name;
@XmlAttribute(required = true)
protected String type;
@XmlAttribute
protected String msg;
@XmlTransient
protected Object contentObject;
public Property(String content, String name, String type, String msg) {
super();
this.content = content;
this.name = name;
this.type = type;
this.msg = msg;
}
public void update(Property p) {
this.content = p.content;
this.msg = p.msg;
this.name = p.name;
this.type = p.type;
}
@Override
public String toString() {
return getName() + "=" + getContent() + "(msg=\"" + getMsg() + "\")";
}
public Property(String name,String content) {
super();
this.content = content;
this.name = name;
}
public Property() {
super();
// TODO Auto-generated constructor stub
}
/**
* Copy constructor
* @author Jo Bieg
* @param p
*/
public Property(Property p) {
this.content = p.content;
this.msg = p.msg;
this.name = p.name;
this.type = p.type;
}
/**
* Gets the value of the content property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getContent() {
return content;
}
/**
* Sets the value of the content property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContent(String value) {
this.content = value;
}
/**
* 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;
}
/**
* Gets the value of the msg property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMsg() {
return msg;
}
/**
* Sets the value of the msg property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMsg(String value) {
this.msg = value;
}
public Object getContentObject() throws PropertyTypeException {
if(contentObject != null) return contentObject;
if(type.equalsIgnoreCase(Property.TYPE_INT)){
try {
contentObject = Integer.parseInt(content);
} catch(NumberFormatException e) {
throw new PropertyTypeException("Property " + name + " must be of type " + type+ ".");
}
} else
if(type.equalsIgnoreCase(Property.TYPE_FLOAT)) {
try {
contentObject = Float.parseFloat(content);
} catch(NumberFormatException e) {
throw new PropertyTypeException("Property " + name + " must be of type " + type+ ".");
}
} else
if(type.equalsIgnoreCase(Property.TYPE_STRING)) {
contentObject = new String(content);
}
else if(type.equalsIgnoreCase(Property.TYPE_BOOLEAN)) {
Boolean.parseBoolean(content);
}
else {
throw new PropertyTypeException("Property " + name + " is of unknown type.");
}
return contentObject;
}
public void setContentObject(Object contentObject) {
this.contentObject = contentObject;
}
}