droppped jaxb from objects.

This commit is contained in:
Willem 2016-10-24 17:53:20 +02:00
parent 5d95084252
commit 8bb27c09c6
25 changed files with 20 additions and 651 deletions

View file

@ -1,99 +0,0 @@
/*
* Copyright (c) 2013-2015, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.unitxc.model;
/**
* ModelXMLInfoSet has all jaxb meta info.
*
* @author Willem Cazander
* @version 1.0 Jan 16, 2015
*/
public class ModelJAXBInfoSet {
protected ModelJAXBInfoSet() {
}
protected static class Meta {
protected static final boolean REQUIRED = true;
protected Meta() {
}
}
public static class Element {
protected static final String UNIT_CONFIG = "unitConfig";
protected static final String UNIT_GROUP = "unitGroup";
protected static final String UNIT_TYPE = "unitType";
protected static final String DESCRIPTION = "description";
protected static final String CONVERTER_RESULT = "converterResult";
protected static final String CONVERTER_RESULT_STEP = "converterResultStep";
protected static final String DERIVED_FROM = "derivedFrom";
protected static final String TYPE_FLAG = "typeFlag";
protected static final String TYPE_FLAGS = "typeFlags";
protected static final String WEBSITE_LINK = "websiteLink";
protected static final String WEBSITE_LINKS = "websiteLinks";
protected static final String GROUP_JUMP = "groupJump";
protected static final String GROUP_JUMP_PARAMETER = "groupJumpParameter";
public static final String STEP_REASON = "stepReason";
public static final String STEP_REASONS = "stepReasons";
public static final String OPERATION = "operation";
public static final String CONDITION = "condition";
public static final String REFERENCE = "reference";
public static final String POWER_10 = "power10";
public static final String ROUNDING = "rounding";
public static final String NAMED_VARIABLE = "namedVariable";
public static final String NAMED_PARAMETER = "namedParameter";
public static final String VALUE_DOUBLE = "valueDouble";
public static final String VALUE_DOUBLE_FRACTION = "valueDoubleFraction";
public static final String VALUE_INTEGER = "valueInteger";
public static final String VALUE_STRING = "valueString";
protected Element() {
}
}
public static class Attribute {
protected static final String ID = "id";
public static final String NAME = "name";
protected static final String NAME_PLURAL = "namePlural";
protected static final String UNIT_GROUP_ID = "unitGroupId";
protected static final String START_VALUE = "startValue";
protected static final String RESULT_VALUE = "resultValue";
protected static final String CONVERT_TIME = "convertTime";
protected static final String START_TYPE_ID = "startTypeId";
protected static final String RESULT_TYPE_ID = "resultTypeId";
protected static final String BASE_TYPE_ID = "baseTypeId";
protected static final String GROUP_LEVEL = "groupLevel";
protected static final String ALIAS_OF_TYPE = "aliasOfType";
protected static final String ROUNDING = "rounding";
protected Attribute() {
}
}
}

View file

@ -1,117 +0,0 @@
/*
* Copyright (c) 2013-2015, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.unitxc.model;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import org.apache.commons.lang3.ArrayUtils;
import net.forwardfire.unitxc.model.step.UnitXCConverterStepAutoRounding;
import net.forwardfire.unitxc.model.step.UnitXCConverterStepCondition;
import net.forwardfire.unitxc.model.step.UnitXCConverterStepOperation;
import net.forwardfire.unitxc.model.step.UnitXCConverterStepPowerOfTen;
import net.forwardfire.unitxc.model.step.UnitXCConverterStepReference;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueNamedParameter;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueNamedVariable;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReferenceDouble;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReferenceDoubleFraction;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReferenceInteger;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReferenceString;
/**
* Jaxb marshaller of the query sets.
*
* @author Willem Cazander
* @version 1.0 Jan 14, 2015
*/
public class ModelJAXBMarshaller {
private final ModelJAXBTypedMarshaller<UnitXCConfig> configModelMarshaller;
private final ModelJAXBTypedMarshaller<UnitXCGroup> groupModelMarshaller;
private final ModelJAXBTypedMarshaller<UnitXCType> typeModelMarshaller;
private final ModelJAXBTypedMarshaller<UnitXConverterResult> resultModelMarshaller;
private final static Class<?>[] JAXB_TYPES = new Class<?>[] {
UnitXCConfig.class,
UnitXCGroup.class,
UnitXConverterResult.class,
UnitXCConverterStepReference.class,
UnitXCConverterStepOperation.class,
UnitXCConverterStepCondition.class,
UnitXCConverterStepPowerOfTen.class,
UnitXCConverterStepAutoRounding.class,
UnitXConverterStepValueNamedParameter.class,
UnitXConverterStepValueNamedVariable.class,
UnitXConverterStepValueReferenceDouble.class,
UnitXConverterStepValueReferenceDoubleFraction.class,
UnitXConverterStepValueReferenceInteger.class,
UnitXConverterStepValueReferenceString.class,
};
public ModelJAXBMarshaller() throws JAXBException {
this(new Class<?>[]{});
}
public ModelJAXBMarshaller(Class<?>[] extraTypes) throws JAXBException {
this(JAXBContext.newInstance(ArrayUtils.addAll(getJAXBTypes(), extraTypes)));
}
public ModelJAXBMarshaller(JAXBContext jaxbContext) throws JAXBException {
this(XMLInputFactory.newInstance(),XMLOutputFactory.newInstance(),jaxbContext);
}
public ModelJAXBMarshaller(XMLInputFactory xmlInputFactory,XMLOutputFactory xmlOutputFactory, JAXBContext jaxbContext) {
this.configModelMarshaller = buildTypedMarshaller(UnitXCConfig.class, xmlInputFactory, xmlOutputFactory, jaxbContext);
this.groupModelMarshaller = buildTypedMarshaller(UnitXCGroup.class, xmlInputFactory, xmlOutputFactory, jaxbContext);
this.typeModelMarshaller = buildTypedMarshaller(UnitXCType.class, xmlInputFactory, xmlOutputFactory, jaxbContext);
this.resultModelMarshaller = buildTypedMarshaller(UnitXConverterResult.class, xmlInputFactory, xmlOutputFactory, jaxbContext);
}
public static Class<?>[] getJAXBTypes() {
return JAXB_TYPES;
}
public ModelJAXBTypedMarshaller<UnitXCConfig> getUnitXCConfig() {
return configModelMarshaller;
}
public ModelJAXBTypedMarshaller<UnitXCGroup> getUnitXCGroup() {
return groupModelMarshaller;
}
public ModelJAXBTypedMarshaller<UnitXCType> getUnitXCType() {
return typeModelMarshaller;
}
public ModelJAXBTypedMarshaller<UnitXConverterResult> getUnitXConverterResult() {
return resultModelMarshaller;
}
private static <T> ModelJAXBTypedMarshaller<T> buildTypedMarshaller(Class<T> typeClass,XMLInputFactory xmlInputFactory,XMLOutputFactory xmlOutputFactory, JAXBContext jaxbContext) {
return new ModelJAXBTypedMarshaller<T>(typeClass,xmlInputFactory,xmlOutputFactory,jaxbContext);
}
}

