diff --git a/README.md b/README.md index 8cbb8b3..0f83f32 100644 --- a/README.md +++ b/README.md @@ -4,5 +4,24 @@ Atria-soft Exml [MPL-2] Mozilla public licence (V 2.0) -Ewol xml tool. +Implementation a a XML parser and generator. I create this one, because jackson API is done for JSON and not XML. + +The main base of the parser is a simple SAX parser (not streamable right now...) + +A DOM parser is available (based on SAX) + +A POJO parse is in progress (based on SAX too) + +POJO need to implement (TODO list): + + - Enumeration reader / writer + - Immutable reader/writer + - Record reader/writer + +The model of the Pojo reader is based on reading all sub element and create the object at the end (leaf first and parent node after). This is needed to manage the record and the immutable. + +We do not manage the constructor properties. Then right now, the constructor MUST be empty + +need to check if the class is an abstract or not... + diff --git a/src/org/atriasoft/eStringSerialize/StringSerializer.java b/src/org/atriasoft/eStringSerialize/StringSerializer.java index a04b9bd..68c3cf5 100644 --- a/src/org/atriasoft/eStringSerialize/StringSerializer.java +++ b/src/org/atriasoft/eStringSerialize/StringSerializer.java @@ -11,7 +11,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(byte.class, new Converter() { @Override public Object valueOf(final String value) { - return Byte.valueOf(value); + return Byte.valueOf(value.trim()); } @Override @@ -27,7 +27,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(Byte.class, new Converter() { @Override public Object valueOf(final String value) { - return Byte.valueOf(value); + return Byte.valueOf(value.trim()); } @Override @@ -43,7 +43,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(int.class, new Converter() { @Override public Object valueOf(final String value) { - return Integer.valueOf(value); + return Integer.valueOf(value.trim()); } @Override @@ -59,7 +59,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(Integer.class, new Converter() { @Override public Object valueOf(final String value) { - return Integer.valueOf(value); + return Integer.valueOf(value.trim()); } @Override @@ -75,7 +75,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(long.class, new Converter() { @Override public Object valueOf(final String value) { - return Long.valueOf(value); + return Long.valueOf(value.trim()); } @Override @@ -91,7 +91,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(Long.class, new Converter() { @Override public Object valueOf(final String value) { - return Long.valueOf(value); + return Long.valueOf(value.trim()); } @Override @@ -107,7 +107,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(short.class, new Converter() { @Override public Object valueOf(final String value) { - return Short.valueOf(value); + return Short.valueOf(value.trim()); } @Override @@ -123,7 +123,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(Short.class, new Converter() { @Override public Object valueOf(final String value) { - return Short.valueOf(value); + return Short.valueOf(value.trim()); } @Override @@ -139,7 +139,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(float.class, new Converter() { @Override public Object valueOf(final String value) { - return Float.valueOf(value); + return Float.valueOf(value.trim()); } @Override @@ -155,7 +155,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(Float.class, new Converter() { @Override public Object valueOf(final String value) { - return Float.valueOf(value); + return Float.valueOf(value.trim()); } @Override @@ -171,7 +171,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(double.class, new Converter() { @Override public Object valueOf(final String value) { - return Double.valueOf(value); + return Double.valueOf(value.trim()); } @Override @@ -187,7 +187,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(Double.class, new Converter() { @Override public Object valueOf(final String value) { - return Double.valueOf(value); + return Double.valueOf(value.trim()); } @Override @@ -203,7 +203,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(boolean.class, new Converter() { @Override public Object valueOf(final String value) { - return Boolean.valueOf(value); + return Boolean.valueOf(value.trim()); } @Override @@ -219,7 +219,7 @@ public class StringSerializer { StringSerializer.VALUES_OF.put(Boolean.class, new Converter() { @Override public Object valueOf(final String value) { - return Boolean.valueOf(value); + return Boolean.valueOf(value.trim()); } @Override diff --git a/src/org/atriasoft/exml/Exml.java b/src/org/atriasoft/exml/Exml.java index 20e586f..34ddab4 100644 --- a/src/org/atriasoft/exml/Exml.java +++ b/src/org/atriasoft/exml/Exml.java @@ -7,12 +7,10 @@ package org.atriasoft.exml; import java.io.IOException; -import java.lang.reflect.Array; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.List; import org.atriasoft.etk.Uri; import org.atriasoft.exml.builder.Builder; diff --git a/src/org/atriasoft/exml/builder/BuilderIntrospection.java b/src/org/atriasoft/exml/builder/BuilderIntrospection.java index 92976b4..10afcd6 100644 --- a/src/org/atriasoft/exml/builder/BuilderIntrospection.java +++ b/src/org/atriasoft/exml/builder/BuilderIntrospection.java @@ -1,15 +1,15 @@ package org.atriasoft.exml.builder; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; -import java.util.Map; +import org.atriasoft.eStringSerialize.StringSerializer; import org.atriasoft.exml.exception.ExmlBuilderException; import org.atriasoft.exml.internal.Log; public class BuilderIntrospection implements Builder { // Keep in cach all the object alredy parsed ==> optimize CPU - final Map elements = new HashMap<>(); + CacheIntrospectionModel cacheModel = new CacheIntrospectionModel(); // The root class (need to keep it if we use 2 time the builder, the root class is no more accessible). final Class rootClassType; final String rootNodeName; @@ -17,27 +17,9 @@ public class BuilderIntrospection implements Builder { public BuilderIntrospection(final ModelType model, final Class classType, final String rootNodeName) throws Exception { this.rootNodeName = rootNodeName; this.rootClassType = classType; - MapKey key = new MapKey(model, classType); - // TODO pb if it is a List or an Array ... - this.elements.put(key, IntrospectionModelFactory.createModelPlop(key)); + this.cacheModel.findOrCreate(model, null, classType); } - IntrospectionModel findOrCreate(final ModelType model, final String name, final Class classType) throws ExmlBuilderException { - MapKey key = new MapKey(model, name, classType); - IntrospectionModel out = this.elements.get(key); - if (out != null) { - return out; - } - if (model == ModelType.ARRAY) { - out = IntrospectionModelFactory.createModelArray(key.nodeName(), key); - } else if (model == ModelType.LIST) { - out = IntrospectionModelFactory.createModelList(key.nodeName(), key); - } else { - out = IntrospectionModelFactory.createModelPlop(key); - } - this.elements.put(key, out); - return out; - } @Override public void newComment(final Object element, final String comment) throws ExmlBuilderException { @@ -77,9 +59,9 @@ public class BuilderIntrospection implements Builder { Log.verbose("Create array new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'"); IntrospectionModel inferData = null; if (listTreeName == null) { - inferData = findOrCreate(ModelType.NORMAL, null, subTypeClass); + inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, null, subTypeClass); } else { - inferData = findOrCreate(ModelType.ARRAY, listTreeName, subTypeClass); + inferData = this.cacheModel.findOrCreate(ModelType.ARRAY, listTreeName, subTypeClass); } // Create the data when object is ended created... return new IntrospectionObject(inferData); @@ -89,22 +71,22 @@ public class BuilderIntrospection implements Builder { Log.verbose("Create List new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'"); IntrospectionModel inferData = null; if (listTreeName == null) { - inferData = findOrCreate(ModelType.NORMAL, null, subTypeClass); + inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, null, subTypeClass); } else { - inferData = findOrCreate(ModelType.LIST, listTreeName, subTypeClass); + inferData = this.cacheModel.findOrCreate(ModelType.LIST, listTreeName, subTypeClass); } // Create the data when object is ended created... return new IntrospectionObject(inferData); } Log.verbose("Create new class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'"); - final IntrospectionModel inferData = findOrCreate(ModelType.NORMAL, listTreeName, typeClass); + final IntrospectionModel inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, listTreeName, typeClass); // Create the data when object is ended created... return new IntrospectionObject(inferData); } return null; } - + @Override public void newProperty(final Object element, final String propertyName, final String propertyValue) throws ExmlBuilderException, Exception { final IntrospectionObject introspectionObject = (IntrospectionObject) element; @@ -112,14 +94,44 @@ public class BuilderIntrospection implements Builder { if (model.isArray() || model.isList()) { throw new ExmlBuilderException("Model (List/Array) can not have property with name '" + propertyName + "'"); } - // TODO Check here, maybe a big problem with the custum object in properties ... !!!!! - introspectionObject.setProperty(propertyName, propertyValue); - + Class typeClass = model.getTypeOfProperty(propertyName); + if (typeClass != null) { + // specific case for List ==> need to get the subType in introspection ... + if (typeClass.isPrimitive()) { + Object out = StringSerializer.valueOf(typeClass, propertyValue); + introspectionObject.putProperty(propertyName, out); + } else if (typeClass.isArray()) { + String[] elems = propertyValue.split(";"); + Class subTypeClass = typeClass.getComponentType(); + IntrospectionModel inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, null, subTypeClass); + List out = new ArrayList(); + for (int iii=0; iii subTypeClass = introspectionObject.getTypeOfSubProperty(propertyName); + Log.verbose("Create List new 'SUB' class: '" + typeClass.getCanonicalName() + "' for property '" + propertyName + "'"); + IntrospectionModel inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, null, subTypeClass); + List out = new ArrayList(); + for (int iii=0; iii arrayType = model.getClassType(); - final IntrospectionModel inferData = findOrCreate(ModelType.NORMAL, null, arrayType); + final IntrospectionModel inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, null, arrayType); // Create the data when object is ended created... IntrospectionObject tmpp = new IntrospectionObject(inferData); newText(tmpp, text); diff --git a/src/org/atriasoft/exml/builder/CacheIntrospectionModel.java b/src/org/atriasoft/exml/builder/CacheIntrospectionModel.java new file mode 100644 index 0000000..0308ce8 --- /dev/null +++ b/src/org/atriasoft/exml/builder/CacheIntrospectionModel.java @@ -0,0 +1,34 @@ +package org.atriasoft.exml.builder; + +import java.util.HashMap; +import java.util.Map; + +import org.atriasoft.exml.exception.ExmlBuilderException; + +public class CacheIntrospectionModel { + final Map elements = new HashMap<>(); + + IntrospectionModel findOrCreate(final ModelType model, final String name, final Class classType) throws ExmlBuilderException { + MapKey key = new MapKey(model, name, classType); + IntrospectionModel out = this.elements.get(key); + if (out != null) { + return out; + } + if (model == ModelType.ARRAY) { + out = IntrospectionModelFactory.createModelArray(key.nodeName(), key); + } else if (model == ModelType.LIST) { + out = IntrospectionModelFactory.createModelList(key.nodeName(), key); + } else if (classType.isEnum()) { + out = IntrospectionModelFactory.createModelEnum(key); + } else { + out = IntrospectionModelFactory.createModelPlop(key); + } + this.elements.put(key, out); + return out; + } + + + public CacheIntrospectionModel() { + + } +} diff --git a/src/org/atriasoft/exml/builder/IntrospectionModel.java b/src/org/atriasoft/exml/builder/IntrospectionModel.java index 513ada1..69670e0 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionModel.java +++ b/src/org/atriasoft/exml/builder/IntrospectionModel.java @@ -44,16 +44,28 @@ public abstract class IntrospectionModel { return null; } - public Class getTypeOfSubNode(final Object data, final String nodeName) throws ExmlBuilderException { + public Class getTypeOfSubNode(final String nodeName) throws ExmlBuilderException { return null; } - public Class getTypeOfSubNodeList(final Object data, final String nodeName) throws ExmlBuilderException { + public Class getTypeOfSubNodeList(final String nodeName) throws ExmlBuilderException { return null; } - public String getTreeNameOfSubNode(final Object data, final String nodeName) throws ExmlBuilderException { + public String getTreeNameOfSubNode(final String nodeName) throws ExmlBuilderException { return null; } - public boolean isEndPoint() { + public Class getTypeOfProperty(final String nodeName) throws ExmlBuilderException { + return null; + } + public Class getTypeOfSubProperty(final String nodeName) throws ExmlBuilderException { + return null; + } + public boolean isObject(final String propertyName) { + return Object.class.isAssignableFrom(this.classType); + } + public boolean isRecord(final String propertyName) { + return Record.class.isAssignableFrom(this.classType); + } + public boolean isNative() { return false; } public boolean isArray() { @@ -62,7 +74,10 @@ public abstract class IntrospectionModel { public boolean isList() { return false; } - public abstract String toString(final Object data); + public abstract String toString(final Object data) throws ExmlBuilderException; public abstract String[] toStringList(final Object data); + public boolean isEnum() { + return this.classType.isEnum(); + } } diff --git a/src/org/atriasoft/exml/builder/IntrospectionModelArray.java b/src/org/atriasoft/exml/builder/IntrospectionModelArray.java index 67a1fb5..5088323 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionModelArray.java +++ b/src/org/atriasoft/exml/builder/IntrospectionModelArray.java @@ -5,10 +5,8 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import org.atriasoft.etk.util.ArraysTools; import org.atriasoft.exml.exception.ExmlBuilderException; -import org.atriasoft.exml.exception.ExmlParserErrorMulti; -import org.atriasoft.exml.parser.ParseXml; -import org.atriasoft.exml.parser.ParsingProperty; public class IntrospectionModelArray extends IntrospectionModel { @@ -28,21 +26,34 @@ public class IntrospectionModelArray extends IntrospectionModel { @Override public Object createObject(final Map properties, final Map> nodes) throws ExmlBuilderException { List tmp = null; - if (nodeName == null) { + if (this.nodeName == null) { tmp = nodes.get(IntrospectionObject.STUPID_TOCKEN); - } else { - tmp = nodes.get(nodeName); + if (tmp == null) { + return null; + } + if (tmp.size() == 1) { + return tmp.get(0); + } + return null; } + tmp = nodes.get(this.nodeName); if (tmp == null) { return null; } - return convertList(this.classType, tmp); + //return tmp; + + // TODO This is not good at all this is bad ... + + if (this.classType.isPrimitive()) { + return ArraysTools.listToPrimitiveAuto(this.classType, tmp); + } + return IntrospectionModelArray.convertList(this.classType, tmp); } @Override public List getNodeAvaillable() { - if (nodeName != null) { - return Arrays.asList(nodeName); + if (this.nodeName != null) { + return Arrays.asList(this.nodeName); } return null; } diff --git a/src/org/atriasoft/exml/builder/IntrospectionModelBaseType.java b/src/org/atriasoft/exml/builder/IntrospectionModelBaseType.java index 12d41ca..125594a 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionModelBaseType.java +++ b/src/org/atriasoft/exml/builder/IntrospectionModelBaseType.java @@ -35,7 +35,7 @@ public class IntrospectionModelBaseType extends IntrospectionModel { } @Override - public boolean isEndPoint() { + public boolean isNative() { return true; } diff --git a/src/org/atriasoft/exml/builder/IntrospectionModelComplex.java b/src/org/atriasoft/exml/builder/IntrospectionModelComplex.java index b125190..7f59786 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionModelComplex.java +++ b/src/org/atriasoft/exml/builder/IntrospectionModelComplex.java @@ -35,6 +35,7 @@ public class IntrospectionModelComplex extends IntrospectionModel { // TODO Optimize this with external object for basic types.... private final Method valueof; // used for the set Text if the object is an end point... + private final Method tostring; // used for the set Text if the object is an end point... private final List nodes = new ArrayList<>(); private final List attributes = new ArrayList<>(); @@ -105,6 +106,12 @@ public class IntrospectionModelComplex extends IntrospectionModel { } return false; } + if (o.getName().equals("toString")) { + if (o.getParameterCount() != 0 || o.getReturnType() != String.class) { + return false; + } + return true; + } if (o.getName().startsWith("get")) { if (o.getParameterCount() != 0 || o.getReturnType() == void.class || o.getReturnType() == Boolean.class || o.getReturnType() == boolean.class) { return false; @@ -133,7 +140,7 @@ public class IntrospectionModelComplex extends IntrospectionModel { return false; } if (o.getName().startsWith("is")) { - if (!(o.getReturnType() == Boolean.class || o.getReturnType() == boolean.class) && o.getParameterCount() != 0) { + if ((o.getReturnType() != Boolean.class && o.getReturnType() != boolean.class) || o.getParameterCount() != 0) { return false; } // check name format @@ -179,6 +186,14 @@ public class IntrospectionModelComplex extends IntrospectionModel { this.valueof = null; } + final List tostringMethod = methods.stream().filter(o -> o.getName().startsWith("toString")).collect(Collectors.toList()); + if (tostringMethod.size() == 1) { + this.tostring = tostringMethod.get(0); + } else { + // some specific model: + + this.tostring = null; + } // associate methods by pair. final List elements = new ArrayList<>(); for (final Method method : methodsGet) { @@ -335,7 +350,11 @@ public class IntrospectionModelComplex extends IntrospectionModel { try { // pb here, can not create a primitive object with the correct elements... ==> must be generated with a siblist of elements Constructor[] constructors = this.classType.getConstructors(); - if (!Modifier.isStatic(this.classType.getModifiers())) { + //Log.critical("Modifiers : " + Modifier.toString(this.classType.getModifiers()) + " ==> " + this.classType.getNestHost()); + if (this.classType.getNestHost() == this.classType) { + // if nest class is identical ==> native class declaration. + tmp = constructors[0].newInstance(); + } else if (!Modifier.isStatic(this.classType.getModifiers())) { Object tmp2 = null; tmp = constructors[0].newInstance(tmp2); } else { @@ -616,129 +635,126 @@ public class IntrospectionModelComplex extends IntrospectionModel { private void setValue(final Object data, final String name, final Object value) throws ExmlBuilderException { Log.error(" Set value ='" + name + "' propertyValue='" + value + "' " + value.getClass().getCanonicalName()); - // by default use setter to set the property - final IntrospectionProperty propMethode = findNodeDescription(name); - if (propMethode != null && propMethode.canSetValue()) { - Log.verbose(" ==> find '" + Arrays.toString(propMethode.getNames()) + " type=" + propMethode.getType() + " sub-type=" + propMethode.getSubType() ); - if (propMethode.getType().isAssignableFrom(value.getClass())) { - propMethode.setExistingValue(data, value); - } else if (value instanceof List){ - @SuppressWarnings("unchecked") - List tmpp = (List)value; - if (propMethode.getType().isArray()) { - if (propMethode.getType().componentType() == byte.class) { - byte[] datas = ArraysTools.listByteToPrimitive(tmpp); - propMethode.setExistingValue(data, datas); - } else if (propMethode.getType().componentType() == short.class) { - short[] datas = ArraysTools.listShortToPrimitive(tmpp); - propMethode.setExistingValue(data, datas); - } else if (propMethode.getType().componentType() == int.class) { - int[] datas = ArraysTools.listIntegerToPrimitive(tmpp); - propMethode.setExistingValue(data, datas); - } else if (propMethode.getType().componentType() == long.class) { - long[] datas = ArraysTools.listLongToPrimitive(tmpp); - propMethode.setExistingValue(data, datas); - } else if (propMethode.getType().componentType() == boolean.class) { - boolean[] datas = ArraysTools.listBooleanToPrimitive(tmpp); - propMethode.setExistingValue(data, datas); - } else if (propMethode.getType().componentType() == float.class) { - float[] datas = ArraysTools.listFloatToPrimitive(tmpp); - propMethode.setExistingValue(data, datas); - } else if (propMethode.getType().componentType() == double.class) { - double[] datas = ArraysTools.listDoubleToPrimitive(tmpp); - propMethode.setExistingValue(data, datas); + { + // by default use setter to set the property + final IntrospectionProperty propMethode = findNodeDescription(name); + if (propMethode != null && propMethode.canSetValue()) { + Log.verbose(" ==> find '" + Arrays.toString(propMethode.getNames()) + " type=" + propMethode.getType() + " sub-type=" + propMethode.getSubType() ); + if (propMethode.getType().isAssignableFrom(value.getClass())) { + propMethode.setExistingValue(data, value); + } else if (value instanceof List){ + @SuppressWarnings("unchecked") + List tmpp = (List)value; + if (propMethode.getType().isArray()) { + if (propMethode.getType().componentType().isPrimitive()) { + Object newData = ArraysTools.listToPrimitiveAuto(propMethode.getType().componentType(), tmpp); + propMethode.setExistingValue(data, newData); + } else { + Log.verbose(" datas type: " + autoCast(propMethode.getType().componentType(), tmpp).getClass().getCanonicalName()); + Log.verbose(" methode type: " + propMethode.getType().getCanonicalName()); + propMethode.setExistingValue(data, autoCast(propMethode.getType().componentType(), tmpp)); + } + } else if (tmpp.size() == 1) { + propMethode.setExistingValue(data, tmpp.get(0)); } else { - Log.verbose(" datas type: " + autoCast(propMethode.getType().componentType(), tmpp).getClass().getCanonicalName()); - Log.verbose(" methode type: " + propMethode.getType().getCanonicalName()); - propMethode.setExistingValue(data, autoCast(propMethode.getType().componentType(), tmpp)); + // impossible case ... } - } else if (tmpp.size() == 1) { - propMethode.setExistingValue(data, tmpp.get(0)); + } else if (propMethode.getType() == byte.class) { + byte dataPrimitive = (Byte)value; + propMethode.setExistingValue(data, dataPrimitive); + } else if (propMethode.getType() == short.class) { + short dataPrimitive = (Short)value; + propMethode.setExistingValue(data, dataPrimitive); + } else if (propMethode.getType() == int.class) { + int dataPrimitive = (Integer)value; + propMethode.setExistingValue(data, dataPrimitive); + } else if (propMethode.getType() == long.class) { + long dataPrimitive = (Long)value; + propMethode.setExistingValue(data, dataPrimitive); + } else if (propMethode.getType() == boolean.class) { + boolean dataPrimitive = (Boolean)value; + propMethode.setExistingValue(data, dataPrimitive); + } else if (propMethode.getType() == float.class) { + float dataPrimitive = (Float)value; + propMethode.setExistingValue(data, dataPrimitive); + } else if (propMethode.getType() == double.class) { + double dataPrimitive = (Double)value; + propMethode.setExistingValue(data, dataPrimitive); } else { - // impossible case ... + } - } else if (propMethode.getType() == byte.class) { - byte dataPrimitive = (Byte)value; - propMethode.setExistingValue(data, dataPrimitive); - } else if (propMethode.getType() == short.class) { - short dataPrimitive = (Short)value; - propMethode.setExistingValue(data, dataPrimitive); - } else if (propMethode.getType() == int.class) { - int dataPrimitive = (Integer)value; - propMethode.setExistingValue(data, dataPrimitive); - } else if (propMethode.getType() == long.class) { - long dataPrimitive = (Long)value; - propMethode.setExistingValue(data, dataPrimitive); - } else if (propMethode.getType() == boolean.class) { - boolean dataPrimitive = (Boolean)value; - propMethode.setExistingValue(data, dataPrimitive); - } else { - + return; } - return; } // try with direct field - final IntrospectionProperty propField = findPropertyDescription(name); - if (propField != null && propField.canSetValue()) { - Log.verbose(" ==> find '" + Arrays.toString(propField.getNames()) + " type=" + propField.getType() + " sub-type=" + propField.getSubType() ); - if (propField.getType().isAssignableFrom(value.getClass())) { - propField.setExistingValue(data, value); - // Some specific case for primitives values - } else if (propField.getType() == byte.class) { - byte dataPrimitive = (Byte)value; - propField.setExistingValue(data, dataPrimitive); - } else if (propField.getType() == short.class) { - short dataPrimitive = (Short)value; - propField.setExistingValue(data, dataPrimitive); - } else if (propField.getType() == int.class) { - int dataPrimitive = (Integer)value; - propField.setExistingValue(data, dataPrimitive); - } else if (propField.getType() == long.class) { - long dataPrimitive = (Long)value; - propField.setExistingValue(data, dataPrimitive); - } else if (propField.getType() == float.class) { - float dataPrimitive = (Float)value; - propField.setExistingValue(data, dataPrimitive); - } else if (propField.getType() == double.class) { - Double dataPrimitive = (Double)value; - propField.setExistingValue(data, dataPrimitive); - } else if (propField.getType() == boolean.class) { - boolean dataPrimitive = (Boolean)value; - propField.setExistingValue(data, dataPrimitive); - } else { - @SuppressWarnings("unchecked") - List tmpp = (List)value; - if (propField.getType().isArray()) { - if (propField.getType().componentType() == byte.class) { - byte[] datas = ArraysTools.listByteToPrimitive(tmpp); - propField.setExistingValue(data, datas); - } else if (propField.getType().componentType() == short.class) { - short[] datas = ArraysTools.listShortToPrimitive(tmpp); - propField.setExistingValue(data, datas); - } else if (propField.getType().componentType() == int.class) { - int[] datas = ArraysTools.listIntegerToPrimitive(tmpp); - propField.setExistingValue(data, datas); - } else if (propField.getType().componentType() == long.class) { - long[] datas = ArraysTools.listLongToPrimitive(tmpp); - propField.setExistingValue(data, datas); - } else if (propField.getType().componentType() == boolean.class) { - boolean[] datas = ArraysTools.listBooleanToPrimitive(tmpp); - propField.setExistingValue(data, datas); - } else { - Log.verbose(" datas type: " + autoCast(propMethode.getType().componentType(), tmpp).getClass().getCanonicalName()); - Log.verbose(" methode type: " + propMethode.getType().getCanonicalName()); - propField.setExistingValue(data, autoCast(propMethode.getType().componentType(), tmpp)); - } - } else if (tmpp.size() == 1) { - propField.setExistingValue(data, tmpp.get(0)); + { + final IntrospectionProperty propField = findPropertyDescription(name); + if (propField != null && propField.canSetValue()) { + Log.verbose(" ==> find '" + Arrays.toString(propField.getNames()) + " type=" + propField.getType() + " sub-type=" + propField.getSubType() ); + if (propField.getType().isAssignableFrom(value.getClass())) { + propField.setExistingValue(data, value); + // Some specific case for primitives values + } else if (propField.getType() == byte.class) { + byte dataPrimitive = (Byte)value; + propField.setExistingValue(data, dataPrimitive); + } else if (propField.getType() == short.class) { + short dataPrimitive = (Short)value; + propField.setExistingValue(data, dataPrimitive); + } else if (propField.getType() == int.class) { + int dataPrimitive = (Integer)value; + propField.setExistingValue(data, dataPrimitive); + } else if (propField.getType() == long.class) { + long dataPrimitive = (Long)value; + propField.setExistingValue(data, dataPrimitive); + } else if (propField.getType() == float.class) { + float dataPrimitive = (Float)value; + propField.setExistingValue(data, dataPrimitive); + } else if (propField.getType() == double.class) { + Double dataPrimitive = (Double)value; + propField.setExistingValue(data, dataPrimitive); + } else if (propField.getType() == boolean.class) { + boolean dataPrimitive = (Boolean)value; + propField.setExistingValue(data, dataPrimitive); } else { - // impossible case ... + @SuppressWarnings("unchecked") + List tmpp = (List)value; + if (propField.getType().isArray()) { + if (propField.getType().componentType() == byte.class) { + byte[] datas = ArraysTools.listByteToPrimitive(tmpp); + propField.setExistingValue(data, datas); + } else if (propField.getType().componentType() == short.class) { + short[] datas = ArraysTools.listShortToPrimitive(tmpp); + propField.setExistingValue(data, datas); + } else if (propField.getType().componentType() == int.class) { + int[] datas = ArraysTools.listIntegerToPrimitive(tmpp); + propField.setExistingValue(data, datas); + } else if (propField.getType().componentType() == long.class) { + long[] datas = ArraysTools.listLongToPrimitive(tmpp); + propField.setExistingValue(data, datas); + } else if (propField.getType().componentType() == boolean.class) { + boolean[] datas = ArraysTools.listBooleanToPrimitive(tmpp); + propField.setExistingValue(data, datas); + } else if (propField.getType().componentType() == float.class) { + float[] datas = ArraysTools.listFloatToPrimitive(tmpp); + propField.setExistingValue(data, datas); + } else if (propField.getType().componentType() == double.class) { + double[] datas = ArraysTools.listDoubleToPrimitive(tmpp); + propField.setExistingValue(data, datas); + } else { + Log.verbose(" datas type: " + autoCast(propField.getType().componentType(), tmpp).getClass().getCanonicalName()); + Log.verbose(" methode type: " + propField.getType().getCanonicalName()); + propField.setExistingValue(data, autoCast(propField.getType().componentType(), tmpp)); + } + } else if (tmpp.size() == 1) { + propField.setExistingValue(data, tmpp.get(0)); + } else { + // impossible case ... + } } + return; } - return; } throw new ExmlBuilderException("can not find the field '" + name + "'"); - } /** @@ -747,59 +763,60 @@ public class IntrospectionModelComplex extends IntrospectionModel { * @return Class of the node to create */ @Override - public Class getTypeOfSubNode(final Object data, final String nodeName) throws ExmlBuilderException { + public Class getTypeOfSubNode(final String nodeName) throws ExmlBuilderException { Log.error(" nodeType='" + nodeName + "'"); - // by default use setter to set the property final IntrospectionProperty propMethode = findNodeDescription(nodeName); if (propMethode != null && propMethode.canSetValue()) { Log.error(" ==> find '" + propMethode.getNames()); return propMethode.getType(); } - // try with direct field - final IntrospectionProperty propField = findPropertyDescription(nodeName); - if (propField != null && propField.canSetValue()) { - Log.error(" ==> find '" + propField.getNames()); - return propMethode.getType(); - } - throw new ExmlBuilderException("can not find the field '" + nodeName + "' availlable: " + getNodeAvaillable()); } @Override - public Class getTypeOfSubNodeList(final Object data, final String nodeName) throws ExmlBuilderException { + public Class getTypeOfSubNodeList(final String nodeName) throws ExmlBuilderException { Log.error(" nodeType='" + nodeName + "'"); - // by default use setter to set the property final IntrospectionProperty propMethode = findNodeDescription(nodeName); if (propMethode != null && propMethode.canSetValue()) { Log.error(" ==> find '" + propMethode.getNames()); return propMethode.getSubType(); } - // try with direct field - final IntrospectionProperty propField = findPropertyDescription(nodeName); - if (propField != null && propField.canSetValue()) { - Log.error(" ==> find '" + propField.getNames()); - return propMethode.getSubType(); - } throw new ExmlBuilderException("can not find the field '" + nodeName + "' availlable: " + getNodeAvaillable()); } @Override - public String getTreeNameOfSubNode(final Object data, final String nodeName) throws ExmlBuilderException { + public String getTreeNameOfSubNode(final String nodeName) throws ExmlBuilderException { Log.error(" nodeType='" + nodeName + "'"); - // by default use setter to set the property final IntrospectionProperty propMethode = findNodeDescription(nodeName); if (propMethode != null && propMethode.canSetValue()) { Log.error(" ==> find '" + propMethode.getNames()); return propMethode.getListName(); } - // try with direct field - final IntrospectionProperty propField = findPropertyDescription(nodeName); - if (propField != null && propField.canSetValue()) { - Log.error(" ==> find '" + propField.getNames()); - return propMethode.getListName(); - } throw new ExmlBuilderException("can not find the field '" + nodeName + "'"); } + @Override + public Class getTypeOfProperty(final String nodeName) throws ExmlBuilderException { + Log.error(" nodeType='" + nodeName + "'"); + final IntrospectionProperty propField = findPropertyDescription(nodeName); + if (propField != null && propField.canSetValue()) { + Log.error(" ==> find '" + propField.getNames()); + return propField.getType(); + } + + throw new ExmlBuilderException("can not find the field '" + nodeName + "' availlable: " + getNodeAvaillable()); + } + @Override + public Class getTypeOfSubProperty(final String nodeName) throws ExmlBuilderException { + Log.error(" nodeType='" + nodeName + "'"); + final IntrospectionProperty propField = findPropertyDescription(nodeName); + if (propField != null && propField.canSetValue()) { + Log.error(" ==> find '" + propField.getNames()); + return propField.getSubType(); + } + throw new ExmlBuilderException("can not find the field '" + nodeName + "' availlable: " + getNodeAvaillable()); + } + + @Override public Object getValueFromText(final String text) throws ExmlBuilderException { // Note if the type is an Array<>() or a List<>() ==> we parse element by element ... then we need to keep the undertype... @@ -868,12 +885,26 @@ public class IntrospectionModelComplex extends IntrospectionModel { throw new ExmlBuilderException("can not find the field '" + propertyName + "'"); } @Override - public boolean isEndPoint() { + public boolean isNative() { return false; } @Override - public String toString(final Object data) { - return null; + public String toString(final Object data) throws ExmlBuilderException { + if (this.tostring == null) { + if (StringSerializer.contains(this.classType)) { + throw new ExmlBuilderException("function 'toString' for '" + this.classType.getCanonicalName() + "' is not defined and not registered for specific type"); + } + return StringSerializer.toString(data); + } + try { + return (String) this.tostring.invoke(data); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + if (Enum.class.isAssignableFrom(this.classType)) { + throw new ExmlBuilderException("Error in call 'toString()' for '" + this.classType.getCanonicalName() + "' ==> '????' ... availlable list: " + Arrays.asList(this.classType.getEnumConstants())); + } + e.printStackTrace(); + throw new ExmlBuilderException("Error in call 'toString()' for '" + this.classType.getCanonicalName() + "' " + e.getMessage()); + } } @Override public String[] toStringList(final Object data) { diff --git a/src/org/atriasoft/exml/builder/IntrospectionModelFactory.java b/src/org/atriasoft/exml/builder/IntrospectionModelFactory.java index ffbae85..dd41917 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionModelFactory.java +++ b/src/org/atriasoft/exml/builder/IntrospectionModelFactory.java @@ -29,6 +29,9 @@ public class IntrospectionModelFactory { public static IntrospectionModel createModelList(final String nodeName, final MapKey modelType) throws ExmlBuilderException { return new IntrospectionModelList(nodeName, modelType.type()); } + public static IntrospectionModel createModelEnum(final MapKey modelType) throws ExmlBuilderException { + return new IntrospectionModelComplex(modelType.type()); + } public static IntrospectionModel createModelPlop(final MapKey modelType) throws ExmlBuilderException { if (StringSerializer.contains(modelType.type())) { diff --git a/src/org/atriasoft/exml/builder/IntrospectionObject.java b/src/org/atriasoft/exml/builder/IntrospectionObject.java index 64ce31e..73bc4f0 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionObject.java +++ b/src/org/atriasoft/exml/builder/IntrospectionObject.java @@ -34,14 +34,17 @@ public class IntrospectionObject { public IntrospectionModel getModelIntrospection() { return this.modelInterface; } - - public void setProperty(final String propertyName, final String propertyValue) throws Exception { - // Old way ... this.dataInterface.setProperty(this.data, propertyName, propertyValue); - Object value = this.modelInterface.getValue(propertyName, propertyValue); + + public void putProperty(final String propertyName, final Object propertyValue) throws Exception { if (this.properties.containsKey(propertyName)) { throw new ExmlBuilderException("Property have multiple values ==> impossible case; A Node must contain only 1 attibutes"); } - this.properties.put(propertyName, value); + this.properties.put(propertyName, propertyValue); + } + @Deprecated + public void setProperty(final String propertyName, final String propertyValue, final CacheIntrospectionModel cacheModel) throws Exception { + Object value = this.modelInterface.getValue(propertyName, propertyValue); + putProperty(propertyName, value); } /** @@ -50,13 +53,19 @@ public class IntrospectionObject { * @return Class of the node to create */ public Class getTypeOfSubNode(final String nodeName) throws ExmlBuilderException { - return this.modelInterface.getTypeOfSubNode(this.data, nodeName); + return this.modelInterface.getTypeOfSubNode(nodeName); } public Class getTypeOfSubNodeSubType(final String nodeName) throws ExmlBuilderException { - return this.modelInterface.getTypeOfSubNodeList(this.data, nodeName); + return this.modelInterface.getTypeOfSubNodeList(nodeName); } public String getTreeNameOfSubNode(final String nodeName) throws ExmlBuilderException { - return this.modelInterface.getTreeNameOfSubNode(this.data, nodeName); + return this.modelInterface.getTreeNameOfSubNode(nodeName); + } + public Class getTypeOfProperty(final String nodeName) throws ExmlBuilderException { + return this.modelInterface.getTypeOfProperty(nodeName); + } + public Class getTypeOfSubProperty(final String nodeName) throws ExmlBuilderException { + return this.modelInterface.getTypeOfSubProperty(nodeName); } public void setText(final String text) throws ExmlBuilderException { @@ -70,14 +79,36 @@ public class IntrospectionObject { public void addObject(final String nodeName, final Object value) { List node = this.nodes.get(nodeName); if (node == null) { - if (value instanceof List) { + if (List.class.isAssignableFrom(value.getClass())) { node = (List) value; + } else if (value.getClass().isArray()) { + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); } else { node = new ArrayList<>(); node.add(value); } this.nodes.put(nodeName, node); - } else if (value instanceof List) { + } else if (value.getClass().isArray()) { + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + Log.error("this is a big problem ..."); + } else if (List.class.isAssignableFrom(value.getClass())) { List nodeIn = (List) value; node.addAll(nodeIn); } else { diff --git a/src/org/atriasoft/exml/builder/IntrospectionProperty.java b/src/org/atriasoft/exml/builder/IntrospectionProperty.java index 688a4ed..5a24eb6 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionProperty.java +++ b/src/org/atriasoft/exml/builder/IntrospectionProperty.java @@ -109,9 +109,12 @@ public abstract class IntrospectionProperty { protected Object createValue(final String value) throws ExmlBuilderException { try { if (StringSerializer.contains(this.type)) { - return StringSerializer.valueOf(this.type, value); + // TODO This might be a deprecated code .... + return StringSerializer.valueOf(this.type, value); } - if ((this.type != List.class) || !StringSerializer.contains(this.subType)) { + if (this.type.isEnum()) { + + } else if ((this.type != List.class) || !StringSerializer.contains(this.subType)) { throw new ExmlBuilderException("Can not parse the specific element ... need to introspect and find the 'xxx valueOf(String data);'"); } ArrayList out = new ArrayList<>(); diff --git a/src/org/atriasoft/exml/generator/GeneratorIntrospection.java b/src/org/atriasoft/exml/generator/GeneratorIntrospection.java index c0d7e03..3a18076 100644 --- a/src/org/atriasoft/exml/generator/GeneratorIntrospection.java +++ b/src/org/atriasoft/exml/generator/GeneratorIntrospection.java @@ -46,6 +46,32 @@ public class GeneratorIntrospection implements Generator { return out; } + private String autoArrayToString(final Class clazz, final Object inData, final IntrospectionModel model) throws ExmlBuilderException { + @SuppressWarnings("unchecked") + T[] datas = (T[])inData; + StringBuilder out = new StringBuilder(); + for(int iii=0; iii String autoListToString(final Class clazz, final Object inData, final IntrospectionModel model) throws ExmlBuilderException { + @SuppressWarnings("unchecked") + List elements1 = (List)inData; + StringBuilder out = new StringBuilder(); + for (Object elem1: elements1) { + if (!out.isEmpty()) { + out.append(";"); + } + out.append(model.toString(elem1)); + } + return out.toString(); + } + public void generateProperties(final Object data, final IntrospectionModel introspection, final StringBuilder tmpp) throws ExmlBuilderException { List elements = introspection.getAttributes(); if (elements == null) { @@ -55,9 +81,30 @@ public class GeneratorIntrospection implements Generator { if (!elem.canGetValue()) { continue; } - String dataString=elem.getValueString(data); + Object dataObj = elem.getValue(data); + if (dataObj == null) { + continue; + } + String name = elem.getNames()[0]; + Class type = elem.getType(); + String dataString = null; + if (type.isArray()) { + Class typeClass = elem.getType().componentType(); + if (typeClass.isPrimitive()) { + dataString = StringSerializer.toString(dataObj); + } else { + IntrospectionModel introspectionSub = findOrCreate(ModelType.NORMAL, null, typeClass); + dataString = autoArrayToString(typeClass, dataObj, introspectionSub); + } + } else if (List.class.isAssignableFrom(type)) { + Class typeClass = elem.getSubType(); + IntrospectionModel introspectionSub = findOrCreate(ModelType.NORMAL, null, typeClass); + dataString = autoListToString(typeClass, dataObj, introspectionSub); + } else { + IntrospectionModel introspectionSub = findOrCreate(ModelType.NORMAL, null, dataObj.getClass()); + dataString = introspectionSub.toString(dataObj); + } if (dataString != null) { - String name = elem.getNames()[0]; tmpp.append(" "); tmpp.append(name); tmpp.append("=\""); @@ -133,7 +180,7 @@ public class GeneratorIntrospection implements Generator { generateNode(datas[iii], model, nodeName, tmpp, indent); } } - return; + return; } @SuppressWarnings("unchecked") T[] datas = (T[]) data; @@ -144,7 +191,7 @@ public class GeneratorIntrospection implements Generator { public void generateNode(final Object data, final IntrospectionModel model, final String nodeName, final StringBuilder tmpp, final int indent) throws ExmlBuilderException { - if (model.isEndPoint()) { + if (model.isNative()) { if (model.isList()) { String[] listDatas = model.toStringList(data); for (int iii=0; iii"); } + } else if (model.isEnum()) { + Tools.addIndent(tmpp, indent); + tmpp.append("<"); + tmpp.append(nodeName); + tmpp.append(">"); + tmpp.append(model.toString(data)); + tmpp.append(""); } else { Tools.addIndent(tmpp, indent); tmpp.append("<"); diff --git a/src/org/atriasoft/exml/internal/Log.java b/src/org/atriasoft/exml/internal/Log.java index e833beb..98691a9 100644 --- a/src/org/atriasoft/exml/internal/Log.java +++ b/src/org/atriasoft/exml/internal/Log.java @@ -9,7 +9,7 @@ import io.scenarium.logger.LogLevel; import io.scenarium.logger.Logger; public class Log { - private static final boolean FORCE = false; + private static final boolean FORCE = true; private static final String LIB_NAME = "exml"; private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME); private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL); diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospection.java b/test/src/test/atriasoft/exml/ExmlTestIntrospection.java index 45feccc..3193d36 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospection.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospection.java @@ -44,16 +44,16 @@ public class ExmlTestIntrospection { + " memberLongClass = \"545645645454\"\n" + " memberBooleanClass = \"true\" \n" + " memberStringClass = \"sdfgsdkjfglksqjéé\"\n" - + " memberArrayByte=\"12, 15,123, 100, 2\"\n" - + " memberArrayByteClass=\"\t\t\r\n 12,1, 100,122\"\n" - + " memberArrayShort=\"1245,1894, -100,-12542\"\n" - + " memberArrayShortClass=\"-1245,-1894, 0,2542,15615\"\n" - + " memberArrayInteger=\"123456,-654987\"\n" - + " memberArrayIntegerClass=\"1567845,45621354,-5646544\"\n" - + " memberArrayLong=\"1651324654,65421351685,-5\"\n" - + " memberArrayLongClass=\"6746541351,546546546,564654654,654654654654,-45546\"\n" - + " memberArrayBoolean=\"true, true, false\"\n" - + " memberArrayBooleanClass=\"false, false, true, true\"\n" + + " memberArrayByte=\"12; 15;123; 100; 2\"\n" + + " memberArrayByteClass=\"\t\t\r\n 12;1; 100;122\"\n" + + " memberArrayShort=\"1245;1894; -100;-12542\"\n" + + " memberArrayShortClass=\"-1245;-1894; 0;2542;15615\"\n" + + " memberArrayInteger=\"123456;-654987\"\n" + + " memberArrayIntegerClass=\"1567845;45621354;-5646544\"\n" + + " memberArrayLong=\"1651324654;65421351685;-5\"\n" + + " memberArrayLongClass=\"6746541351;546546546;564654654;654654654654;-45546\"\n" + + " memberArrayBoolean=\"true; true; false\"\n" + + " memberArrayBooleanClass=\"false; false; true; true\"\n" + "/>\n"; //@formatter:on @@ -128,16 +128,16 @@ public class ExmlTestIntrospection { + " memberLongClass = \"545645645454\"\n" + " memberBooleanClass = \"true\" \n" + " memberStringClass = \"sdfgsdkjfglksqjéé\"\n" - + " memberArrayByte=\"12, 15,123, 100, 2\"\n" - + " memberArrayByteClass=\"\t\t\r\n 12,1, 100,122\"\n" - + " memberArrayShort=\"1245,1894, -100,-12542\"\n" - + " memberArrayShortClass=\"-1245,-1894, 0,2542,15615\"\n" - + " memberArrayInteger=\"123456,-654987\"\n" - + " memberArrayIntegerClass=\"1567845,45621354,-5646544\"\n" - + " memberArrayLong=\"1651324654,65421351685,-5\"\n" - + " memberArrayLongClass=\"6746541351,546546546,564654654,654654654654,-45546\"\n" - + " memberArrayBoolean=\"true, true, false\"\n" - + " memberArrayBooleanClass=\"false, false, true, true\"\n" + + " memberArrayByte=\"12; 15;123; 100; 2\"\n" + + " memberArrayByteClass=\"\t\t\r\n 12;1; 100;122\"\n" + + " memberArrayShort=\"1245;1894; -100;-12542\"\n" + + " memberArrayShortClass=\"-1245;-1894; 0;2542;15615\"\n" + + " memberArrayInteger=\"123456;-654987\"\n" + + " memberArrayIntegerClass=\"1567845;45621354;-5646544\"\n" + + " memberArrayLong=\"1651324654;65421351685;-5\"\n" + + " memberArrayLongClass=\"6746541351;546546546;564654654;654654654654;-45546\"\n" + + " memberArrayBoolean=\"true; true; false\"\n" + + " memberArrayBooleanClass=\"false; false; true; true\"\n" + "/>\n"; //@formatter:on final ClassPublicMethodOnly[] root = Assertions.assertDoesNotThrow(() -> Exml.parse(dataToParse, ClassPublicMethodOnly.class, "elem")); diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionBooleanNative.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionBooleanNative.java index 5c290e8..10b6c00 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionBooleanNative.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionBooleanNative.java @@ -5,8 +5,6 @@ */ package test.atriasoft.exml; -import java.util.List; - import org.atriasoft.exml.Exml; import org.atriasoft.exml.annotation.XmlDefaultAttibute; diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionByte.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionByte.java index bc86875..f800bbe 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionByte.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionByte.java @@ -100,19 +100,19 @@ public class ExmlTestIntrospectionByte { private Byte valueA; private Byte valueB; private Byte valueNull; - public Byte isValueA() { + public Byte getValueA() { return this.valueA; } public void setValueA(final Byte valueA) { this.valueA = valueA; } - public Byte isValueB() { + public Byte getValueB() { return this.valueB; } public void setValueB(final Byte valueB) { this.valueB = valueB; } - public Byte isValueNull() { + public Byte getValueNull() { return this.valueNull; } public void setValueNull(final Byte valueNull) { @@ -134,9 +134,9 @@ public class ExmlTestIntrospectionByte { Assertions.assertEquals("", dataTest); final TestByteFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestByteFunc.class, ExmlTestIntrospectionByte.NODE_NAME)); - Assertions.assertEquals((byte)-55, root.isValueA()); - Assertions.assertEquals((byte)57, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals((byte)-55, root.getValueA()); + Assertions.assertEquals((byte)57, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } @XmlDefaultAttibute @@ -237,7 +237,7 @@ public class ExmlTestIntrospectionByte { @Test public void testModelArrayNodeByte() { TestArrayNodeByte elem = new TestArrayNodeByte(); - elem.values = new Byte[] {12, -13, 33, 78, -127};; + elem.values = new Byte[] {12, -13, 33, 78, -127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionByte.NODE_NAME, builder)); @@ -294,19 +294,19 @@ public class ExmlTestIntrospectionByte { private Byte valueA; private Byte valueB; private Byte valueNull; - public Byte isValueA() { + public Byte getValueA() { return this.valueA; } public void setValueA(final Byte valueA) { this.valueA = valueA; } - public Byte isValueB() { + public Byte getValueB() { return this.valueB; } public void setValueB(final Byte valueB) { this.valueB = valueB; } - public Byte isValueNull() { + public Byte getValueNull() { return this.valueNull; } public void setValueNull(final Byte valueNull) { @@ -331,9 +331,9 @@ public class ExmlTestIntrospectionByte { + "", dataTest); final TestNodeByteFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeByteFunc.class, ExmlTestIntrospectionByte.NODE_NAME)); - Assertions.assertEquals((byte)54, root.isValueA()); - Assertions.assertEquals((byte)-68, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals((byte)54, root.getValueA()); + Assertions.assertEquals((byte)-68, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } public class TestArrayNodeByteFunc { diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionByteNative.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionByteNative.java index 428096d..23a8252 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionByteNative.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionByteNative.java @@ -5,8 +5,6 @@ */ package test.atriasoft.exml; -import java.util.List; - import org.atriasoft.exml.Exml; import org.atriasoft.exml.annotation.XmlDefaultAttibute; @@ -71,13 +69,13 @@ public class ExmlTestIntrospectionByteNative { public class TestbyteFunc { private byte valueA; private byte valueB; - public byte isValueA() { + public byte getValueA() { return this.valueA; } public void setValueA(final byte valueA) { this.valueA = valueA; } - public byte isValueB() { + public byte getValueB() { return this.valueB; } public void setValueB(final byte valueB) { @@ -98,8 +96,8 @@ public class ExmlTestIntrospectionByteNative { Assertions.assertEquals("", dataTest); final TestbyteFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestbyteFunc.class, ExmlTestIntrospectionByte.NODE_NAME)); - Assertions.assertEquals((byte)-55, root.isValueA()); - Assertions.assertEquals((byte)57, root.isValueB()); + Assertions.assertEquals((byte)-55, root.getValueA()); + Assertions.assertEquals((byte)57, root.getValueB()); } @XmlDefaultAttibute @@ -165,7 +163,7 @@ public class ExmlTestIntrospectionByteNative { @Test public void testModelArrayNodebyteNative() { TestArrayNodeByteNative elem = new TestArrayNodeByteNative(); - elem.values = new byte[] {12, -13, 33, 78, -127};; + elem.values = new byte[] {12, -13, 33, 78, -127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionByte.NODE_NAME, builder)); @@ -191,13 +189,13 @@ public class ExmlTestIntrospectionByteNative { public class TestNodebyteFunc { private byte valueA; private byte valueB; - public byte isValueA() { + public byte getValueA() { return this.valueA; } public void setValueA(final byte valueA) { this.valueA = valueA; } - public byte isValueB() { + public byte getValueB() { return this.valueB; } public void setValueB(final byte valueB) { @@ -221,8 +219,8 @@ public class ExmlTestIntrospectionByteNative { + "", dataTest); final TestNodebyteFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodebyteFunc.class, ExmlTestIntrospectionByte.NODE_NAME)); - Assertions.assertEquals((byte)54, root.isValueA()); - Assertions.assertEquals((byte)-68, root.isValueB()); + Assertions.assertEquals((byte)54, root.getValueA()); + Assertions.assertEquals((byte)-68, root.getValueB()); } public class TestArrayNodeByteFunc { diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionDouble.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionDouble.java index 39dd865..56f7f71 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionDouble.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionDouble.java @@ -41,8 +41,8 @@ public class ExmlTestIntrospectionDouble { Assertions.assertEquals("", dataTest); final TestDouble root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestDouble.class, ExmlTestIntrospectionDouble.NODE_NAME)); - Assertions.assertEquals((double)12, root.valueA); - Assertions.assertEquals((double)-13, root.valueB); + Assertions.assertEquals(12, root.valueA); + Assertions.assertEquals(-13, root.valueB); Assertions.assertEquals(null, root.valueNull); } @@ -63,11 +63,11 @@ public class ExmlTestIntrospectionDouble { final TestArrayDouble root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayDouble.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((double)12, root.values[0]); - Assertions.assertEquals((double)-13, root.values[1]); - Assertions.assertEquals((double)33, root.values[2]); - Assertions.assertEquals((double)78, root.values[3]); - Assertions.assertEquals((double)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } @XmlDefaultAttibute @@ -87,11 +87,11 @@ public class ExmlTestIntrospectionDouble { final TestListDouble root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListDouble.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.values.size()); - Assertions.assertEquals((double)12, root.values.get(0)); - Assertions.assertEquals((double)-13, root.values.get(1)); - Assertions.assertEquals((double)33, root.values.get(2)); - Assertions.assertEquals((double)78, root.values.get(3)); - Assertions.assertEquals((double)-127, root.values.get(4)); + Assertions.assertEquals(12, root.values.get(0)); + Assertions.assertEquals(-13, root.values.get(1)); + Assertions.assertEquals(33, root.values.get(2)); + Assertions.assertEquals(78, root.values.get(3)); + Assertions.assertEquals(-127, root.values.get(4)); } @@ -100,19 +100,19 @@ public class ExmlTestIntrospectionDouble { private Double valueA; private Double valueB; private Double valueNull; - public Double isValueA() { + public Double getValueA() { return this.valueA; } public void setValueA(final Double valueA) { this.valueA = valueA; } - public Double isValueB() { + public Double getValueB() { return this.valueB; } public void setValueB(final Double valueB) { this.valueB = valueB; } - public Double isValueNull() { + public Double getValueNull() { return this.valueNull; } public void setValueNull(final Double valueNull) { @@ -134,9 +134,9 @@ public class ExmlTestIntrospectionDouble { Assertions.assertEquals("", dataTest); final TestDoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestDoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); - Assertions.assertEquals((double)-55, root.isValueA()); - Assertions.assertEquals((double)57, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals(-55, root.getValueA()); + Assertions.assertEquals(57, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } @XmlDefaultAttibute @@ -165,11 +165,11 @@ public class ExmlTestIntrospectionDouble { final TestArrayDoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayDoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((double)12, root.getValues()[0]); - Assertions.assertEquals((double)-13, root.getValues()[1]); - Assertions.assertEquals((double)33, root.getValues()[2]); - Assertions.assertEquals((double)78, root.getValues()[3]); - Assertions.assertEquals((double)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } @XmlDefaultAttibute @@ -197,11 +197,11 @@ public class ExmlTestIntrospectionDouble { final TestListDoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListDoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.getValues().size()); - Assertions.assertEquals((double)12, root.getValues().get(0)); - Assertions.assertEquals((double)-13, root.getValues().get(1)); - Assertions.assertEquals((double)33, root.getValues().get(2)); - Assertions.assertEquals((double)78, root.getValues().get(3)); - Assertions.assertEquals((double)-127, root.getValues().get(4)); + Assertions.assertEquals(12, root.getValues().get(0)); + Assertions.assertEquals(-13, root.getValues().get(1)); + Assertions.assertEquals(33, root.getValues().get(2)); + Assertions.assertEquals(78, root.getValues().get(3)); + Assertions.assertEquals(-127, root.getValues().get(4)); } public class TestNodeDouble { @@ -226,8 +226,8 @@ public class ExmlTestIntrospectionDouble { + "", dataTest); final TestNodeDouble root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeDouble.class, ExmlTestIntrospectionDouble.NODE_NAME)); - Assertions.assertEquals((double)11, root.valueA); - Assertions.assertEquals((double)-120, root.valueB); + Assertions.assertEquals(11, root.valueA); + Assertions.assertEquals(-120, root.valueB); Assertions.assertEquals(null, root.valueNull); } @@ -237,7 +237,7 @@ public class ExmlTestIntrospectionDouble { @Test public void testModelArrayNodeDouble() { TestArrayNodeDouble elem = new TestArrayNodeDouble(); - elem.values = new Double[] {(double)12, (double)-13, (double)33, (double)78, (double)-127};; + elem.values = new Double[] {(double)12, (double)-13, (double)33, (double)78, (double)-127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionDouble.NODE_NAME, builder)); @@ -253,11 +253,11 @@ public class ExmlTestIntrospectionDouble { final TestArrayNodeDouble root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeDouble.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((double)12, root.values[0]); - Assertions.assertEquals((double)-13, root.values[1]); - Assertions.assertEquals((double)33, root.values[2]); - Assertions.assertEquals((double)78, root.values[3]); - Assertions.assertEquals((double)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } public class TestListNodeDouble { @@ -282,11 +282,11 @@ public class ExmlTestIntrospectionDouble { final TestListNodeDouble root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListNodeDouble.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.values.size()); - Assertions.assertEquals((double)12, root.values.get(0)); - Assertions.assertEquals((double)-13, root.values.get(1)); - Assertions.assertEquals((double)33, root.values.get(2)); - Assertions.assertEquals((double)78, root.values.get(3)); - Assertions.assertEquals((double)-127, root.values.get(4)); + Assertions.assertEquals(12, root.values.get(0)); + Assertions.assertEquals(-13, root.values.get(1)); + Assertions.assertEquals(33, root.values.get(2)); + Assertions.assertEquals(78, root.values.get(3)); + Assertions.assertEquals(-127, root.values.get(4)); } @@ -294,19 +294,19 @@ public class ExmlTestIntrospectionDouble { private Double valueA; private Double valueB; private Double valueNull; - public Double isValueA() { + public Double getValueA() { return this.valueA; } public void setValueA(final Double valueA) { this.valueA = valueA; } - public Double isValueB() { + public Double getValueB() { return this.valueB; } public void setValueB(final Double valueB) { this.valueB = valueB; } - public Double isValueNull() { + public Double getValueNull() { return this.valueNull; } public void setValueNull(final Double valueNull) { @@ -331,9 +331,9 @@ public class ExmlTestIntrospectionDouble { + "", dataTest); final TestNodeDoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeDoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); - Assertions.assertEquals((double)54, root.isValueA()); - Assertions.assertEquals((double)-68, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals(54, root.getValueA()); + Assertions.assertEquals(-68, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } public class TestArrayNodeDoubleFunc { @@ -367,11 +367,11 @@ public class ExmlTestIntrospectionDouble { final TestArrayNodeDoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeDoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((double)12, root.getValues()[0]); - Assertions.assertEquals((double)-13, root.getValues()[1]); - Assertions.assertEquals((double)33, root.getValues()[2]); - Assertions.assertEquals((double)78, root.getValues()[3]); - Assertions.assertEquals((double)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } // Note this is set in static to test an other part of code... @@ -405,11 +405,11 @@ public class ExmlTestIntrospectionDouble { final TestListNodeDoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListNodeDoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.getValues().size()); - Assertions.assertEquals((double)12, root.getValues().get(0)); - Assertions.assertEquals((double)-13, root.getValues().get(1)); - Assertions.assertEquals((double)33, root.getValues().get(2)); - Assertions.assertEquals((double)78, root.getValues().get(3)); - Assertions.assertEquals((double)-127, root.getValues().get(4)); + Assertions.assertEquals(12, root.getValues().get(0)); + Assertions.assertEquals(-13, root.getValues().get(1)); + Assertions.assertEquals(33, root.getValues().get(2)); + Assertions.assertEquals(78, root.getValues().get(3)); + Assertions.assertEquals(-127, root.getValues().get(4)); } } diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionDoubleNative.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionDoubleNative.java index d81f0ec..6d502b5 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionDoubleNative.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionDoubleNative.java @@ -5,8 +5,6 @@ */ package test.atriasoft.exml; -import java.util.List; - import org.atriasoft.exml.Exml; import org.atriasoft.exml.annotation.XmlDefaultAttibute; @@ -29,8 +27,8 @@ public class ExmlTestIntrospectionDoubleNative { @Test public void testModelDoubleNative() { TestDoubleNative elem = new TestDoubleNative(); - elem.valueA = (double)12; - elem.valueB = (double)-13; + elem.valueA = 12; + elem.valueB = -13; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionDouble.NODE_NAME, builder)); @@ -39,8 +37,8 @@ public class ExmlTestIntrospectionDoubleNative { Assertions.assertEquals("", dataTest); final TestDoubleNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestDoubleNative.class, ExmlTestIntrospectionDouble.NODE_NAME)); - Assertions.assertEquals((double)12, root.valueA); - Assertions.assertEquals((double)-13, root.valueB); + Assertions.assertEquals(12, root.valueA); + Assertions.assertEquals(-13, root.valueB); } @XmlDefaultAttibute @@ -60,24 +58,24 @@ public class ExmlTestIntrospectionDoubleNative { final TestArrayDoubleNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayDoubleNative.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((double)12, root.values[0]); - Assertions.assertEquals((double)-13, root.values[1]); - Assertions.assertEquals((double)33, root.values[2]); - Assertions.assertEquals((double)78, root.values[3]); - Assertions.assertEquals((double)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } @XmlDefaultAttibute public class TestdoubleFunc { private double valueA; private double valueB; - public double isValueA() { + public double getValueA() { return this.valueA; } public void setValueA(final double valueA) { this.valueA = valueA; } - public double isValueB() { + public double getValueB() { return this.valueB; } public void setValueB(final double valueB) { @@ -88,8 +86,8 @@ public class ExmlTestIntrospectionDoubleNative { @Test public void testModelDoubleFunc() { TestdoubleFunc elem = new TestdoubleFunc(); - elem.setValueA((double)-55); - elem.setValueB((double)57); + elem.setValueA(-55); + elem.setValueB(57); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionDouble.NODE_NAME, builder)); @@ -98,8 +96,8 @@ public class ExmlTestIntrospectionDoubleNative { Assertions.assertEquals("", dataTest); final TestdoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestdoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); - Assertions.assertEquals((double)-55, root.isValueA()); - Assertions.assertEquals((double)57, root.isValueB()); + Assertions.assertEquals(-55, root.getValueA()); + Assertions.assertEquals(57, root.getValueB()); } @XmlDefaultAttibute @@ -128,11 +126,11 @@ public class ExmlTestIntrospectionDoubleNative { final TestArrayDoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayDoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((double)12, root.getValues()[0]); - Assertions.assertEquals((double)-13, root.getValues()[1]); - Assertions.assertEquals((double)33, root.getValues()[2]); - Assertions.assertEquals((double)78, root.getValues()[3]); - Assertions.assertEquals((double)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } public class TestNodeDoubleNative { @@ -142,8 +140,8 @@ public class ExmlTestIntrospectionDoubleNative { @Test public void testModelNodeDoubleNative() { TestNodeDoubleNative elem = new TestNodeDoubleNative(); - elem.valueA = (double)11; - elem.valueB = (double)-120; + elem.valueA = 11; + elem.valueB = -120; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionDouble.NODE_NAME, builder)); @@ -155,8 +153,8 @@ public class ExmlTestIntrospectionDoubleNative { + "", dataTest); final TestNodeDoubleNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeDoubleNative.class, ExmlTestIntrospectionDouble.NODE_NAME)); - Assertions.assertEquals((double)11, root.valueA); - Assertions.assertEquals((double)-120, root.valueB); + Assertions.assertEquals(11, root.valueA); + Assertions.assertEquals(-120, root.valueB); } public class TestArrayNodeDoubleNative { @@ -165,7 +163,7 @@ public class ExmlTestIntrospectionDoubleNative { @Test public void testModelArrayNodeDoubleNative() { TestArrayNodeDoubleNative elem = new TestArrayNodeDoubleNative(); - elem.values = new double[] {12, -13, 33, 78, -127};; + elem.values = new double[] {12, -13, 33, 78, -127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionDouble.NODE_NAME, builder)); @@ -181,23 +179,23 @@ public class ExmlTestIntrospectionDoubleNative { final TestArrayNodeDoubleNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeDoubleNative.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((double)12, root.values[0]); - Assertions.assertEquals((double)-13, root.values[1]); - Assertions.assertEquals((double)33, root.values[2]); - Assertions.assertEquals((double)78, root.values[3]); - Assertions.assertEquals((double)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } public class TestNodedoubleFunc { private double valueA; private double valueB; - public double isValueA() { + public double getValueA() { return this.valueA; } public void setValueA(final double valueA) { this.valueA = valueA; } - public double isValueB() { + public double getValueB() { return this.valueB; } public void setValueB(final double valueB) { @@ -208,8 +206,8 @@ public class ExmlTestIntrospectionDoubleNative { @Test public void testModelNodeDoubleFunc() { TestNodedoubleFunc elem = new TestNodedoubleFunc(); - elem.setValueA((double)54); - elem.setValueB((double)-68); + elem.setValueA(54); + elem.setValueB(-68); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionDouble.NODE_NAME, builder)); @@ -221,8 +219,8 @@ public class ExmlTestIntrospectionDoubleNative { + "", dataTest); final TestNodedoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodedoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); - Assertions.assertEquals((double)54, root.isValueA()); - Assertions.assertEquals((double)-68, root.isValueB()); + Assertions.assertEquals(54, root.getValueA()); + Assertions.assertEquals(-68, root.getValueB()); } public class TestArrayNodeDoubleFunc { @@ -256,11 +254,11 @@ public class ExmlTestIntrospectionDoubleNative { final TestArrayNodeDoubleFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeDoubleFunc.class, ExmlTestIntrospectionDouble.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((double)12, root.getValues()[0]); - Assertions.assertEquals((double)-13, root.getValues()[1]); - Assertions.assertEquals((double)33, root.getValues()[2]); - Assertions.assertEquals((double)78, root.getValues()[3]); - Assertions.assertEquals((double)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } } diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionEnum.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionEnum.java new file mode 100644 index 0000000..a0431ed --- /dev/null +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionEnum.java @@ -0,0 +1,397 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2021, Edouard DUPIN, all right reserved + * @license MPL v2.0 (see license file) + */ +package test.atriasoft.exml; + +import java.util.List; + +import org.atriasoft.exml.Exml; +import org.atriasoft.exml.annotation.XmlDefaultAttibute; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +public class ExmlTestIntrospectionEnum { + static final String NODE_NAME = "elem"; + @BeforeAll + public static void beforeClass() { + Log.warning("================================================================"); + } + + public enum TestEnumVal { + VALUE_1, + VALUE_2, + VALUE_3; + } + + @XmlDefaultAttibute + public class TestEnum { + public TestEnumVal valueA; + public TestEnumVal valueB; + } + @Test + public void testModelEnum() { + TestEnum elem = new TestEnum(); + elem.valueA = TestEnumVal.VALUE_1; + elem.valueB = TestEnumVal.VALUE_3; + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("", dataTest); + + final TestEnum root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestEnum.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.valueA); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.valueB); + } + + @XmlDefaultAttibute + public class TestArrayEnum { + public TestEnumVal[] values; + } + @Test + public void testModelArrayEnum() { + TestArrayEnum elem = new TestArrayEnum(); + elem.values = new TestEnumVal[] {TestEnumVal.VALUE_1,TestEnumVal.VALUE_2, TestEnumVal.VALUE_3, TestEnumVal.VALUE_1, TestEnumVal.VALUE_2}; + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("", dataTest); + + final TestArrayEnum root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayEnum.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(5, root.values.length); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.values[0]); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.values[1]); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.values[2]); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.values[3]); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.values[4]); + } + + @XmlDefaultAttibute + public class TestListEnum { + public List values; + } + @Test + public void testModelListEnum() { + TestListEnum elem = new TestListEnum(); + elem.values = List.of(TestEnumVal.VALUE_1,TestEnumVal.VALUE_2, TestEnumVal.VALUE_3, TestEnumVal.VALUE_1, TestEnumVal.VALUE_2); + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("", dataTest); + + final TestListEnum root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListEnum.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(5, root.values.size()); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.values.get(0)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.values.get(1)); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.values.get(2)); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.values.get(3)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.values.get(4)); + } + + + @XmlDefaultAttibute + public class TestEnumFunc { + private TestEnumVal valueA; + private TestEnumVal valueB; + public TestEnumVal getValueA() { + return this.valueA; + } + public void setValueA(final TestEnumVal valueA) { + this.valueA = valueA; + } + public TestEnumVal getValueB() { + return this.valueB; + } + public void setValueB(final TestEnumVal valueB) { + this.valueB = valueB; + } + } + + @Test + public void testModelEnumFunc() { + TestEnumFunc elem = new TestEnumFunc(); + elem.setValueA(TestEnumVal.VALUE_1); + elem.setValueB(TestEnumVal.VALUE_2); + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("", dataTest); + + final TestEnumFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestEnumFunc.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValueA()); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValueB()); + } + + @XmlDefaultAttibute + public class TestArrayEnumFunc { + private TestEnumVal[] values; + + public TestEnumVal[] getValues() { + return this.values; + } + + public void setValues(final TestEnumVal[] values) { + this.values = values; + } + + } + @Test + public void testModelArrayEnumFunc() { + TestArrayEnumFunc elem = new TestArrayEnumFunc(); + elem.setValues(new TestEnumVal[] {TestEnumVal.VALUE_1,TestEnumVal.VALUE_2, TestEnumVal.VALUE_3, TestEnumVal.VALUE_1, TestEnumVal.VALUE_2}); + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("", dataTest); + + final TestArrayEnumFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayEnumFunc.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(5, root.getValues().length); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValues()[0]); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValues()[1]); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.getValues()[2]); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValues()[3]); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValues()[4]); + } + + @XmlDefaultAttibute + public class TestListEnumFunc { + private List values; + + public List getValues() { + return this.values; + } + + public void setValues(final List values) { + this.values = values; + } + } + @Test + public void testModelListEnumFunc() { + TestListEnumFunc elem = new TestListEnumFunc(); + elem.setValues(List.of(TestEnumVal.VALUE_1,TestEnumVal.VALUE_2, TestEnumVal.VALUE_3, TestEnumVal.VALUE_1, TestEnumVal.VALUE_2)); + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("", dataTest); + + final TestListEnumFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListEnumFunc.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(5, root.getValues().size()); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValues().get(0)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValues().get(1)); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.getValues().get(2)); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValues().get(3)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValues().get(4)); + } + + public class TestNodeEnum { + public TestEnumVal valueA; + public TestEnumVal valueB; + } + @Test + public void testModelNodeEnum() { + TestNodeEnum elem = new TestNodeEnum(); + elem.valueA = TestEnumVal.VALUE_3; + elem.valueB = TestEnumVal.VALUE_1; + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("\n" + + " VALUE_3\n" + + " VALUE_1\n" + + "", dataTest); + + final TestNodeEnum root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeEnum.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.valueA); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.valueB); + } + + public class TestArrayNodeEnum { + public TestEnumVal[] values; + } + @Test + public void testModelArrayNodeEnum() { + TestArrayNodeEnum elem = new TestArrayNodeEnum(); + elem.values = new TestEnumVal[] {TestEnumVal.VALUE_1,TestEnumVal.VALUE_2, TestEnumVal.VALUE_3, TestEnumVal.VALUE_1, TestEnumVal.VALUE_2}; + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("\n" + + " VALUE_1\n" + + " VALUE_2\n" + + " VALUE_3\n" + + " VALUE_1\n" + + " VALUE_2\n" + + "", dataTest); + + final TestArrayNodeEnum root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeEnum.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(5, root.values.length); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.values[0]); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.values[1]); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.values[2]); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.values[3]); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.values[4]); + } + + public class TestListNodeEnum { + public List values; + } + @Test + public void testModelListNodeEnum() { + TestListNodeEnum elem = new TestListNodeEnum(); + elem.values = List.of(TestEnumVal.VALUE_1,TestEnumVal.VALUE_2, TestEnumVal.VALUE_3, TestEnumVal.VALUE_1, TestEnumVal.VALUE_2); + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("\n" + + " VALUE_1\n" + + " VALUE_2\n" + + " VALUE_3\n" + + " VALUE_1\n" + + " VALUE_2\n" + + "", dataTest); + + final TestListNodeEnum root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListNodeEnum.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(5, root.values.size()); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.values.get(0)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.values.get(1)); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.values.get(2)); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.values.get(3)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.values.get(4)); + } + + + public class TestNodeEnumFunc { + private TestEnumVal valueA; + private TestEnumVal valueB; + public TestEnumVal getValueA() { + return this.valueA; + } + public void setValueA(final TestEnumVal valueA) { + this.valueA = valueA; + } + public TestEnumVal getValueB() { + return this.valueB; + } + public void setValueB(final TestEnumVal valueB) { + this.valueB = valueB; + } + } + + @Test + public void testModelNodeEnumFunc() { + TestNodeEnumFunc elem = new TestNodeEnumFunc(); + elem.setValueA(TestEnumVal.VALUE_2); + elem.setValueB(TestEnumVal.VALUE_3); + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("\n" + + " VALUE_2\n" + + " VALUE_3\n" + + "", dataTest); + + final TestNodeEnumFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeEnumFunc.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValueA()); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.getValueB()); + } + + public class TestArrayNodeEnumFunc { + private TestEnumVal[] values; + + public TestEnumVal[] getValues() { + return this.values; + } + + public void setValues(final TestEnumVal[] values) { + this.values = values; + } + + } + @Test + public void testModelArrayNodeEnumFunc() { + TestArrayNodeEnumFunc elem = new TestArrayNodeEnumFunc(); + elem.setValues(new TestEnumVal[] {TestEnumVal.VALUE_1,TestEnumVal.VALUE_2, TestEnumVal.VALUE_3, TestEnumVal.VALUE_1, TestEnumVal.VALUE_2}); + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("\n" + + " VALUE_1\n" + + " VALUE_2\n" + + " VALUE_3\n" + + " VALUE_1\n" + + " VALUE_2\n" + + "", dataTest); + + final TestArrayNodeEnumFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeEnumFunc.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(5, root.getValues().length); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValues()[0]); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValues()[1]); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.getValues()[2]); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValues()[3]); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValues()[4]); + } + + // Note this is set in static to test an other part of code... + public static class TestListNodeEnumFunc { + private List values; + + public List getValues() { + return this.values; + } + + public void setValues(final List values) { + this.values = values; + } + } + @Test + public void testModelListNodeEnumFunc() { + TestListNodeEnumFunc elem = new TestListNodeEnumFunc(); + elem.setValues(List.of(TestEnumVal.VALUE_1,TestEnumVal.VALUE_2, TestEnumVal.VALUE_3, TestEnumVal.VALUE_1, TestEnumVal.VALUE_2)); + + StringBuilder builder = new StringBuilder(); + Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionEnum.NODE_NAME, builder)); + String dataTest = builder.toString(); + Log.warning("data generated: " + builder.toString()); + Assertions.assertEquals("\n" + + " VALUE_1\n" + + " VALUE_2\n" + + " VALUE_3\n" + + " VALUE_1\n" + + " VALUE_2\n" + + "", dataTest); + + final TestListNodeEnumFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListNodeEnumFunc.class, ExmlTestIntrospectionEnum.NODE_NAME)); + Assertions.assertEquals(5, root.getValues().size()); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValues().get(0)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValues().get(1)); + Assertions.assertEquals(TestEnumVal.VALUE_3, root.getValues().get(2)); + Assertions.assertEquals(TestEnumVal.VALUE_1, root.getValues().get(3)); + Assertions.assertEquals(TestEnumVal.VALUE_2, root.getValues().get(4)); + } +} + diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionFloat.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionFloat.java index 67bfb05..3ac8bbd 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionFloat.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionFloat.java @@ -41,8 +41,8 @@ public class ExmlTestIntrospectionFloat { Assertions.assertEquals("", dataTest); final TestFloat root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestFloat.class, ExmlTestIntrospectionFloat.NODE_NAME)); - Assertions.assertEquals((float)12, root.valueA); - Assertions.assertEquals((float)-13, root.valueB); + Assertions.assertEquals(12, root.valueA); + Assertions.assertEquals(-13, root.valueB); Assertions.assertEquals(null, root.valueNull); } @@ -63,11 +63,11 @@ public class ExmlTestIntrospectionFloat { final TestArrayFloat root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayFloat.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((float)12, root.values[0]); - Assertions.assertEquals((float)-13, root.values[1]); - Assertions.assertEquals((float)33, root.values[2]); - Assertions.assertEquals((float)78, root.values[3]); - Assertions.assertEquals((float)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } @XmlDefaultAttibute @@ -87,11 +87,11 @@ public class ExmlTestIntrospectionFloat { final TestListFloat root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListFloat.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.values.size()); - Assertions.assertEquals((float)12, root.values.get(0)); - Assertions.assertEquals((float)-13, root.values.get(1)); - Assertions.assertEquals((float)33, root.values.get(2)); - Assertions.assertEquals((float)78, root.values.get(3)); - Assertions.assertEquals((float)-127, root.values.get(4)); + Assertions.assertEquals(12, root.values.get(0)); + Assertions.assertEquals(-13, root.values.get(1)); + Assertions.assertEquals(33, root.values.get(2)); + Assertions.assertEquals(78, root.values.get(3)); + Assertions.assertEquals(-127, root.values.get(4)); } @@ -100,19 +100,19 @@ public class ExmlTestIntrospectionFloat { private Float valueA; private Float valueB; private Float valueNull; - public Float isValueA() { + public Float getValueA() { return this.valueA; } public void setValueA(final Float valueA) { this.valueA = valueA; } - public Float isValueB() { + public Float getValueB() { return this.valueB; } public void setValueB(final Float valueB) { this.valueB = valueB; } - public Float isValueNull() { + public Float getValueNull() { return this.valueNull; } public void setValueNull(final Float valueNull) { @@ -134,9 +134,9 @@ public class ExmlTestIntrospectionFloat { Assertions.assertEquals("", dataTest); final TestFloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestFloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); - Assertions.assertEquals((float)-55, root.isValueA()); - Assertions.assertEquals((float)57, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals(-55, root.getValueA()); + Assertions.assertEquals(57, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } @XmlDefaultAttibute @@ -165,11 +165,11 @@ public class ExmlTestIntrospectionFloat { final TestArrayFloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayFloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((float)12, root.getValues()[0]); - Assertions.assertEquals((float)-13, root.getValues()[1]); - Assertions.assertEquals((float)33, root.getValues()[2]); - Assertions.assertEquals((float)78, root.getValues()[3]); - Assertions.assertEquals((float)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } @XmlDefaultAttibute @@ -197,11 +197,11 @@ public class ExmlTestIntrospectionFloat { final TestListFloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListFloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.getValues().size()); - Assertions.assertEquals((float)12, root.getValues().get(0)); - Assertions.assertEquals((float)-13, root.getValues().get(1)); - Assertions.assertEquals((float)33, root.getValues().get(2)); - Assertions.assertEquals((float)78, root.getValues().get(3)); - Assertions.assertEquals((float)-127, root.getValues().get(4)); + Assertions.assertEquals(12, root.getValues().get(0)); + Assertions.assertEquals(-13, root.getValues().get(1)); + Assertions.assertEquals(33, root.getValues().get(2)); + Assertions.assertEquals(78, root.getValues().get(3)); + Assertions.assertEquals(-127, root.getValues().get(4)); } public class TestNodeFloat { @@ -226,8 +226,8 @@ public class ExmlTestIntrospectionFloat { + "", dataTest); final TestNodeFloat root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeFloat.class, ExmlTestIntrospectionFloat.NODE_NAME)); - Assertions.assertEquals((float)11, root.valueA); - Assertions.assertEquals((float)-120, root.valueB); + Assertions.assertEquals(11, root.valueA); + Assertions.assertEquals(-120, root.valueB); Assertions.assertEquals(null, root.valueNull); } @@ -237,7 +237,7 @@ public class ExmlTestIntrospectionFloat { @Test public void testModelArrayNodeFloat() { TestArrayNodeFloat elem = new TestArrayNodeFloat(); - elem.values = new Float[] {(float)12, (float)-13, (float)33, (float)78, (float)-127};; + elem.values = new Float[] {(float)12, (float)-13, (float)33, (float)78, (float)-127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionFloat.NODE_NAME, builder)); @@ -253,11 +253,11 @@ public class ExmlTestIntrospectionFloat { final TestArrayNodeFloat root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeFloat.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((float)12, root.values[0]); - Assertions.assertEquals((float)-13, root.values[1]); - Assertions.assertEquals((float)33, root.values[2]); - Assertions.assertEquals((float)78, root.values[3]); - Assertions.assertEquals((float)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } public class TestListNodeFloat { @@ -282,11 +282,11 @@ public class ExmlTestIntrospectionFloat { final TestListNodeFloat root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListNodeFloat.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.values.size()); - Assertions.assertEquals((float)12, root.values.get(0)); - Assertions.assertEquals((float)-13, root.values.get(1)); - Assertions.assertEquals((float)33, root.values.get(2)); - Assertions.assertEquals((float)78, root.values.get(3)); - Assertions.assertEquals((float)-127, root.values.get(4)); + Assertions.assertEquals(12, root.values.get(0)); + Assertions.assertEquals(-13, root.values.get(1)); + Assertions.assertEquals(33, root.values.get(2)); + Assertions.assertEquals(78, root.values.get(3)); + Assertions.assertEquals(-127, root.values.get(4)); } @@ -294,19 +294,19 @@ public class ExmlTestIntrospectionFloat { private Float valueA; private Float valueB; private Float valueNull; - public Float isValueA() { + public Float getValueA() { return this.valueA; } public void setValueA(final Float valueA) { this.valueA = valueA; } - public Float isValueB() { + public Float getValueB() { return this.valueB; } public void setValueB(final Float valueB) { this.valueB = valueB; } - public Float isValueNull() { + public Float getValueNull() { return this.valueNull; } public void setValueNull(final Float valueNull) { @@ -331,9 +331,9 @@ public class ExmlTestIntrospectionFloat { + "", dataTest); final TestNodeFloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeFloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); - Assertions.assertEquals((float)54, root.isValueA()); - Assertions.assertEquals((float)-68, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals(54, root.getValueA()); + Assertions.assertEquals(-68, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } public class TestArrayNodeFloatFunc { @@ -367,11 +367,11 @@ public class ExmlTestIntrospectionFloat { final TestArrayNodeFloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeFloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((float)12, root.getValues()[0]); - Assertions.assertEquals((float)-13, root.getValues()[1]); - Assertions.assertEquals((float)33, root.getValues()[2]); - Assertions.assertEquals((float)78, root.getValues()[3]); - Assertions.assertEquals((float)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } // Note this is set in static to test an other part of code... @@ -405,11 +405,11 @@ public class ExmlTestIntrospectionFloat { final TestListNodeFloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListNodeFloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.getValues().size()); - Assertions.assertEquals((float)12, root.getValues().get(0)); - Assertions.assertEquals((float)-13, root.getValues().get(1)); - Assertions.assertEquals((float)33, root.getValues().get(2)); - Assertions.assertEquals((float)78, root.getValues().get(3)); - Assertions.assertEquals((float)-127, root.getValues().get(4)); + Assertions.assertEquals(12, root.getValues().get(0)); + Assertions.assertEquals(-13, root.getValues().get(1)); + Assertions.assertEquals(33, root.getValues().get(2)); + Assertions.assertEquals(78, root.getValues().get(3)); + Assertions.assertEquals(-127, root.getValues().get(4)); } } diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionFloatNative.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionFloatNative.java index 8664a4b..dedc91e 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionFloatNative.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionFloatNative.java @@ -5,8 +5,6 @@ */ package test.atriasoft.exml; -import java.util.List; - import org.atriasoft.exml.Exml; import org.atriasoft.exml.annotation.XmlDefaultAttibute; @@ -29,8 +27,8 @@ public class ExmlTestIntrospectionFloatNative { @Test public void testModelFloatNative() { TestFloatNative elem = new TestFloatNative(); - elem.valueA = (float)12; - elem.valueB = (float)-13; + elem.valueA = 12; + elem.valueB = -13; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionFloat.NODE_NAME, builder)); @@ -39,8 +37,8 @@ public class ExmlTestIntrospectionFloatNative { Assertions.assertEquals("", dataTest); final TestFloatNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestFloatNative.class, ExmlTestIntrospectionFloat.NODE_NAME)); - Assertions.assertEquals((float)12, root.valueA); - Assertions.assertEquals((float)-13, root.valueB); + Assertions.assertEquals(12, root.valueA); + Assertions.assertEquals(-13, root.valueB); } @XmlDefaultAttibute @@ -60,24 +58,24 @@ public class ExmlTestIntrospectionFloatNative { final TestArrayFloatNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayFloatNative.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((float)12, root.values[0]); - Assertions.assertEquals((float)-13, root.values[1]); - Assertions.assertEquals((float)33, root.values[2]); - Assertions.assertEquals((float)78, root.values[3]); - Assertions.assertEquals((float)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } @XmlDefaultAttibute public class TestfloatFunc { private float valueA; private float valueB; - public float isValueA() { + public float getValueA() { return this.valueA; } public void setValueA(final float valueA) { this.valueA = valueA; } - public float isValueB() { + public float getValueB() { return this.valueB; } public void setValueB(final float valueB) { @@ -88,8 +86,8 @@ public class ExmlTestIntrospectionFloatNative { @Test public void testModelFloatFunc() { TestfloatFunc elem = new TestfloatFunc(); - elem.setValueA((float)-55); - elem.setValueB((float)57); + elem.setValueA(-55); + elem.setValueB(57); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionFloat.NODE_NAME, builder)); @@ -98,8 +96,8 @@ public class ExmlTestIntrospectionFloatNative { Assertions.assertEquals("", dataTest); final TestfloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestfloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); - Assertions.assertEquals((float)-55, root.isValueA()); - Assertions.assertEquals((float)57, root.isValueB()); + Assertions.assertEquals(-55, root.getValueA()); + Assertions.assertEquals(57, root.getValueB()); } @XmlDefaultAttibute @@ -128,11 +126,11 @@ public class ExmlTestIntrospectionFloatNative { final TestArrayFloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayFloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((float)12, root.getValues()[0]); - Assertions.assertEquals((float)-13, root.getValues()[1]); - Assertions.assertEquals((float)33, root.getValues()[2]); - Assertions.assertEquals((float)78, root.getValues()[3]); - Assertions.assertEquals((float)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } public class TestNodeFloatNative { @@ -142,8 +140,8 @@ public class ExmlTestIntrospectionFloatNative { @Test public void testModelNodeFloatNative() { TestNodeFloatNative elem = new TestNodeFloatNative(); - elem.valueA = (float)11; - elem.valueB = (float)-120; + elem.valueA = 11; + elem.valueB = -120; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionFloat.NODE_NAME, builder)); @@ -155,8 +153,8 @@ public class ExmlTestIntrospectionFloatNative { + "", dataTest); final TestNodeFloatNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeFloatNative.class, ExmlTestIntrospectionFloat.NODE_NAME)); - Assertions.assertEquals((float)11, root.valueA); - Assertions.assertEquals((float)-120, root.valueB); + Assertions.assertEquals(11, root.valueA); + Assertions.assertEquals(-120, root.valueB); } public class TestArrayNodeFloatNative { @@ -165,7 +163,7 @@ public class ExmlTestIntrospectionFloatNative { @Test public void testModelArrayNodeFloatNative() { TestArrayNodeFloatNative elem = new TestArrayNodeFloatNative(); - elem.values = new float[] {12, -13, 33, 78, -127};; + elem.values = new float[] {12, -13, 33, 78, -127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionFloat.NODE_NAME, builder)); @@ -181,23 +179,23 @@ public class ExmlTestIntrospectionFloatNative { final TestArrayNodeFloatNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeFloatNative.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((float)12, root.values[0]); - Assertions.assertEquals((float)-13, root.values[1]); - Assertions.assertEquals((float)33, root.values[2]); - Assertions.assertEquals((float)78, root.values[3]); - Assertions.assertEquals((float)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } public class TestNodefloatFunc { private float valueA; private float valueB; - public float isValueA() { + public float getValueA() { return this.valueA; } public void setValueA(final float valueA) { this.valueA = valueA; } - public float isValueB() { + public float getValueB() { return this.valueB; } public void setValueB(final float valueB) { @@ -208,8 +206,8 @@ public class ExmlTestIntrospectionFloatNative { @Test public void testModelNodeFloatFunc() { TestNodefloatFunc elem = new TestNodefloatFunc(); - elem.setValueA((float)54); - elem.setValueB((float)-68); + elem.setValueA(54); + elem.setValueB(-68); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionFloat.NODE_NAME, builder)); @@ -221,8 +219,8 @@ public class ExmlTestIntrospectionFloatNative { + "", dataTest); final TestNodefloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodefloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); - Assertions.assertEquals((float)54, root.isValueA()); - Assertions.assertEquals((float)-68, root.isValueB()); + Assertions.assertEquals(54, root.getValueA()); + Assertions.assertEquals(-68, root.getValueB()); } public class TestArrayNodeFloatFunc { @@ -256,11 +254,11 @@ public class ExmlTestIntrospectionFloatNative { final TestArrayNodeFloatFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeFloatFunc.class, ExmlTestIntrospectionFloat.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((float)12, root.getValues()[0]); - Assertions.assertEquals((float)-13, root.getValues()[1]); - Assertions.assertEquals((float)33, root.getValues()[2]); - Assertions.assertEquals((float)78, root.getValues()[3]); - Assertions.assertEquals((float)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } } diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionInteger.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionInteger.java index 130d7fa..e1dafb5 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionInteger.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionInteger.java @@ -41,8 +41,8 @@ public class ExmlTestIntrospectionInteger { Assertions.assertEquals("", dataTest); final TestInteger root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestInteger.class, ExmlTestIntrospectionInteger.NODE_NAME)); - Assertions.assertEquals((int)12, root.valueA); - Assertions.assertEquals((int)-13, root.valueB); + Assertions.assertEquals(12, root.valueA); + Assertions.assertEquals(-13, root.valueB); Assertions.assertEquals(null, root.valueNull); } @@ -63,11 +63,11 @@ public class ExmlTestIntrospectionInteger { final TestArrayInteger root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayInteger.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((int)12, root.values[0]); - Assertions.assertEquals((int)-13, root.values[1]); - Assertions.assertEquals((int)33, root.values[2]); - Assertions.assertEquals((int)78, root.values[3]); - Assertions.assertEquals((int)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } @XmlDefaultAttibute @@ -77,7 +77,7 @@ public class ExmlTestIntrospectionInteger { @Test public void testModelListInteger() { TestListInteger elem = new TestListInteger(); - elem.values = List.of((int)12, (int)-13, (int)33, (int)78, (int)-127); + elem.values = List.of(12, -13, 33, 78, -127); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -87,11 +87,11 @@ public class ExmlTestIntrospectionInteger { final TestListInteger root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListInteger.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.values.size()); - Assertions.assertEquals((int)12, root.values.get(0)); - Assertions.assertEquals((int)-13, root.values.get(1)); - Assertions.assertEquals((int)33, root.values.get(2)); - Assertions.assertEquals((int)78, root.values.get(3)); - Assertions.assertEquals((int)-127, root.values.get(4)); + Assertions.assertEquals(12, root.values.get(0)); + Assertions.assertEquals(-13, root.values.get(1)); + Assertions.assertEquals(33, root.values.get(2)); + Assertions.assertEquals(78, root.values.get(3)); + Assertions.assertEquals(-127, root.values.get(4)); } @@ -100,19 +100,19 @@ public class ExmlTestIntrospectionInteger { private Integer valueA; private Integer valueB; private Integer valueNull; - public Integer isValueA() { + public Integer getValueA() { return this.valueA; } public void setValueA(final Integer valueA) { this.valueA = valueA; } - public Integer isValueB() { + public Integer getValueB() { return this.valueB; } public void setValueB(final Integer valueB) { this.valueB = valueB; } - public Integer isValueNull() { + public Integer getValueNull() { return this.valueNull; } public void setValueNull(final Integer valueNull) { @@ -123,8 +123,8 @@ public class ExmlTestIntrospectionInteger { @Test public void testModelIntegerFunc() { TestIntegerFunc elem = new TestIntegerFunc(); - elem.setValueA((int)-55); - elem.setValueB((int)57); + elem.setValueA(-55); + elem.setValueB(57); elem.setValueNull(null); StringBuilder builder = new StringBuilder(); @@ -134,9 +134,9 @@ public class ExmlTestIntrospectionInteger { Assertions.assertEquals("", dataTest); final TestIntegerFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestIntegerFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); - Assertions.assertEquals((int)-55, root.isValueA()); - Assertions.assertEquals((int)57, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals(-55, root.getValueA()); + Assertions.assertEquals(57, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } @XmlDefaultAttibute @@ -165,11 +165,11 @@ public class ExmlTestIntrospectionInteger { final TestArrayIntegerFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayIntegerFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((int)12, root.getValues()[0]); - Assertions.assertEquals((int)-13, root.getValues()[1]); - Assertions.assertEquals((int)33, root.getValues()[2]); - Assertions.assertEquals((int)78, root.getValues()[3]); - Assertions.assertEquals((int)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } @XmlDefaultAttibute @@ -187,7 +187,7 @@ public class ExmlTestIntrospectionInteger { @Test public void testModelListIntegerFunc() { TestListIntegerFunc elem = new TestListIntegerFunc(); - elem.setValues(List.of((int)12, (int)-13, (int)33, (int)78, (int)-127)); + elem.setValues(List.of(12, -13, 33, 78, -127)); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -197,11 +197,11 @@ public class ExmlTestIntrospectionInteger { final TestListIntegerFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListIntegerFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.getValues().size()); - Assertions.assertEquals((int)12, root.getValues().get(0)); - Assertions.assertEquals((int)-13, root.getValues().get(1)); - Assertions.assertEquals((int)33, root.getValues().get(2)); - Assertions.assertEquals((int)78, root.getValues().get(3)); - Assertions.assertEquals((int)-127, root.getValues().get(4)); + Assertions.assertEquals(12, root.getValues().get(0)); + Assertions.assertEquals(-13, root.getValues().get(1)); + Assertions.assertEquals(33, root.getValues().get(2)); + Assertions.assertEquals(78, root.getValues().get(3)); + Assertions.assertEquals(-127, root.getValues().get(4)); } public class TestNodeInteger { @@ -226,8 +226,8 @@ public class ExmlTestIntrospectionInteger { + "", dataTest); final TestNodeInteger root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeInteger.class, ExmlTestIntrospectionInteger.NODE_NAME)); - Assertions.assertEquals((int)11, root.valueA); - Assertions.assertEquals((int)-120, root.valueB); + Assertions.assertEquals(11, root.valueA); + Assertions.assertEquals(-120, root.valueB); Assertions.assertEquals(null, root.valueNull); } @@ -237,7 +237,7 @@ public class ExmlTestIntrospectionInteger { @Test public void testModelArrayNodeInteger() { TestArrayNodeInteger elem = new TestArrayNodeInteger(); - elem.values = new Integer[] {12, -13, 33, 78, -127};; + elem.values = new Integer[] {12, -13, 33, 78, -127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -253,11 +253,11 @@ public class ExmlTestIntrospectionInteger { final TestArrayNodeInteger root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeInteger.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((int)12, root.values[0]); - Assertions.assertEquals((int)-13, root.values[1]); - Assertions.assertEquals((int)33, root.values[2]); - Assertions.assertEquals((int)78, root.values[3]); - Assertions.assertEquals((int)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } public class TestListNodeInteger { @@ -266,7 +266,7 @@ public class ExmlTestIntrospectionInteger { @Test public void testModelListNodeInteger() { TestListNodeInteger elem = new TestListNodeInteger(); - elem.values = List.of((int)12, (int)-13, (int)33, (int)78, (int)-127); + elem.values = List.of(12, -13, 33, 78, -127); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -282,11 +282,11 @@ public class ExmlTestIntrospectionInteger { final TestListNodeInteger root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListNodeInteger.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.values.size()); - Assertions.assertEquals((int)12, root.values.get(0)); - Assertions.assertEquals((int)-13, root.values.get(1)); - Assertions.assertEquals((int)33, root.values.get(2)); - Assertions.assertEquals((int)78, root.values.get(3)); - Assertions.assertEquals((int)-127, root.values.get(4)); + Assertions.assertEquals(12, root.values.get(0)); + Assertions.assertEquals(-13, root.values.get(1)); + Assertions.assertEquals(33, root.values.get(2)); + Assertions.assertEquals(78, root.values.get(3)); + Assertions.assertEquals(-127, root.values.get(4)); } @@ -294,19 +294,19 @@ public class ExmlTestIntrospectionInteger { private Integer valueA; private Integer valueB; private Integer valueNull; - public Integer isValueA() { + public Integer getValueA() { return this.valueA; } public void setValueA(final Integer valueA) { this.valueA = valueA; } - public Integer isValueB() { + public Integer getValueB() { return this.valueB; } public void setValueB(final Integer valueB) { this.valueB = valueB; } - public Integer isValueNull() { + public Integer getValueNull() { return this.valueNull; } public void setValueNull(final Integer valueNull) { @@ -317,8 +317,8 @@ public class ExmlTestIntrospectionInteger { @Test public void testModelNodeIntegerFunc() { TestNodeIntegerFunc elem = new TestNodeIntegerFunc(); - elem.setValueA((int)54); - elem.setValueB((int)-68); + elem.setValueA(54); + elem.setValueB(-68); elem.setValueNull(null); StringBuilder builder = new StringBuilder(); @@ -331,9 +331,9 @@ public class ExmlTestIntrospectionInteger { + "", dataTest); final TestNodeIntegerFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeIntegerFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); - Assertions.assertEquals((int)54, root.isValueA()); - Assertions.assertEquals((int)-68, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals(54, root.getValueA()); + Assertions.assertEquals(-68, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } public class TestArrayNodeIntegerFunc { @@ -367,11 +367,11 @@ public class ExmlTestIntrospectionInteger { final TestArrayNodeIntegerFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeIntegerFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((int)12, root.getValues()[0]); - Assertions.assertEquals((int)-13, root.getValues()[1]); - Assertions.assertEquals((int)33, root.getValues()[2]); - Assertions.assertEquals((int)78, root.getValues()[3]); - Assertions.assertEquals((int)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } // Note this is set in static to test an other part of code... @@ -389,7 +389,7 @@ public class ExmlTestIntrospectionInteger { @Test public void testModelListNodeIntegerFunc() { TestListNodeIntegerFunc elem = new TestListNodeIntegerFunc(); - elem.setValues(List.of((int)12, (int)-13, (int)33, (int)78, (int)-127)); + elem.setValues(List.of(12, -13, 33, 78, -127)); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -405,11 +405,11 @@ public class ExmlTestIntrospectionInteger { final TestListNodeIntegerFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestListNodeIntegerFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.getValues().size()); - Assertions.assertEquals((int)12, root.getValues().get(0)); - Assertions.assertEquals((int)-13, root.getValues().get(1)); - Assertions.assertEquals((int)33, root.getValues().get(2)); - Assertions.assertEquals((int)78, root.getValues().get(3)); - Assertions.assertEquals((int)-127, root.getValues().get(4)); + Assertions.assertEquals(12, root.getValues().get(0)); + Assertions.assertEquals(-13, root.getValues().get(1)); + Assertions.assertEquals(33, root.getValues().get(2)); + Assertions.assertEquals(78, root.getValues().get(3)); + Assertions.assertEquals(-127, root.getValues().get(4)); } } diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionIntegerNative.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionIntegerNative.java index 7afccc7..dcf1887 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionIntegerNative.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionIntegerNative.java @@ -5,8 +5,6 @@ */ package test.atriasoft.exml; -import java.util.List; - import org.atriasoft.exml.Exml; import org.atriasoft.exml.annotation.XmlDefaultAttibute; @@ -29,8 +27,8 @@ public class ExmlTestIntrospectionIntegerNative { @Test public void testModelIntegerNative() { TestIntegerNative elem = new TestIntegerNative(); - elem.valueA = (int)12; - elem.valueB = (int)-13; + elem.valueA = 12; + elem.valueB = -13; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -39,8 +37,8 @@ public class ExmlTestIntrospectionIntegerNative { Assertions.assertEquals("", dataTest); final TestIntegerNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestIntegerNative.class, ExmlTestIntrospectionInteger.NODE_NAME)); - Assertions.assertEquals((int)12, root.valueA); - Assertions.assertEquals((int)-13, root.valueB); + Assertions.assertEquals(12, root.valueA); + Assertions.assertEquals(-13, root.valueB); } @XmlDefaultAttibute @@ -60,24 +58,24 @@ public class ExmlTestIntrospectionIntegerNative { final TestArrayIntegerNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayIntegerNative.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((int)12, root.values[0]); - Assertions.assertEquals((int)-13, root.values[1]); - Assertions.assertEquals((int)33, root.values[2]); - Assertions.assertEquals((int)78, root.values[3]); - Assertions.assertEquals((int)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } @XmlDefaultAttibute public class TestintFunc { private int valueA; private int valueB; - public int isValueA() { + public int getValueA() { return this.valueA; } public void setValueA(final int valueA) { this.valueA = valueA; } - public int isValueB() { + public int getValueB() { return this.valueB; } public void setValueB(final int valueB) { @@ -88,8 +86,8 @@ public class ExmlTestIntrospectionIntegerNative { @Test public void testModelIntegerFunc() { TestintFunc elem = new TestintFunc(); - elem.setValueA((int)-55); - elem.setValueB((int)57); + elem.setValueA(-55); + elem.setValueB(57); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -98,8 +96,8 @@ public class ExmlTestIntrospectionIntegerNative { Assertions.assertEquals("", dataTest); final TestintFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestintFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); - Assertions.assertEquals((int)-55, root.isValueA()); - Assertions.assertEquals((int)57, root.isValueB()); + Assertions.assertEquals(-55, root.getValueA()); + Assertions.assertEquals(57, root.getValueB()); } @XmlDefaultAttibute @@ -128,11 +126,11 @@ public class ExmlTestIntrospectionIntegerNative { final TestArrayIntegerFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayIntegerFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((int)12, root.getValues()[0]); - Assertions.assertEquals((int)-13, root.getValues()[1]); - Assertions.assertEquals((int)33, root.getValues()[2]); - Assertions.assertEquals((int)78, root.getValues()[3]); - Assertions.assertEquals((int)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } public class TestNodeIntegerNative { @@ -142,8 +140,8 @@ public class ExmlTestIntrospectionIntegerNative { @Test public void testModelNodeIntegerNative() { TestNodeIntegerNative elem = new TestNodeIntegerNative(); - elem.valueA = (int)11; - elem.valueB = (int)-120; + elem.valueA = 11; + elem.valueB = -120; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -155,8 +153,8 @@ public class ExmlTestIntrospectionIntegerNative { + "", dataTest); final TestNodeIntegerNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeIntegerNative.class, ExmlTestIntrospectionInteger.NODE_NAME)); - Assertions.assertEquals((int)11, root.valueA); - Assertions.assertEquals((int)-120, root.valueB); + Assertions.assertEquals(11, root.valueA); + Assertions.assertEquals(-120, root.valueB); } public class TestArrayNodeIntegerNative { @@ -165,7 +163,7 @@ public class ExmlTestIntrospectionIntegerNative { @Test public void testModelArrayNodeintNative() { TestArrayNodeIntegerNative elem = new TestArrayNodeIntegerNative(); - elem.values = new int[] {12, -13, 33, 78, -127};; + elem.values = new int[] {12, -13, 33, 78, -127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -181,23 +179,23 @@ public class ExmlTestIntrospectionIntegerNative { final TestArrayNodeIntegerNative root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeIntegerNative.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.values.length); - Assertions.assertEquals((int)12, root.values[0]); - Assertions.assertEquals((int)-13, root.values[1]); - Assertions.assertEquals((int)33, root.values[2]); - Assertions.assertEquals((int)78, root.values[3]); - Assertions.assertEquals((int)-127, root.values[4]); + Assertions.assertEquals(12, root.values[0]); + Assertions.assertEquals(-13, root.values[1]); + Assertions.assertEquals(33, root.values[2]); + Assertions.assertEquals(78, root.values[3]); + Assertions.assertEquals(-127, root.values[4]); } public class TestNodeintFunc { private int valueA; private int valueB; - public int isValueA() { + public int getValueA() { return this.valueA; } public void setValueA(final int valueA) { this.valueA = valueA; } - public int isValueB() { + public int getValueB() { return this.valueB; } public void setValueB(final int valueB) { @@ -208,8 +206,8 @@ public class ExmlTestIntrospectionIntegerNative { @Test public void testModelNodeIntegerFunc() { TestNodeintFunc elem = new TestNodeintFunc(); - elem.setValueA((int)54); - elem.setValueB((int)-68); + elem.setValueA(54); + elem.setValueB(-68); StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionInteger.NODE_NAME, builder)); @@ -221,8 +219,8 @@ public class ExmlTestIntrospectionIntegerNative { + "", dataTest); final TestNodeintFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeintFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); - Assertions.assertEquals((int)54, root.isValueA()); - Assertions.assertEquals((int)-68, root.isValueB()); + Assertions.assertEquals(54, root.getValueA()); + Assertions.assertEquals(-68, root.getValueB()); } public class TestArrayNodeIntegerFunc { @@ -256,11 +254,11 @@ public class ExmlTestIntrospectionIntegerNative { final TestArrayNodeIntegerFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestArrayNodeIntegerFunc.class, ExmlTestIntrospectionInteger.NODE_NAME)); Assertions.assertEquals(5, root.getValues().length); - Assertions.assertEquals((int)12, root.getValues()[0]); - Assertions.assertEquals((int)-13, root.getValues()[1]); - Assertions.assertEquals((int)33, root.getValues()[2]); - Assertions.assertEquals((int)78, root.getValues()[3]); - Assertions.assertEquals((int)-127, root.getValues()[4]); + Assertions.assertEquals(12, root.getValues()[0]); + Assertions.assertEquals(-13, root.getValues()[1]); + Assertions.assertEquals(33, root.getValues()[2]); + Assertions.assertEquals(78, root.getValues()[3]); + Assertions.assertEquals(-127, root.getValues()[4]); } } diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionShort.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionShort.java index 4832c0c..60fca06 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionShort.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionShort.java @@ -100,19 +100,19 @@ public class ExmlTestIntrospectionShort { private Short valueA; private Short valueB; private Short valueNull; - public Short isValueA() { + public Short getValueA() { return this.valueA; } public void setValueA(final Short valueA) { this.valueA = valueA; } - public Short isValueB() { + public Short getValueB() { return this.valueB; } public void setValueB(final Short valueB) { this.valueB = valueB; } - public Short isValueNull() { + public Short getValueNull() { return this.valueNull; } public void setValueNull(final Short valueNull) { @@ -134,9 +134,9 @@ public class ExmlTestIntrospectionShort { Assertions.assertEquals("", dataTest); final TestShortFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestShortFunc.class, ExmlTestIntrospectionShort.NODE_NAME)); - Assertions.assertEquals((short)-55, root.isValueA()); - Assertions.assertEquals((short)57, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals((short)-55, root.getValueA()); + Assertions.assertEquals((short)57, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } @XmlDefaultAttibute @@ -237,7 +237,7 @@ public class ExmlTestIntrospectionShort { @Test public void testModelArrayNodeShort() { TestArrayNodeShort elem = new TestArrayNodeShort(); - elem.values = new Short[] {12, -13, 33, 78, -127};; + elem.values = new Short[] {12, -13, 33, 78, -127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionShort.NODE_NAME, builder)); @@ -294,19 +294,19 @@ public class ExmlTestIntrospectionShort { private Short valueA; private Short valueB; private Short valueNull; - public Short isValueA() { + public Short getValueA() { return this.valueA; } public void setValueA(final Short valueA) { this.valueA = valueA; } - public Short isValueB() { + public Short getValueB() { return this.valueB; } public void setValueB(final Short valueB) { this.valueB = valueB; } - public Short isValueNull() { + public Short getValueNull() { return this.valueNull; } public void setValueNull(final Short valueNull) { @@ -331,9 +331,9 @@ public class ExmlTestIntrospectionShort { + "", dataTest); final TestNodeShortFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeShortFunc.class, ExmlTestIntrospectionShort.NODE_NAME)); - Assertions.assertEquals((short)54, root.isValueA()); - Assertions.assertEquals((short)-68, root.isValueB()); - Assertions.assertEquals(null, root.isValueNull()); + Assertions.assertEquals((short)54, root.getValueA()); + Assertions.assertEquals((short)-68, root.getValueB()); + Assertions.assertEquals(null, root.getValueNull()); } public class TestArrayNodeShortFunc { diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospectionShortNative.java b/test/src/test/atriasoft/exml/ExmlTestIntrospectionShortNative.java index 4d8c60c..b44fc58 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospectionShortNative.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospectionShortNative.java @@ -5,8 +5,6 @@ */ package test.atriasoft.exml; -import java.util.List; - import org.atriasoft.exml.Exml; import org.atriasoft.exml.annotation.XmlDefaultAttibute; @@ -71,13 +69,13 @@ public class ExmlTestIntrospectionShortNative { public class TestshortFunc { private short valueA; private short valueB; - public short isValueA() { + public short getValueA() { return this.valueA; } public void setValueA(final short valueA) { this.valueA = valueA; } - public short isValueB() { + public short getValueB() { return this.valueB; } public void setValueB(final short valueB) { @@ -98,8 +96,8 @@ public class ExmlTestIntrospectionShortNative { Assertions.assertEquals("", dataTest); final TestshortFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestshortFunc.class, ExmlTestIntrospectionShort.NODE_NAME)); - Assertions.assertEquals((short)-55, root.isValueA()); - Assertions.assertEquals((short)57, root.isValueB()); + Assertions.assertEquals((short)-55, root.getValueA()); + Assertions.assertEquals((short)57, root.getValueB()); } @XmlDefaultAttibute @@ -165,7 +163,7 @@ public class ExmlTestIntrospectionShortNative { @Test public void testModelArrayNodeshortNative() { TestArrayNodeShortNative elem = new TestArrayNodeShortNative(); - elem.values = new short[] {12, -13, 33, 78, -127};; + elem.values = new short[] {12, -13, 33, 78, -127}; StringBuilder builder = new StringBuilder(); Assertions.assertDoesNotThrow(() -> Exml.generate(elem, ExmlTestIntrospectionShort.NODE_NAME, builder)); @@ -191,13 +189,13 @@ public class ExmlTestIntrospectionShortNative { public class TestNodeshortFunc { private short valueA; private short valueB; - public short isValueA() { + public short getValueA() { return this.valueA; } public void setValueA(final short valueA) { this.valueA = valueA; } - public short isValueB() { + public short getValueB() { return this.valueB; } public void setValueB(final short valueB) { @@ -221,8 +219,8 @@ public class ExmlTestIntrospectionShortNative { + "", dataTest); final TestNodeshortFunc root = Assertions.assertDoesNotThrow(() -> Exml.parseOne(dataTest, TestNodeshortFunc.class, ExmlTestIntrospectionShort.NODE_NAME)); - Assertions.assertEquals((short)54, root.isValueA()); - Assertions.assertEquals((short)-68, root.isValueB()); + Assertions.assertEquals((short)54, root.getValueA()); + Assertions.assertEquals((short)-68, root.getValueB()); } public class TestArrayNodeShortFunc {