diff --git a/src/org/atriasoft/exml/Exml.java b/src/org/atriasoft/exml/Exml.java index eda31cd..7d7186e 100644 --- a/src/org/atriasoft/exml/Exml.java +++ b/src/org/atriasoft/exml/Exml.java @@ -6,14 +6,12 @@ package org.atriasoft.exml; -import java.io.File; 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.nio.file.Paths; import java.util.List; import org.atriasoft.etk.Uri; @@ -88,7 +86,7 @@ public class Exml { } return null; } - private static String readFile(Path path, Charset encoding) throws IOException + private static String readFile(final Path path, final Charset encoding) throws IOException { byte[] encoded = Files.readAllBytes(path); return new String(encoded, encoding); @@ -97,11 +95,11 @@ public class Exml { public static T[] parse(final Path path, final Class classType, final String rootNodeName) throws ExmlBuilderException, ExmlParserErrorMulti { String content = null; try { - content = readFile(path, StandardCharsets.UTF_8); + content = Exml.readFile(path, StandardCharsets.UTF_8); } catch (IOException e) { e.printStackTrace(); } - return parse(content, classType, rootNodeName); + return Exml.parse(content, classType, rootNodeName); } diff --git a/src/org/atriasoft/exml/annotation/XmlProperty.java b/src/org/atriasoft/exml/annotation/XmlAttribute.java similarity index 94% rename from src/org/atriasoft/exml/annotation/XmlProperty.java rename to src/org/atriasoft/exml/annotation/XmlAttribute.java index 5948efc..c4d9dcd 100644 --- a/src/org/atriasoft/exml/annotation/XmlProperty.java +++ b/src/org/atriasoft/exml/annotation/XmlAttribute.java @@ -11,7 +11,7 @@ import java.lang.annotation.Target; @Target({ ElementType.FIELD, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @ExmlAnnotation -public @interface XmlProperty { +public @interface XmlAttribute { /** * Set at true to set the element managed as a property of the Xml node * @return property management. diff --git a/src/org/atriasoft/exml/annotation/XmlModel.java b/src/org/atriasoft/exml/annotation/XmlModel.java new file mode 100644 index 0000000..3ab86f7 --- /dev/null +++ b/src/org/atriasoft/exml/annotation/XmlModel.java @@ -0,0 +1,35 @@ +package org.atriasoft.exml.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marker annotation that can be used to define a group list of element: + * {@code + * + * ... + * ... + * ... + * + * } + */ +@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER }) +@Retention(RetentionPolicy.RUNTIME) +@ExmlAnnotation +public @interface XmlModel { + + /** + * Group names node + * @return The name of the group + * @apiNote this is incompatible with XmlName + */ + String group(); + /** + * Element names inside the group + * @return The name of the element in the group + * @apiNote this is incompatible with XmlName + */ + String element(); +} \ No newline at end of file diff --git a/src/org/atriasoft/exml/annotation/XmlName.java b/src/org/atriasoft/exml/annotation/XmlName.java index 6990d71..cc7b4cd 100644 --- a/src/org/atriasoft/exml/annotation/XmlName.java +++ b/src/org/atriasoft/exml/annotation/XmlName.java @@ -18,6 +18,7 @@ public @interface XmlName { * Names of the property of the Element name * @note The first name if the default generated in serialization. * @return The list the the possible names + * @apiNote this is incompatible with XmlModel */ String[] value(); } \ No newline at end of file diff --git a/src/org/atriasoft/exml/builder/BuilderIntrospection.java b/src/org/atriasoft/exml/builder/BuilderIntrospection.java index c556118..2082992 100644 --- a/src/org/atriasoft/exml/builder/BuilderIntrospection.java +++ b/src/org/atriasoft/exml/builder/BuilderIntrospection.java @@ -32,8 +32,6 @@ public class BuilderIntrospection implements Builder { @Override public void newComment(final Object element, final String comment) throws ExmlBuilderException { - // we drop all comment, we have no need of it. - return; } @Override @@ -44,30 +42,34 @@ public class BuilderIntrospection implements Builder { @Override public Object newElement(final Object parent, final String nodeName) throws ExmlBuilderException, Exception { + Log.warning("new element on NodeName=" + nodeName); final IntrospectionObject introspectionObject = (IntrospectionObject) parent; if (introspectionObject.getDataInterface() == null) { final Object previousData = introspectionObject.getData(); - if (previousData != null && previousData instanceof List) { - final List rootList = (List) previousData; - // detect root node... - if (nodeName.contentEquals(this.rootNodeName)) { - Log.verbose("Create new class: " + this.rootClassType.getCanonicalName()); - final IntrospectionData inferData = findOrCreate(this.rootClassType); - final Object newElement = inferData.createObject(); - rootList.add(newElement); - return new IntrospectionObject(inferData, newElement); - } else { - // need to add a throw on the node... - return null; // ==> disable the parsing.. - } - } else { + if ((previousData == null) || !(previousData instanceof List)) { // throw an error... return null; } - } else { - + final List rootList = (List) previousData; + // detect root node... + // TODO Pb if the root name appeared multiple time in the XML !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ==> need a urgent correction + if (nodeName.contentEquals(this.rootNodeName)) { + Log.verbose("Create new class: " + this.rootClassType.getCanonicalName()); + final IntrospectionData inferData = findOrCreate(this.rootClassType); + final Object newElement = inferData.createObject(); + rootList.add(newElement); + return new IntrospectionObject(inferData, newElement); + } + // need to add a throw on the node... + return null; // ==> disable the parsing.. + } + Class typeClass = introspectionObject.getTypeOfSubNode(nodeName); + if (typeClass != null) { + Log.verbose("Create new class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'"); + final IntrospectionData inferData = findOrCreate(typeClass); + // Create the data when object is ended created... + return new IntrospectionObject(inferData, null); } - return null; } @@ -90,7 +92,11 @@ public class BuilderIntrospection implements Builder { @Override public void newText(final Object parent, final String text) throws ExmlBuilderException { final IntrospectionObject introspectionObject = (IntrospectionObject) parent; - + if (introspectionObject.getDataInterface() == null) { + // property on nothing ??? + return; + } + introspectionObject.setText(text); } } diff --git a/src/org/atriasoft/exml/builder/IntrospectionData.java b/src/org/atriasoft/exml/builder/IntrospectionData.java index a38792f..fb31e03 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionData.java +++ b/src/org/atriasoft/exml/builder/IntrospectionData.java @@ -406,23 +406,49 @@ public class IntrospectionData { } public void setProperty(final Object data, final String propertyName, final String propertyValue) throws Exception { - //Log.error(" propertyName='" + propertyName + "' propertyValue='" + propertyValue + "' "); + Log.error(" propertyName='" + propertyName + "' propertyValue='" + propertyValue + "' "); // by default use setter to set the property final IntrospectionProperty propMethode = findMethodDescription(propertyName); - if (propMethode != null && propMethode.cansetValue()) { - //Log.error(" ==> find '" + propMethode.getNames()); + if (propMethode != null && propMethode.canSetValue()) { + Log.verbose(" ==> find '" + propMethode.getNames()); propMethode.setValue(data, propertyValue); return; } // try with direct field final IntrospectionProperty propField = findPropertyDescription(propertyName); - if (propField != null && propField.cansetValue()) { - //Log.error(" ==> find '" + propField.getNames()); + if (propField != null && propField.canSetValue()) { + Log.verbose(" ==> find '" + propField.getNames()); propField.setValue(data, propertyValue); return; } throw new Exception("can not find the field '" + propertyName + "'"); } + + /** + * Detect a subNode, and ask the type of the node at the parent Class + * @param nodeName Name of the node + * @return Class of the node to create + */ + public Class getTypeOfSubNode(final Object data, final String nodeName) throws Exception { + Log.error(" nodeType='" + nodeName + "'"); + // by default use setter to set the property + final IntrospectionProperty propMethode = findMethodDescription(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 Exception("can not find the field '" + nodeName + "'"); + } + + public void setText(final Object data, final String text) { + Log.todo("add text to element ... '" + text + "' for type : " + this.classType.getCanonicalName()); + } } diff --git a/src/org/atriasoft/exml/builder/IntrospectionObject.java b/src/org/atriasoft/exml/builder/IntrospectionObject.java index 78c0bf5..20208ce 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionObject.java +++ b/src/org/atriasoft/exml/builder/IntrospectionObject.java @@ -31,4 +31,17 @@ public class IntrospectionObject { this.dataInterface.setProperty(this.data, propertyName, propertyValue); } + + /** + * Detect a subNode, and ask the type of the node at the parent Class + * @param nodeName Name of the node + * @return Class of the node to create + */ + public Class getTypeOfSubNode(final String nodeName) throws Exception { + return this.dataInterface.getTypeOfSubNode(this.data, nodeName); + } + + public void setText(final String text) { + this.dataInterface.setText(this.data, text); + } } diff --git a/src/org/atriasoft/exml/builder/IntrospectionProperty.java b/src/org/atriasoft/exml/builder/IntrospectionProperty.java index 51adbf9..8506c9f 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionProperty.java +++ b/src/org/atriasoft/exml/builder/IntrospectionProperty.java @@ -15,7 +15,7 @@ public abstract class IntrospectionProperty { public abstract boolean canGetValue(); - public abstract boolean cansetValue(); + public abstract boolean canSetValue(); public String[] getNames() { return this.names; diff --git a/src/org/atriasoft/exml/builder/IntrospectionPropertyField.java b/src/org/atriasoft/exml/builder/IntrospectionPropertyField.java index e46d384..d62b021 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionPropertyField.java +++ b/src/org/atriasoft/exml/builder/IntrospectionPropertyField.java @@ -19,7 +19,7 @@ public class IntrospectionPropertyField extends IntrospectionProperty { } @Override - public boolean cansetValue() { + public boolean canSetValue() { return true; } diff --git a/src/org/atriasoft/exml/builder/IntrospectionPropertyMethod.java b/src/org/atriasoft/exml/builder/IntrospectionPropertyMethod.java index 5d4b42a..93f917a 100644 --- a/src/org/atriasoft/exml/builder/IntrospectionPropertyMethod.java +++ b/src/org/atriasoft/exml/builder/IntrospectionPropertyMethod.java @@ -41,7 +41,7 @@ public class IntrospectionPropertyMethod extends IntrospectionProperty { } @Override - public boolean cansetValue() { + public boolean canSetValue() { return this.setter != null; } diff --git a/src/org/atriasoft/exml/internal/Log.java b/src/org/atriasoft/exml/internal/Log.java index 160005e..98691a9 100644 --- a/src/org/atriasoft/exml/internal/Log.java +++ b/src/org/atriasoft/exml/internal/Log.java @@ -9,6 +9,7 @@ import io.scenarium.logger.LogLevel; import io.scenarium.logger.Logger; public class Log { + 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); @@ -21,13 +22,13 @@ public class Log { private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING); public static void critical(final String data) { - if (Log.PRINT_CRITICAL) { + if (Log.PRINT_CRITICAL || Log.FORCE) { Logger.critical(Log.LIB_NAME_DRAW, data); } } public static void debug(final String data) { - if (Log.PRINT_DEBUG) { + if (Log.PRINT_DEBUG || Log.FORCE) { Logger.debug(Log.LIB_NAME_DRAW, data); } } @@ -38,37 +39,37 @@ public class Log { } public static void error(final String data) { - if (Log.PRINT_ERROR) { + if (Log.PRINT_ERROR || Log.FORCE) { Logger.error(Log.LIB_NAME_DRAW, data); } } public static void info(final String data) { - if (Log.PRINT_INFO) { + if (Log.PRINT_INFO || Log.FORCE) { Logger.info(Log.LIB_NAME_DRAW, data); } } public static void print(final String data) { - if (Log.PRINT_PRINT) { + if (Log.PRINT_PRINT || Log.FORCE) { Logger.print(Log.LIB_NAME_DRAW, data); } } public static void todo(final String data) { - if (Log.PRINT_TODO) { + if (Log.PRINT_TODO || Log.FORCE) { Logger.todo(Log.LIB_NAME_DRAW, data); } } public static void verbose(final String data) { - if (Log.PRINT_VERBOSE) { + if (Log.PRINT_VERBOSE || Log.FORCE) { Logger.verbose(Log.LIB_NAME_DRAW, data); } } public static void warning(final String data) { - if (Log.PRINT_WARNING) { + if (Log.PRINT_WARNING || Log.FORCE) { Logger.warning(Log.LIB_NAME_DRAW, data); } } diff --git a/src/org/atriasoft/exml/model/XmlNode.java b/src/org/atriasoft/exml/model/XmlNode.java index 1a21a49..90d77fc 100644 --- a/src/org/atriasoft/exml/model/XmlNode.java +++ b/src/org/atriasoft/exml/model/XmlNode.java @@ -44,7 +44,7 @@ public abstract class XmlNode { public abstract XmlNodeType getType(); /** - * Get the current element Value (value in the XML tag . + * Get the current element Value (value in the XML tag >VALUE ... < >/VALUE<. * @return the reference of the string value. */ public String getValue() { diff --git a/src/org/atriasoft/exml/parser/ParseXml.java b/src/org/atriasoft/exml/parser/ParseXml.java index 5c6302a..1a8b98f 100644 --- a/src/org/atriasoft/exml/parser/ParseXml.java +++ b/src/org/atriasoft/exml/parser/ParseXml.java @@ -457,7 +457,7 @@ public class ParseXml { } if (data.charAt(iii + white + 1) == '/') { tmpPos.increment(); - //EXMLDEBUG("Generate node name : '" << data[iii+1] << "'"); + Log.debug("Detect END of Node name : '" + nameElement + "'"); int endPosName = iii + white + 1; // generate element name ... for (int jjj = iii + white + 2; jjj < data.length(); jjj++) { @@ -469,13 +469,13 @@ public class ParseXml { tmpPos.check(data.charAt(jjj)); } final String tmpname = data.substring(iii + white + 2, endPosName + 1); - String tmpnameCheck = tmpname; + String tmpNameCheck = tmpname; String nameElementCheck = nameElement; if (parsingProperty.getCaseSensitive()) { - tmpnameCheck = tmpname.toLowerCase(); + tmpNameCheck = tmpname.toLowerCase(); nameElementCheck = nameElement.toLowerCase(); } - if (!tmpnameCheck.contentEquals(nameElementCheck)) { + if (!tmpNameCheck.contentEquals(nameElementCheck)) { parsingProperty.createError(new ExmlParserError(Tools.extractLine(data, pos.value), filePos, "End node error : '" + tmpname + "' != '" + nameElement + "'")); return false; } @@ -507,7 +507,7 @@ public class ParseXml { if (Tools.checkAvaillable(data.charAt(iii + white + 1), true)) { tmpPos.increment(); - Log.debug("Generate node name : '" + data.charAt(iii + 1) + "'"); + Log.debug("Generate node name : '" + data.charAt(iii + 1) + "...'"); int endPosName = iii + white + 1; // generate element name ... for (int jjj = iii + white + 2; jjj < data.length(); jjj++) { diff --git a/test/src/test/atriasoft/exml/ExmlTestIntrospection.java b/test/src/test/atriasoft/exml/ExmlTestIntrospection.java index 1dc0fac..f378cf7 100644 --- a/test/src/test/atriasoft/exml/ExmlTestIntrospection.java +++ b/test/src/test/atriasoft/exml/ExmlTestIntrospection.java @@ -10,12 +10,15 @@ import java.util.Arrays; import org.atriasoft.exml.Exml; import org.atriasoft.exml.exception.ExmlBuilderException; import org.atriasoft.exml.exception.ExmlParserErrorMulti; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import test.atriasoft.exml.introspection.ClassPublicMemberOnly; import test.atriasoft.exml.introspection.ClassPublicMethodOnly; +import test.atriasoft.exml.introspection.ClassPublicMethodeNode; +import test.atriasoft.exml.introspection.ClassPublicMethodeStructured; public class ExmlTestIntrospection { @BeforeAll @@ -107,7 +110,7 @@ public class ExmlTestIntrospection { Assertions.assertArrayEquals(Arrays.asList(false, false, true, true).toArray(), elem.memberArrayBooleanClass); } - + @Test public void test2() { //@formatter:off @@ -190,4 +193,146 @@ public class ExmlTestIntrospection { Assertions.assertEquals(4, elem.getMemberArrayBooleanClass().length); Assertions.assertArrayEquals(Arrays.asList(false, false, true, true).toArray(), elem.getMemberArrayBooleanClass()); } + + @Test + public void test3() { + //@formatter:off + final String dataToParse = "\n" + + " 12\n" + + " 1223\n" + + " 4541542\n" + + " 4564654654\n" + + " true\n" + + " 55\n" + + " 1523\n" + + " 4654654\n" + + " 545645645454\n" + + " true\n" + + " sdfgsdkjfglksqjéé\n" + + " 12\n" + + " 15\n" + + " 123\n" + + " 100\n" + + " 2\n" + + " \t\t\r\n 12\n" + + " 1\n" + + " 100\n" + + " 122\n" + + " 1245\n" + + " 1894\n" + + " -100\n" + + " -12542\n" + + " -1245\n" + + " -1894\n" + + " 0\n" + + " 2542\n" + + " 15615\n" + + " 123456\n" + + " -654987\n" + + " 1567845\n" + + " 45621354\n" + + " -5646544\n" + + " 1651324654\n" + + " 65421351685\n" + + " -5\n" + + " 6746541351\n" + + " 546546546\n" + + " 564654654\n" + + " 654654654654\n" + + " -45546\n" + + " true\n" + + " true\n" + + " false\n" + + " false\n" + + " false\n" + + " true\n" + + " true\n" + + "\n"; + //@formatter:on + final ClassPublicMethodeNode[] root = Assertions.assertDoesNotThrow(() -> Exml.parse(dataToParse, ClassPublicMethodeNode.class, "elem")); + Assertions.assertEquals(1, root.length); + + final ClassPublicMethodeNode elem = root[0]; + Assertions.assertEquals((byte) 12, elem.getMemberByte()); + Assertions.assertEquals((short) 1223, elem.getMemberShort()); + Assertions.assertEquals(4541542, elem.getMemberInteger()); + Assertions.assertEquals(4564654654L, elem.getMemberLong()); + Assertions.assertEquals(true, elem.isMemberBoolean()); + Assertions.assertEquals((byte) 55, elem.getMemberByteClass()); + Assertions.assertEquals((short) 1523, elem.getMemberShortClass()); + Assertions.assertEquals(4654654, elem.getMemberIntegerClass()); + Assertions.assertEquals(545645645454L, elem.getMemberLongClass()); + Assertions.assertEquals(true, elem.isMemberBooleanClass()); + Assertions.assertEquals("sdfgsdkjfglksqjéé", elem.getMemberStringClass()); + Assertions.assertEquals(5, elem.getMemberArrayByte().length); + Assertions.assertEquals((byte) 12, elem.getMemberArrayByte()[0]); + Assertions.assertEquals((byte) 15, elem.getMemberArrayByte()[1]); + Assertions.assertEquals((byte) 123, elem.getMemberArrayByte()[2]); + Assertions.assertEquals((byte) 100, elem.getMemberArrayByte()[3]); + Assertions.assertEquals(2, elem.getMemberArrayByte()[4]); + Assertions.assertEquals(4, elem.getMemberArrayByteClass().length); + Assertions.assertEquals((byte) 12, elem.getMemberArrayByteClass()[0]); + Assertions.assertEquals((byte) 1, elem.getMemberArrayByteClass()[1]); + Assertions.assertEquals((byte) 100, elem.getMemberArrayByteClass()[2]); + Assertions.assertEquals((byte) 122, elem.getMemberArrayByteClass()[3]); + + Assertions.assertEquals(4, elem.getMemberArrayShort().length); + Assertions.assertEquals((short) 1245, elem.getMemberArrayShort()[0]); + Assertions.assertEquals((short) 1894, elem.getMemberArrayShort()[1]); + Assertions.assertEquals((short) -100, elem.getMemberArrayShort()[2]); + Assertions.assertEquals((short) -12542, elem.getMemberArrayShort()[3]); + + Assertions.assertEquals(5, elem.getMemberArrayShortClass().length); + Assertions.assertEquals((short) -1245, elem.getMemberArrayShortClass()[0]); + Assertions.assertEquals((short) -1894, elem.getMemberArrayShortClass()[1]); + Assertions.assertEquals((short) 0, elem.getMemberArrayShortClass()[2]); + Assertions.assertEquals((short) 2542, elem.getMemberArrayShortClass()[3]); + Assertions.assertEquals((short) 15615, elem.getMemberArrayShortClass()[4]); + + Assertions.assertEquals(2, elem.getMemberArrayInteger().length); + //Assertions.assertArrayEquals(Arrays.asList(123456, -654987).toArray(), elem.getMemberArrayInteger()); + + Assertions.assertEquals(3, elem.getMemberArrayIntegerClass().length); + Assertions.assertArrayEquals(Arrays.asList(1567845, 45621354, -5646544).toArray(), elem.getMemberArrayIntegerClass()); + + Assertions.assertEquals(3, elem.getMemberArrayLong().length); + //Assertions.assertArrayEquals(Arrays.asList(1651324654L, 65421351685L, -5L).toArray(), elem.getMemberArrayLong()); + Assertions.assertEquals(5, elem.getMemberArrayLongClass().length); + Assertions.assertArrayEquals(Arrays.asList(6746541351L, 546546546L, 564654654L, 654654654654L, -45546L).toArray(), elem.getMemberArrayLongClass()); + Assertions.assertEquals(3, elem.getMemberArrayBoolean().length); + //Assertions.assertArrayEquals(Arrays.asList(true, true, false).toArray(), elem.getMemberArrayBoolean()); + Assertions.assertEquals(4, elem.getMemberArrayBooleanClass().length); + Assertions.assertArrayEquals(Arrays.asList(false, false, true, true).toArray(), elem.getMemberArrayBooleanClass()); + } + + @Test + public void test4() { + //@formatter:off + final String dataToParse = "\n" + + " \n" + + " 12\n" + + " 15\n" + + " 123\n" + + " 100\n" + + " 2\n" + + " \n" + + " \n" + + " 12\n" + + " 15\n" + + " 123\n" + + " 100\n" + + " 2\n" + + " \n" + + "\n"; + //@formatter:on + final ClassPublicMethodeStructured[] root = Assertions.assertDoesNotThrow(() -> Exml.parse(dataToParse, ClassPublicMethodeStructured.class, "elem")); + Assertions.assertEquals(1, root.length); + + final ClassPublicMethodeStructured elem = root[0]; + Assertions.assertEquals(5, elem.getMemberArrayByte().length); + Assertions.assertEquals((byte) 12, elem.getMemberArrayByte()[0]); + Assertions.assertEquals((byte) 15, elem.getMemberArrayByte()[1]); + Assertions.assertEquals((byte) 123, elem.getMemberArrayByte()[2]); + Assertions.assertEquals((byte) 100, elem.getMemberArrayByte()[3]); + } } diff --git a/test/src/test/atriasoft/exml/introspection/ClassInversion.java b/test/src/test/atriasoft/exml/introspection/ClassInversion.java index 55efa65..908b9bf 100644 --- a/test/src/test/atriasoft/exml/introspection/ClassInversion.java +++ b/test/src/test/atriasoft/exml/introspection/ClassInversion.java @@ -6,3 +6,4 @@ import org.atriasoft.exml.annotation.XmlDefaultManaged; public class ClassInversion { } + diff --git a/test/src/test/atriasoft/exml/introspection/ClassPublicMemberOnly.java b/test/src/test/atriasoft/exml/introspection/ClassPublicMemberOnly.java index 594c12e..e338b9f 100644 --- a/test/src/test/atriasoft/exml/introspection/ClassPublicMemberOnly.java +++ b/test/src/test/atriasoft/exml/introspection/ClassPublicMemberOnly.java @@ -1,7 +1,9 @@ package test.atriasoft.exml.introspection; +import org.atriasoft.exml.annotation.XmlDefaultAttibute; import org.atriasoft.exml.annotation.XmlName; +@XmlDefaultAttibute public class ClassPublicMemberOnly { public boolean[] memberArrayBoolean; public Boolean[] memberArrayBooleanClass; diff --git a/test/src/test/atriasoft/exml/introspection/ClassPublicMethodOnly.java b/test/src/test/atriasoft/exml/introspection/ClassPublicMethodOnly.java index bdfbcb4..8d1ad46 100644 --- a/test/src/test/atriasoft/exml/introspection/ClassPublicMethodOnly.java +++ b/test/src/test/atriasoft/exml/introspection/ClassPublicMethodOnly.java @@ -1,5 +1,8 @@ package test.atriasoft.exml.introspection; +import org.atriasoft.exml.annotation.XmlDefaultAttibute; + +@XmlDefaultAttibute public class ClassPublicMethodOnly { private boolean[] memberArrayBoolean; private Boolean[] memberArrayBooleanClass; diff --git a/test/src/test/atriasoft/exml/introspection/ClassPublicMethodeNode.java b/test/src/test/atriasoft/exml/introspection/ClassPublicMethodeNode.java new file mode 100644 index 0000000..0c36a6b --- /dev/null +++ b/test/src/test/atriasoft/exml/introspection/ClassPublicMethodeNode.java @@ -0,0 +1,198 @@ +package test.atriasoft.exml.introspection; + +import org.atriasoft.exml.annotation.XmlDefaultManaged; + +@XmlDefaultManaged(value = false) +public class ClassPublicMethodeNode { + + private boolean[] memberArrayBoolean; + private Boolean[] memberArrayBooleanClass; + private byte[] memberArrayByte; + private Byte[] memberArrayByteClass; + private int[] memberArrayInteger; + private Integer[] memberArrayIntegerClass; + private long[] memberArrayLong; + private Long[] memberArrayLongClass; + private short[] memberArrayShort; + private Short[] memberArrayShortClass; + private boolean memberBoolean; + private Boolean memberBooleanClass; + private byte memberByte; + private Byte memberByteClass; + private int memberInteger; + private Integer memberIntegerClass; + private long memberLong; + private Long memberLongClass; + private short memberShort; + private Short memberShortClass; + private String memberStringClass; + + public boolean[] getMemberArrayBoolean() { + return this.memberArrayBoolean; + } + + public Boolean[] getMemberArrayBooleanClass() { + return this.memberArrayBooleanClass; + } + + public byte[] getMemberArrayByte() { + return this.memberArrayByte; + } + + public Byte[] getMemberArrayByteClass() { + return this.memberArrayByteClass; + } + + public int[] getMemberArrayInteger() { + return this.memberArrayInteger; + } + + public Integer[] getMemberArrayIntegerClass() { + return this.memberArrayIntegerClass; + } + + public long[] getMemberArrayLong() { + return this.memberArrayLong; + } + + public Long[] getMemberArrayLongClass() { + return this.memberArrayLongClass; + } + + public short[] getMemberArrayShort() { + return this.memberArrayShort; + } + + public Short[] getMemberArrayShortClass() { + return this.memberArrayShortClass; + } + + public byte getMemberByte() { + return this.memberByte; + } + + public Byte getMemberByteClass() { + return this.memberByteClass; + } + + public int getMemberInteger() { + return this.memberInteger; + } + + public Integer getMemberIntegerClass() { + return this.memberIntegerClass; + } + + public long getMemberLong() { + return this.memberLong; + } + + public Long getMemberLongClass() { + return this.memberLongClass; + } + + public short getMemberShort() { + return this.memberShort; + } + + public Short getMemberShortClass() { + return this.memberShortClass; + } + + public String getMemberStringClass() { + return this.memberStringClass; + } + + public boolean isMemberBoolean() { + return this.memberBoolean; + } + + public Boolean isMemberBooleanClass() { + return this.memberBooleanClass; + } + + public void setMemberArrayBoolean(final boolean[] memberArrayBoolean) { + this.memberArrayBoolean = memberArrayBoolean; + } + + public void setMemberArrayBooleanClass(final Boolean[] memberArrayBooleanClass) { + this.memberArrayBooleanClass = memberArrayBooleanClass; + } + + public void setMemberArrayByte(final byte[] memberArrayByte) { + this.memberArrayByte = memberArrayByte; + } + + public void setMemberArrayByteClass(final Byte[] memberArrayByteClass) { + this.memberArrayByteClass = memberArrayByteClass; + } + + public void setMemberArrayInteger(final int[] memberArrayInteger) { + this.memberArrayInteger = memberArrayInteger; + } + + public void setMemberArrayIntegerClass(final Integer[] memberArrayIntegerClass) { + this.memberArrayIntegerClass = memberArrayIntegerClass; + } + + public void setMemberArrayLong(final long[] memberArrayLong) { + this.memberArrayLong = memberArrayLong; + } + + public void setMemberArrayLongClass(final Long[] memberArrayLongClass) { + this.memberArrayLongClass = memberArrayLongClass; + } + + public void setMemberArrayShort(final short[] memberArrayShort) { + this.memberArrayShort = memberArrayShort; + } + + public void setMemberArrayShortClass(final Short[] memberArrayShortClass) { + this.memberArrayShortClass = memberArrayShortClass; + } + + public void setMemberBoolean(final boolean memberBoolean) { + this.memberBoolean = memberBoolean; + } + + public void setMemberBooleanClass(final Boolean memberBooleanClass) { + this.memberBooleanClass = memberBooleanClass; + } + + public void setMemberByte(final byte memberByte) { + this.memberByte = memberByte; + } + + public void setMemberByteClass(final Byte memberByteClass) { + this.memberByteClass = memberByteClass; + } + + public void setMemberInteger(final int memberInteger) { + this.memberInteger = memberInteger; + } + + public void setMemberIntegerClass(final Integer memberIntegerClass) { + this.memberIntegerClass = memberIntegerClass; + } + + public void setMemberLong(final long memberLong) { + this.memberLong = memberLong; + } + + public void setMemberLongClass(final Long memberLongClass) { + this.memberLongClass = memberLongClass; + } + + public void setMemberShort(final short memberShort) { + this.memberShort = memberShort; + } + + public void setMemberShortClass(final Short memberShortClass) { + this.memberShortClass = memberShortClass; + } + + public void setMemberStringClass(final String memberStringClass) { + this.memberStringClass = memberStringClass; + } +} + diff --git a/test/src/test/atriasoft/exml/introspection/ClassPublicMethodeStructured.java b/test/src/test/atriasoft/exml/introspection/ClassPublicMethodeStructured.java new file mode 100644 index 0000000..eb5d985 --- /dev/null +++ b/test/src/test/atriasoft/exml/introspection/ClassPublicMethodeStructured.java @@ -0,0 +1,29 @@ +package test.atriasoft.exml.introspection; + +import java.util.List; + +import org.atriasoft.exml.annotation.XmlDefaultManaged; +import org.atriasoft.exml.annotation.XmlModel; + +@XmlDefaultManaged(value = false) +public class ClassPublicMethodeStructured { + @XmlModel(group="memberArrayByte", element="value") + private byte[] memberArrayByte; + @XmlModel(group="listByte", element="elem") + private List memberListByte; + + public byte[] getMemberArrayByte() { + return this.memberArrayByte; + } + public void setMemberArrayByte(final byte[] memberArrayByte) { + this.memberArrayByte = memberArrayByte; + } + public List getMemberListByte() { + return this.memberListByte; + } + public void setMemberListByte(final List memberListByte) { + this.memberListByte = memberListByte; + } + +} +