View file

@ -1,59 +0,0 @@
/*
* Copyright (c) 2013-2015, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.unitxc.model;
import javax.xml.bind.annotation.XmlAnyElement;
/**
*
*
* @author Willem Cazander
* @version 1.0 Apr 3, 2016
*/
public class ModelJAXBObjectWrap<T> {
private T value;
public ModelJAXBObjectWrap() {
}
public ModelJAXBObjectWrap(T value) {
setValue(value);
}
/**
* @return the value
*/
@XmlAnyElement
public T getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(T value) {
this.value = value;
}
}

View file

@ -1,44 +0,0 @@
/*
* Copyright (c) 2013-2015, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.unitxc.model;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
* Adds extra wrap tag to any object.
*
* @author Willem Cazander
* @version 1.0 Apr 3, 2016
*/
public class ModelJAXBObjectWrapAdapter extends XmlAdapter<ModelJAXBObjectWrap<?>, Object> {
@Override
public Object unmarshal(ModelJAXBObjectWrap<?> v) throws Exception {
return v.getValue();
}
@Override
public ModelJAXBObjectWrap<?> marshal(Object v) throws Exception {
return new ModelJAXBObjectWrap<Object>(v);
}
}

View file

@ -1,152 +0,0 @@
package net.forwardfire.unitxc.model;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
public class ModelJAXBTypedMarshaller<T> {
private final Class<T> typeClass;
private final XMLInputFactory xmlInputFactory;
private final XMLOutputFactory xmlOutputFactory;
private final JAXBContext jaxbContext;
public ModelJAXBTypedMarshaller(Class<T> typeClass, XMLInputFactory xmlInputFactory,
XMLOutputFactory xmlOutputFactory, JAXBContext jaxbContext) {
this.typeClass = Validate.notNull(typeClass);
this.xmlInputFactory = Validate.notNull(xmlInputFactory);
this.xmlOutputFactory = Validate.notNull(xmlOutputFactory);
this.jaxbContext = Validate.notNull(jaxbContext);
}
protected Unmarshaller createUnmarshaller() throws JAXBException {
return jaxbContext.createUnmarshaller();
}
protected Marshaller createMarshaller(String encoding) throws JAXBException {
Validate.notNull(encoding, "encoding is null.");
Marshaller marshaller = jaxbContext.createMarshaller();
//marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // done by stax proxy now
marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding);
return marshaller;
}
public void marshal(T jaxbElement, XMLStreamWriter writer) throws JAXBException {
marshal(jaxbElement, writer, StandardCharsets.UTF_8.name());
}
public void marshal(T jaxbElement, XMLStreamWriter writer, String encoding) throws JAXBException {
Validate.notNull(jaxbElement, "jaxbElement is null.");
Validate.notNull(writer, "reader is null.");
Validate.notNull(encoding, "encoding is null.");
createMarshaller(encoding).marshal(jaxbElement, writer);
}
public void marshal(T jaxbElement, OutputStream output) throws JAXBException, XMLStreamException {
marshal(jaxbElement, output, StandardCharsets.UTF_8.name());
}
public void marshal(T jaxbElement, OutputStream output, String encoding) throws JAXBException, XMLStreamException {
Validate.notNull(jaxbElement, "jaxbElement is null.");
Validate.notNull(output, "ouput is null.");
Validate.notNull(encoding, "encoding is null.");
marshal(jaxbElement, IndentingXMLStreamWriterProxy.wrap(xmlOutputFactory.createXMLStreamWriter(output, encoding)), encoding);
}
public T unmarshal(XMLStreamReader reader) throws JAXBException {
Validate.notNull(reader, "reader is null.");
return createUnmarshaller().unmarshal(reader, typeClass).getValue();
}
public T unmarshal(InputStream input, String encoding) throws JAXBException, XMLStreamException {
Validate.notNull(input, "input is null.");
Validate.notNull(encoding, "encoding is null.");
return unmarshal(xmlInputFactory.createXMLStreamReader(input, encoding));
}
public T unmarshal(InputStream input) throws JAXBException, XMLStreamException {
return unmarshal(input, StandardCharsets.UTF_8.name());
}
static class IndentingXMLStreamWriterProxy implements InvocationHandler {
private final XMLStreamWriter target;
private int depth = 0;
private boolean firstLine = true;
private final Map<Integer, Boolean> hasChildElement = new HashMap<>();
public IndentingXMLStreamWriterProxy(XMLStreamWriter target) {
this.target = Validate.notNull(target);
}
public static XMLStreamWriter wrap(XMLStreamWriter writer) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
IndentingXMLStreamWriterProxy.class.getClassLoader();
}
return (XMLStreamWriter) Proxy.newProxyInstance(cl, new Class<?>[]{XMLStreamWriter.class}, new IndentingXMLStreamWriterProxy(writer));
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String m = method.getName();
// Needs to be BEFORE the actual event, so that for instance the
// sequence writeStartElem, writeAttr, writeStartElem, writeEndElem,writeEndElem
// is correctly handled
if ("writeStartElement".equals(m)) {
// update state of parent node
if (depth > 0) {
hasChildElement.put(depth - 1, true);
}
// reset state of current node
hasChildElement.put(depth, false);
// indent for current depth
if (!firstLine) {
writeLineWrap();
}
depth++;
} else if ("writeEndElement".equals(m)) {
depth--;
if (hasChildElement.get(depth) == true) {
writeLineWrap();
}
} else if ("writeEmptyElement".equals(m)) {
// update state of parent node
if (depth > 0) {
hasChildElement.put(depth - 1, true);
}
writeLineWrap();
} else if ("writeComment".equals(m)) {
writeLineWrap();
} else if ("writeEndDocument".equals(m)) {
target.writeCharacters(StringUtils.LF);
}
method.invoke(target, args);
firstLine = false;
return null;
}
private void writeLineWrap() throws XMLStreamException {
target.writeCharacters(StringUtils.LF);
// indent for current depth
target.writeCharacters(StringUtils.repeat(StringUtils.SPACE, depth));
}
}
}

View file

@ -26,10 +26,6 @@ package net.forwardfire.unitxc.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
/** /**
@ -38,7 +34,6 @@ import org.apache.commons.lang3.Validate;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Oct 17, 2015 * @version 1.0 Oct 17, 2015
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.UNIT_CONFIG)
public class UnitXCConfig { public class UnitXCConfig {
private UnitXCRounding rounding; private UnitXCRounding rounding;
@ -51,7 +46,6 @@ public class UnitXCConfig {
/** /**
* @return the rounding * @return the rounding
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.ROUNDING)
public UnitXCRounding getRounding() { public UnitXCRounding getRounding() {
return rounding; return rounding;
} }
@ -66,7 +60,6 @@ public class UnitXCConfig {
/** /**
* @return the unit groups. * @return the unit groups.
*/ */
@XmlElement(name=ModelJAXBInfoSet.Element.UNIT_GROUP)
public List<UnitXCGroup> getUnitGroups() { public List<UnitXCGroup> getUnitGroups() {
return unitGroups; return unitGroups;
} }

View file

@ -26,12 +26,6 @@ package net.forwardfire.unitxc.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
@ -41,7 +35,6 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Oct 10, 2015 * @version 1.0 Oct 10, 2015
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.UNIT_GROUP)
public class UnitXCGroup { public class UnitXCGroup {
private String id; private String id;
@ -81,7 +74,6 @@ public class UnitXCGroup {
/** /**
* @return the id * @return the id
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.ID)
public String getId() { public String getId() {
return id; return id;
} }
@ -95,7 +87,6 @@ public class UnitXCGroup {
/** /**
* @return the name * @return the name
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.NAME)
public String getName() { public String getName() {
return name; return name;
} }
@ -110,7 +101,6 @@ public class UnitXCGroup {
/** /**
* @return the description * @return the description
*/ */
@XmlElement(name=ModelJAXBInfoSet.Element.DESCRIPTION)
public String getDescription() { public String getDescription() {
return description; return description;
} }
@ -125,7 +115,6 @@ public class UnitXCGroup {
/** /**
* @return the baseTypeId * @return the baseTypeId
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.BASE_TYPE_ID)
public String getBaseTypeId() { public String getBaseTypeId() {
return baseTypeId; return baseTypeId;
} }
@ -140,7 +129,6 @@ public class UnitXCGroup {
/** /**
* @return the groupLevel * @return the groupLevel
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.GROUP_LEVEL)
public UnitXCGroupLevel getGroupLevel() { public UnitXCGroupLevel getGroupLevel() {
return groupLevel; return groupLevel;
} }
@ -155,8 +143,6 @@ public class UnitXCGroup {
/** /**
* @return the derivedFrom * @return the derivedFrom
*/ */
@XmlElement(name=ModelJAXBInfoSet.Element.DERIVED_FROM)
@XmlElementWrapper
public List<String> getDerivedFrom() { public List<String> getDerivedFrom() {
return derivedFrom; return derivedFrom;
} }
@ -172,8 +158,6 @@ public class UnitXCGroup {
/** /**
* @return the unit types. * @return the unit types.
*/ */
@XmlElement(name=ModelJAXBInfoSet.Element.UNIT_TYPE)
@XmlElementWrapper
public List<UnitXCType> getUnitTypes() { public List<UnitXCType> getUnitTypes() {
return unitTypes; return unitTypes;
} }
@ -196,8 +180,6 @@ public class UnitXCGroup {
/** /**
* @return the groupJumps * @return the groupJumps
*/ */
@XmlElement(name=ModelJAXBInfoSet.Element.GROUP_JUMP)
@XmlElementWrapper
public List<UnitXCGroupJump> getGroupJumps() { public List<UnitXCGroupJump> getGroupJumps() {
return groupJumps; return groupJumps;
} }
@ -213,7 +195,6 @@ public class UnitXCGroup {
/** /**
* @return the typeGenerator * @return the typeGenerator
*/ */
@XmlTransient
public UnitXCTypeGenerator getTypeGenerator() { public UnitXCTypeGenerator getTypeGenerator() {
return typeGenerator; return typeGenerator;
} }

View file

@ -26,11 +26,6 @@ package net.forwardfire.unitxc.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import net.forwardfire.unitxc.model.step.UnitXConverterStep; import net.forwardfire.unitxc.model.step.UnitXConverterStep;
@ -62,7 +57,6 @@ public class UnitXCGroupJump {
/** /**
* @return the id * @return the id
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.ID)
public String getId() { public String getId() {
return id; return id;
} }
@ -76,7 +70,6 @@ public class UnitXCGroupJump {
/** /**
* @return the toGroupId * @return the toGroupId
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.UNIT_GROUP_ID)
public String getUnitGroupId() { public String getUnitGroupId() {
return unitGroupId; return unitGroupId;
} }
@ -91,8 +84,6 @@ public class UnitXCGroupJump {
/** /**
* @return the toGroupConverterSteps * @return the toGroupConverterSteps
*/ */
@XmlElementWrapper
@XmlAnyElement
public List<UnitXConverterStep> getToGroupConverterSteps() { public List<UnitXConverterStep> getToGroupConverterSteps() {
return toGroupConverterSteps; return toGroupConverterSteps;
} }
@ -108,8 +99,6 @@ public class UnitXCGroupJump {
/** /**
* @return the jumpParameters * @return the jumpParameters
*/ */
@XmlElementWrapper
@XmlElement(name=ModelJAXBInfoSet.Element.GROUP_JUMP_PARAMETER)
public List<UnitXCGroupJumpParameter> getJumpParameters() { public List<UnitXCGroupJumpParameter> getJumpParameters() {
return jumpParameters; return jumpParameters;
} }

View file

@ -23,11 +23,8 @@
package net.forwardfire.unitxc.model; package net.forwardfire.unitxc.model;
import javax.xml.bind.annotation.XmlAttribute;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
/** /**
* The unit group jump. * The unit group jump.
* *
@ -56,7 +53,6 @@ public class UnitXCGroupJumpParameter {
/** /**
* @return the id * @return the id
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.ID)
public String getId() { public String getId() {
return id; return id;
} }
@ -70,7 +66,6 @@ public class UnitXCGroupJumpParameter {
/** /**
* @return the unitGroupId * @return the unitGroupId
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.UNIT_GROUP_ID)
public String getUnitGroupId() { public String getUnitGroupId() {
return unitGroupId; return unitGroupId;
} }

View file

@ -26,12 +26,6 @@ package net.forwardfire.unitxc.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
@ -73,7 +67,6 @@ public class UnitXCType {
/** /**
* @return the id * @return the id
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.ID)
public String getId() { public String getId() {
return id; return id;
} }
@ -87,7 +80,6 @@ public class UnitXCType {
/** /**
* @return the name * @return the name
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.NAME)
public String getName() { public String getName() {
return name; return name;
} }
@ -102,7 +94,6 @@ public class UnitXCType {
/** /**
* @return the namePlural * @return the namePlural
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.NAME_PLURAL)
public String getNamePlural() { public String getNamePlural() {
return namePlural; return namePlural;
} }
@ -117,7 +108,6 @@ public class UnitXCType {
/** /**
* @return the aliasOfType * @return the aliasOfType
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.ALIAS_OF_TYPE)
public String getAliasOfType() { public String getAliasOfType() {
return aliasOfType; return aliasOfType;
} }
@ -132,7 +122,6 @@ public class UnitXCType {
/** /**
* @return the unitGroup * @return the unitGroup
*/ */
@XmlTransient
public UnitXCGroup getUnitGroup() { public UnitXCGroup getUnitGroup() {
return unitGroup; return unitGroup;
} }
@ -147,8 +136,6 @@ public class UnitXCType {
/** /**
* @return the toBaseConverterSteps * @return the toBaseConverterSteps
*/ */
@XmlElementWrapper
@XmlAnyElement
public List<UnitXConverterStep> getToBaseConverterSteps() { public List<UnitXConverterStep> getToBaseConverterSteps() {
return toBaseConverterSteps; return toBaseConverterSteps;
} }
@ -164,8 +151,6 @@ public class UnitXCType {
/** /**
* @return the fromBaseConverterSteps * @return the fromBaseConverterSteps
*/ */
@XmlElementWrapper
@XmlAnyElement
public List<UnitXConverterStep> getFromBaseConverterSteps() { public List<UnitXConverterStep> getFromBaseConverterSteps() {
return fromBaseConverterSteps; return fromBaseConverterSteps;
} }
@ -181,8 +166,6 @@ public class UnitXCType {
/** /**
* @return the typeFlags * @return the typeFlags
*/ */
@XmlElement(name=ModelJAXBInfoSet.Element.TYPE_FLAG)
@XmlElementWrapper(name=ModelJAXBInfoSet.Element.TYPE_FLAGS)
public List<String> getTypeFlags() { public List<String> getTypeFlags() {
return typeFlags; return typeFlags;
} }
@ -198,8 +181,6 @@ public class UnitXCType {
/** /**
* @return the websiteLinks * @return the websiteLinks
*/ */
@XmlElement(name=ModelJAXBInfoSet.Element.WEBSITE_LINK)
@XmlElementWrapper(name=ModelJAXBInfoSet.Element.WEBSITE_LINKS)
public List<String> getWebsiteLinks() { public List<String> getWebsiteLinks() {
return websiteLinks; return websiteLinks;
} }

View file

@ -25,9 +25,7 @@ package net.forwardfire.unitxc.model;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAttribute; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/** /**
* Holds the convert result and meta steps how we got there. * Holds the convert result and meta steps how we got there.
@ -35,7 +33,6 @@ import javax.xml.bind.annotation.XmlRootElement;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Oct 17, 2015 * @version 1.0 Oct 17, 2015
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.CONVERTER_RESULT)
public class UnitXConverterResult { public class UnitXConverterResult {
private Double startValue; private Double startValue;
@ -48,7 +45,6 @@ public class UnitXConverterResult {
/** /**
* @return the startValue * @return the startValue
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.START_VALUE)
public Double getStartValue() { public Double getStartValue() {
return startValue; return startValue;
} }
@ -63,7 +59,6 @@ public class UnitXConverterResult {
/** /**
* @return the resultSteps * @return the resultSteps
*/ */
@XmlElement(name=ModelJAXBInfoSet.Element.CONVERTER_RESULT_STEP)
public List<UnitXConverterResultStep> getResultSteps() { public List<UnitXConverterResultStep> getResultSteps() {
return resultSteps; return resultSteps;
} }
@ -78,7 +73,6 @@ public class UnitXConverterResult {
/** /**
* @return the resultValue * @return the resultValue
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.RESULT_VALUE)
public Double getResultValue() { public Double getResultValue() {
return resultValue; return resultValue;
} }
@ -93,7 +87,6 @@ public class UnitXConverterResult {
/** /**
* @return the convertTime * @return the convertTime
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.CONVERT_TIME)
public Long getConvertTime() { public Long getConvertTime() {
return convertTime; return convertTime;
} }
@ -108,7 +101,6 @@ public class UnitXConverterResult {
/** /**
* @return the startTypeId * @return the startTypeId
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.START_TYPE_ID)
public String getStartTypeId() { public String getStartTypeId() {
return startTypeId; return startTypeId;
} }
@ -123,7 +115,6 @@ public class UnitXConverterResult {
/** /**
* @return the resultTypeId * @return the resultTypeId
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.RESULT_TYPE_ID)
public String getResultTypeId() { public String getResultTypeId() {
return resultTypeId; return resultTypeId;
} }
@ -134,4 +125,9 @@ public class UnitXConverterResult {
public void setResultTypeId(String resultTypeId) { public void setResultTypeId(String resultTypeId) {
this.resultTypeId = resultTypeId; this.resultTypeId = resultTypeId;
} }
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
} }

View file

@ -23,8 +23,7 @@
package net.forwardfire.unitxc.model; package net.forwardfire.unitxc.model;
import javax.xml.bind.annotation.XmlAnyElement; import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import javax.xml.bind.annotation.XmlAttribute;
import net.forwardfire.unitxc.model.step.UnitXConverterStep; import net.forwardfire.unitxc.model.step.UnitXConverterStep;
@ -44,7 +43,6 @@ public class UnitXConverterResultStep {
/** /**
* @return the startValue * @return the startValue
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.START_VALUE)
public Double getStartValue() { public Double getStartValue() {
return startValue; return startValue;
} }
@ -59,7 +57,6 @@ public class UnitXConverterResultStep {
/** /**
* @return the resultValue * @return the resultValue
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.RESULT_VALUE)
public Double getResultValue() { public Double getResultValue() {
return resultValue; return resultValue;
} }
@ -74,7 +71,6 @@ public class UnitXConverterResultStep {
/** /**
* @return the convertTime * @return the convertTime
*/ */
@XmlAttribute(name=ModelJAXBInfoSet.Attribute.CONVERT_TIME)
public Long getConvertTime() { public Long getConvertTime() {
return convertTime; return convertTime;
} }
@ -89,7 +85,6 @@ public class UnitXConverterResultStep {
/** /**
* @return the convertStep * @return the convertStep
*/ */
@XmlAnyElement
public UnitXConverterStep getConvertStep() { public UnitXConverterStep getConvertStep() {
return convertStep; return convertStep;
} }
@ -100,4 +95,9 @@ public class UnitXConverterResultStep {
public void setConvertStep(UnitXConverterStep convertStep) { public void setConvertStep(UnitXConverterStep convertStep) {
this.convertStep = convertStep; this.convertStep = convertStep;
} }
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
} }

View file

@ -26,12 +26,8 @@ package net.forwardfire.unitxc.model.step;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
/** /**
* *
@ -52,8 +48,6 @@ public abstract class AbstractUnitXConverterStep implements UnitXConverterStep {
return this; return this;
} }
@XmlElement(name=ModelJAXBInfoSet.Element.STEP_REASON)
@XmlElementWrapper(name=ModelJAXBInfoSet.Element.STEP_REASONS)
public final List<String> getStepReasons() { public final List<String> getStepReasons() {
return stepReasons; return stepReasons;
} }
@ -66,4 +60,9 @@ public abstract class AbstractUnitXConverterStep implements UnitXConverterStep {
public final void addStepReason(String stepReason) { public final void addStepReason(String stepReason) {
stepReasons.add(Validate.notBlank(stepReason)); stepReasons.add(Validate.notBlank(stepReason));
} }
@Override
public final String toString() {
return ReflectionToStringBuilder.toString(this);
}
} }

View file

@ -1,15 +1,9 @@
package net.forwardfire.unitxc.model.step; package net.forwardfire.unitxc.model.step;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.ModelJAXBObjectWrapAdapter;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueNamedVariable; import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueNamedVariable;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead; import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReadWrite; import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReadWrite;
@XmlRootElement(name=ModelJAXBInfoSet.Element.ROUNDING)
public class UnitXCConverterStepAutoRounding extends AbstractUnitXConverterStep { public class UnitXCConverterStepAutoRounding extends AbstractUnitXConverterStep {
private UnitXConverterStepValueRead operand; private UnitXConverterStepValueRead operand;
@ -62,7 +56,6 @@ public class UnitXCConverterStepAutoRounding extends AbstractUnitXConverterStep
/** /**
* @return the operand * @return the operand
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueRead getOperand() { public UnitXConverterStepValueRead getOperand() {
return operand; return operand;
} }
@ -77,7 +70,6 @@ public class UnitXCConverterStepAutoRounding extends AbstractUnitXConverterStep
/** /**
* @return the result * @return the result
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueReadWrite getResult() { public UnitXConverterStepValueReadWrite getResult() {
return result; return result;
} }

View file

@ -26,14 +26,6 @@ package net.forwardfire.unitxc.model.step;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.ModelJAXBObjectWrapAdapter;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead; import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead;
/** /**
@ -42,7 +34,6 @@ import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Oct 17, 2015 * @version 1.0 Oct 17, 2015
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.CONDITION)
public class UnitXCConverterStepCondition extends AbstractUnitXConverterStep { public class UnitXCConverterStepCondition extends AbstractUnitXConverterStep {
private UnitXCConverterStepConditionEquality equality; private UnitXCConverterStepConditionEquality equality;
@ -64,7 +55,6 @@ public class UnitXCConverterStepCondition extends AbstractUnitXConverterStep {
/** /**
* @return the equality * @return the equality
*/ */
@XmlAttribute
public UnitXCConverterStepConditionEquality getEquality() { public UnitXCConverterStepConditionEquality getEquality() {
return equality; return equality;
} }
@ -79,7 +69,6 @@ public class UnitXCConverterStepCondition extends AbstractUnitXConverterStep {
/** /**
* @return the operandA * @return the operandA
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueRead getOperandA() { public UnitXConverterStepValueRead getOperandA() {
return operandA; return operandA;
} }
@ -94,7 +83,6 @@ public class UnitXCConverterStepCondition extends AbstractUnitXConverterStep {
/** /**
* @return the operandB * @return the operandB
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueRead getOperandB() { public UnitXConverterStepValueRead getOperandB() {
return operandB; return operandB;
} }
@ -109,8 +97,6 @@ public class UnitXCConverterStepCondition extends AbstractUnitXConverterStep {
/** /**
* @return the conditionalSteps * @return the conditionalSteps
*/ */
@XmlElementWrapper
@XmlAnyElement
public List<UnitXConverterStep> getConditionalSteps() { public List<UnitXConverterStep> getConditionalSteps() {
return conditionalSteps; return conditionalSteps;
} }

View file

@ -23,12 +23,6 @@
package net.forwardfire.unitxc.model.step; package net.forwardfire.unitxc.model.step;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.ModelJAXBObjectWrapAdapter;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead; import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReadWrite; import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReadWrite;
@ -38,7 +32,6 @@ import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReadWrite;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Oct 17, 2015 * @version 1.0 Oct 17, 2015
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.OPERATION)
public class UnitXCConverterStepOperation extends AbstractUnitXConverterStep { public class UnitXCConverterStepOperation extends AbstractUnitXConverterStep {
private UnitXCConverterStepOperationOperator operator; private UnitXCConverterStepOperationOperator operator;
@ -64,7 +57,6 @@ public class UnitXCConverterStepOperation extends AbstractUnitXConverterStep {
/** /**
* @return the operator * @return the operator
*/ */
@XmlAttribute
public UnitXCConverterStepOperationOperator getOperator() { public UnitXCConverterStepOperationOperator getOperator() {
return operator; return operator;
} }
@ -79,7 +71,6 @@ public class UnitXCConverterStepOperation extends AbstractUnitXConverterStep {
/** /**
* @return the operandA * @return the operandA
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueRead getOperandA() { public UnitXConverterStepValueRead getOperandA() {
return operandA; return operandA;
} }
@ -94,7 +85,6 @@ public class UnitXCConverterStepOperation extends AbstractUnitXConverterStep {
/** /**
* @return the operandB * @return the operandB
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueRead getOperandB() { public UnitXConverterStepValueRead getOperandB() {
return operandB; return operandB;
} }
@ -109,7 +99,6 @@ public class UnitXCConverterStepOperation extends AbstractUnitXConverterStep {
/** /**
* @return the result * @return the result
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueReadWrite getResult() { public UnitXConverterStepValueReadWrite getResult() {
return result; return result;
} }

View file

@ -23,12 +23,6 @@
package net.forwardfire.unitxc.model.step; package net.forwardfire.unitxc.model.step;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.ModelJAXBObjectWrapAdapter;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead; import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueRead;
import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReadWrite; import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReadWrite;
@ -38,7 +32,6 @@ import net.forwardfire.unitxc.model.step.value.UnitXConverterStepValueReadWrite;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Oct 17, 2015 * @version 1.0 Oct 17, 2015
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.POWER_10)
public class UnitXCConverterStepPowerOfTen extends AbstractUnitXConverterStep { public class UnitXCConverterStepPowerOfTen extends AbstractUnitXConverterStep {
private UnitXConverterStepValueRead operand; private UnitXConverterStepValueRead operand;
@ -89,7 +82,6 @@ public class UnitXCConverterStepPowerOfTen extends AbstractUnitXConverterStep {
/** /**
* @return the exponent * @return the exponent
*/ */
@XmlAttribute
public int getExponent() { public int getExponent() {
return exponent; return exponent;
} }
@ -104,7 +96,6 @@ public class UnitXCConverterStepPowerOfTen extends AbstractUnitXConverterStep {
/** /**
* @return the exponentReverse * @return the exponentReverse
*/ */
@XmlAttribute
public boolean isExponentReverse() { public boolean isExponentReverse() {
return exponentReverse; return exponentReverse;
} }
@ -119,7 +110,6 @@ public class UnitXCConverterStepPowerOfTen extends AbstractUnitXConverterStep {
/** /**
* @return the operand * @return the operand
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueRead getOperand() { public UnitXConverterStepValueRead getOperand() {
return operand; return operand;
} }
@ -134,7 +124,6 @@ public class UnitXCConverterStepPowerOfTen extends AbstractUnitXConverterStep {
/** /**
* @return the result * @return the result
*/ */
@XmlJavaTypeAdapter(value=ModelJAXBObjectWrapAdapter.class)
public UnitXConverterStepValueReadWrite getResult() { public UnitXConverterStepValueReadWrite getResult() {
return result; return result;
} }

View file

@ -25,10 +25,6 @@ package net.forwardfire.unitxc.model.step;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.UnitXCType; import net.forwardfire.unitxc.model.UnitXCType;
/** /**
@ -37,7 +33,6 @@ import net.forwardfire.unitxc.model.UnitXCType;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Oct 7, 2016 * @version 1.0 Oct 7, 2016
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.REFERENCE)
public class UnitXCConverterStepReference extends AbstractUnitXConverterStep { public class UnitXCConverterStepReference extends AbstractUnitXConverterStep {
private String unitTypeId; private String unitTypeId;
@ -61,7 +56,6 @@ public class UnitXCConverterStepReference extends AbstractUnitXConverterStep {
/** /**
* @return the unitTypeId * @return the unitTypeId
*/ */
@XmlAttribute
public String getUnitTypeId() { public String getUnitTypeId() {
return unitTypeId; return unitTypeId;
} }
@ -76,7 +70,6 @@ public class UnitXCConverterStepReference extends AbstractUnitXConverterStep {
/** /**
* @return the toBaseSteps * @return the toBaseSteps
*/ */
@XmlAttribute
public Boolean getToBaseSteps() { public Boolean getToBaseSteps() {
return toBaseSteps; return toBaseSteps;
} }

View file

@ -23,10 +23,6 @@
package net.forwardfire.unitxc.model.step.value; package net.forwardfire.unitxc.model.step.value;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.step.UnitXConverterStepContext; import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
/** /**
@ -35,7 +31,6 @@ import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 1, 2016 * @version 1.0 Apr 1, 2016
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.NAMED_PARAMETER)
public class UnitXConverterStepValueNamedParameter implements UnitXConverterStepValueRead { public class UnitXConverterStepValueNamedParameter implements UnitXConverterStepValueRead {
private String parameterName; private String parameterName;
@ -55,7 +50,6 @@ public class UnitXConverterStepValueNamedParameter implements UnitXConverterStep
/** /**
* @return the parameterName * @return the parameterName
*/ */
@XmlAttribute
public String getParameterName() { public String getParameterName() {
return parameterName; return parameterName;
} }

View file

@ -23,10 +23,6 @@
package net.forwardfire.unitxc.model.step.value; package net.forwardfire.unitxc.model.step.value;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.step.UnitXConverterStepContext; import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
/** /**
@ -35,7 +31,6 @@ import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 1, 2016 * @version 1.0 Apr 1, 2016
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.NAMED_VARIABLE)
public class UnitXConverterStepValueNamedVariable implements UnitXConverterStepValueReadWrite { public class UnitXConverterStepValueNamedVariable implements UnitXConverterStepValueReadWrite {
private Class<?> valueType; private Class<?> valueType;
@ -62,7 +57,6 @@ public class UnitXConverterStepValueNamedVariable implements UnitXConverterStepV
/** /**
* @return the variableName * @return the variableName
*/ */
@XmlAttribute
public String getVariableName() { public String getVariableName() {
return variableName; return variableName;
} }
@ -77,7 +71,6 @@ public class UnitXConverterStepValueNamedVariable implements UnitXConverterStepV
/** /**
* @return the valueType * @return the valueType
*/ */
@XmlAttribute
public Class<?> getValueType() { public Class<?> getValueType() {
return valueType; return valueType;
} }

View file

@ -23,10 +23,6 @@
package net.forwardfire.unitxc.model.step.value; package net.forwardfire.unitxc.model.step.value;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.step.UnitXConverterStepContext; import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
/** /**
@ -35,7 +31,6 @@ import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 1, 2016 * @version 1.0 Apr 1, 2016
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.VALUE_DOUBLE)
public class UnitXConverterStepValueReferenceDouble implements UnitXConverterStepValueReadWrite { public class UnitXConverterStepValueReferenceDouble implements UnitXConverterStepValueReadWrite {
private Double value; private Double value;
@ -60,8 +55,6 @@ public class UnitXConverterStepValueReferenceDouble implements UnitXConverterSte
/** /**
* @return the value * @return the value
*/ */
//@XmlAttribute
@XmlValue
public Double getValue() { public Double getValue() {
return value; return value;
} }

View file

@ -25,10 +25,6 @@ package net.forwardfire.unitxc.model.step.value;
import java.math.BigDecimal; import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.step.UnitXConverterStepContext; import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
/** /**
@ -37,7 +33,6 @@ import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 1, 2016 * @version 1.0 Apr 1, 2016
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.VALUE_DOUBLE_FRACTION)
public class UnitXConverterStepValueReferenceDoubleFraction implements UnitXConverterStepValueRead { public class UnitXConverterStepValueReferenceDoubleFraction implements UnitXConverterStepValueRead {
private int numerator; private int numerator;
@ -60,7 +55,6 @@ public class UnitXConverterStepValueReferenceDoubleFraction implements UnitXConv
/** /**
* @return the numerator * @return the numerator
*/ */
@XmlAttribute
public int getNumerator() { public int getNumerator() {
return numerator; return numerator;
} }
@ -75,7 +69,6 @@ public class UnitXConverterStepValueReferenceDoubleFraction implements UnitXConv
/** /**
* @return the denominator * @return the denominator
*/ */
@XmlAttribute
public int getDenominator() { public int getDenominator() {
return denominator; return denominator;
} }

View file

@ -23,10 +23,6 @@
package net.forwardfire.unitxc.model.step.value; package net.forwardfire.unitxc.model.step.value;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.step.UnitXConverterStepContext; import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
/** /**
@ -35,7 +31,6 @@ import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 1, 2016 * @version 1.0 Apr 1, 2016
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.VALUE_INTEGER)
public class UnitXConverterStepValueReferenceInteger implements UnitXConverterStepValueReadWrite { public class UnitXConverterStepValueReferenceInteger implements UnitXConverterStepValueReadWrite {
private Integer value; private Integer value;
@ -60,7 +55,6 @@ public class UnitXConverterStepValueReferenceInteger implements UnitXConverterSt
/** /**
* @return the value * @return the value
*/ */
@XmlAttribute
public Integer getValue() { public Integer getValue() {
return value; return value;
} }

View file

@ -23,10 +23,6 @@
package net.forwardfire.unitxc.model.step.value; package net.forwardfire.unitxc.model.step.value;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import net.forwardfire.unitxc.model.ModelJAXBInfoSet;
import net.forwardfire.unitxc.model.step.UnitXConverterStepContext; import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
/** /**
@ -35,7 +31,6 @@ import net.forwardfire.unitxc.model.step.UnitXConverterStepContext;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 1, 2016 * @version 1.0 Apr 1, 2016
*/ */
@XmlRootElement(name=ModelJAXBInfoSet.Element.VALUE_STRING)
public class UnitXConverterStepValueReferenceString implements UnitXConverterStepValueReadWrite { public class UnitXConverterStepValueReferenceString implements UnitXConverterStepValueReadWrite {
private String value; private String value;
@ -60,7 +55,6 @@ public class UnitXConverterStepValueReferenceString implements UnitXConverterSte
/** /**
* @return the value * @return the value
*/ */
@XmlAttribute
public String getValue() { public String getValue() {
return value; return value;
} }

View file

@ -48,7 +48,6 @@ import net.forwardfire.unitxc.UnitXCFactory;
import net.forwardfire.unitxc.UnitXCManager; import net.forwardfire.unitxc.UnitXCManager;
import net.forwardfire.unitxc.converter.UnitXConverterParameterValue; import net.forwardfire.unitxc.converter.UnitXConverterParameterValue;
import net.forwardfire.unitxc.model.UnitXCType; import net.forwardfire.unitxc.model.UnitXCType;
import net.forwardfire.unitxc.model.ModelJAXBMarshaller;
import net.forwardfire.unitxc.model.UnitXCGroup; import net.forwardfire.unitxc.model.UnitXCGroup;
import net.forwardfire.unitxc.model.UnitXConverterResult; import net.forwardfire.unitxc.model.UnitXConverterResult;
import net.forwardfire.unitxc.model.UnitXConverterResultStep; import net.forwardfire.unitxc.model.UnitXConverterResultStep;
@ -57,7 +56,6 @@ public class UnitXCConverterStepTest {
@Test @Test
public void testFac() throws Exception { public void testFac() throws Exception {
ModelJAXBMarshaller jaxbDriver = new ModelJAXBMarshaller();
UnitXCManager unitManager = UnitXCFactory.createManager(); UnitXCManager unitManager = UnitXCFactory.createManager();
assertNotNull(unitManager); assertNotNull(unitManager);
@ -82,8 +80,7 @@ public class UnitXCConverterStepTest {
System.out.println("20m/s = "+result2.getResultValue()+" km/h"); System.out.println("20m/s = "+result2.getResultValue()+" km/h");
UnitXConverterResult result = unitManager.getConverter().convertStepped(211.0, "k°F", "m°C"); UnitXConverterResult result = unitManager.getConverter().convertStepped(211.0, "k°F", "m°C");
jaxbDriver.getUnitXConverterResult().marshal(result, System.out); System.out.println("result: "+result);
System.out.println("");
//result = unitManager.getConverter().convertStepped(10.763, "ft²", "in²"); //result = unitManager.getConverter().convertStepped(10.763, "ft²", "in²");
//xmlDriver.marshal(result, System.out); //xmlDriver.marshal(result, System.out);
@ -107,8 +104,7 @@ public class UnitXCConverterStepTest {
Map<String,UnitXConverterParameterValue> para = new HashMap<>(); Map<String,UnitXConverterParameterValue> para = new HashMap<>();
para.put("speed_time", new UnitXConverterParameterValue(2, unitManager.getUnitType("minute"))); para.put("speed_time", new UnitXConverterParameterValue(2, unitManager.getUnitType("minute")));
result = unitManager.getConverter().convertStepped(50, "km/h", "mm",para); result = unitManager.getConverter().convertStepped(50, "km/h", "mm",para);
System.out.println("CONVERT-RESULT:"); System.out.println("CONVERT-RESULT: "+result);
jaxbDriver.getUnitXConverterResult().marshal(result, System.out);
Configuration config = new Configuration(); Configuration config = new Configuration();