diff --git a/.classpath b/.classpath
index 57811b1..7c4c1a8 100644
--- a/.classpath
+++ b/.classpath
@@ -1,15 +1,21 @@
-
+
+
+
+
+
+
+
+
-
-
+
@@ -17,10 +23,10 @@
-
+
-
+
-
+
diff --git a/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder (1).launch b/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder (1).launch
new file mode 100644
index 0000000..1ee8204
--- /dev/null
+++ b/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder (1).launch
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.project b/.project
index bfa2f2a..f416091 100644
--- a/.project
+++ b/.project
@@ -12,12 +12,23 @@
- net.sf.eclipsecs.core.CheckstyleBuilder
+ org.eclipse.ui.externaltools.ExternalToolBuilder
+ full,incremental,
+
+
+ LaunchConfigHandle
+ <project>/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder (1).launch
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+ org.eclipse.m2e.core.maven2Nature
org.eclipse.jdt.core.javanature
net.sf.eclipsecs.core.CheckstyleNature
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..38bef87
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,118 @@
+
+ 4.0.0
+ jatria-soft
+ aknot
+ 0.1.0
+
+ 3.1
+ 17
+ 17
+
+ 3.1.1
+
+
+
+
+ gitea
+ https://gitea.atria-soft.org/api/packages/jatria-soft/maven
+
+
+
+
+ gitea
+ https://gitea.atria-soft.org/api/packages/jatria-soft/maven
+
+
+ gitea
+ https://gitea.atria-soft.org/api/packages/jatria-soft/maven
+
+
+
+
+
+ jatria-soft
+ etk
+ 0.1.0
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.9.3
+ test
+
+
+
+
+ src
+ test/src
+ ${project.basedir}/out/maven/
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven.compiler.version}
+
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.0.0-M5
+
+
+ maven-assembly-plugin
+
+
+
+ fully.qualified.MainClass
+
+
+
+ jar-with-dependencies
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.2.0
+
+ private
+ true
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.2.0
+
+ public
+
+
+
+
+
+
diff --git a/src/module-info.java b/src/module-info.java
index 2699fd5..436cfc1 100644
--- a/src/module-info.java
+++ b/src/module-info.java
@@ -12,6 +12,5 @@ open module org.atriasoft.aknot {
exports org.atriasoft.aknot.exception;
requires transitive org.atriasoft.etk;
- requires transitive org.atriasoft.reggol;
requires java.base;
}
diff --git a/src/org/atriasoft/aknot/ReflectTools.java b/src/org/atriasoft/aknot/ReflectTools.java
index 31a8ff6..bc4bed6 100644
--- a/src/org/atriasoft/aknot/ReflectTools.java
+++ b/src/org/atriasoft/aknot/ReflectTools.java
@@ -1,6 +1,8 @@
package org.atriasoft.aknot;
import java.lang.annotation.Annotation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -26,9 +28,10 @@ import org.atriasoft.aknot.annotation.AknotOptional;
import org.atriasoft.aknot.annotation.AknotSignal;
import org.atriasoft.aknot.annotation.AknotText;
import org.atriasoft.aknot.exception.AknotException;
-import org.atriasoft.aknot.internal.Log;
public class ReflectTools {
+ final static Logger LOGGER = LoggerFactory.getLogger(ReflectTools.class);
+
public static String getDescription(final Class> element) throws Exception {
final Annotation[] annotation = element.getDeclaredAnnotationsByType(AknotDescription.class);
if (annotation.length == 0) {
@@ -570,7 +573,7 @@ public class ReflectTools {
final Type[] realType = plopppppp.getActualTypeArguments();
//Log.info("ppplllppp: " + realType.length);
if (realType.length > 0) {
- Log.verbose(" -->> " + realType[0]);
+ LOGGER.trace(" -->> {}", realType[0]);
internalModelClass = Class.forName(realType[0].getTypeName());
}
}
@@ -592,7 +595,7 @@ public class ReflectTools {
if (empppe[0] instanceof final ParameterizedType plopppppp) {
final Type[] realType = plopppppp.getActualTypeArguments();
if (realType.length > 0) {
- Log.verbose(" -->> " + realType[0]);
+ LOGGER.trace(" -->> {}", realType[0]);
internalModelClass = Class.forName(realType[0].getTypeName());
}
}
diff --git a/src/org/atriasoft/aknot/internal/Log.java b/src/org/atriasoft/aknot/internal/Log.java
deleted file mode 100644
index 18b9108..0000000
--- a/src/org/atriasoft/aknot/internal/Log.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2021, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-package org.atriasoft.aknot.internal;
-
-import org.atriasoft.reggol.LogLevel;
-import org.atriasoft.reggol.Logger;
-
-public class Log {
- private static final String LIB_NAME = "aknot";
- private static final boolean FORCE_ALL = false;
- 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);
- private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG);
- private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR);
- private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO);
- private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT);
- private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO);
- private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
- private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
-
- public static void critical(final Exception e, final String data) {
- e.printStackTrace();
- if (PRINT_CRITICAL || FORCE_ALL) {
- Logger.critical(LIB_NAME_DRAW, data + " : " + e.getMessage());
- }
- }
-
- public static void critical(final String data, final Object... objects) {
- if (PRINT_CRITICAL || FORCE_ALL) {
- Logger.critical(LIB_NAME_DRAW, data, objects);
- }
- }
-
- public static void debug(final String data, final Object... objects) {
- if (PRINT_DEBUG || FORCE_ALL) {
- Logger.debug(LIB_NAME_DRAW, data, objects);
- }
- }
-
- public static void error(final String data, final Object... objects) {
- if (PRINT_ERROR || FORCE_ALL) {
- Logger.error(LIB_NAME_DRAW, data, objects);
- }
- }
-
- public static void info(final String data, final Object... objects) {
- if (PRINT_INFO || FORCE_ALL) {
- Logger.info(LIB_NAME_DRAW, data, objects);
- }
- }
-
- public static void print(final String data, final Object... objects) {
- if (PRINT_PRINT || FORCE_ALL) {
- Logger.print(LIB_NAME_DRAW, data, objects);
- }
- }
-
- public static void todo(final String data, final Object... objects) {
- if (PRINT_TODO || FORCE_ALL) {
- Logger.todo(LIB_NAME_DRAW, data, objects);
- }
- }
-
- public static void verbose(final String data, final Object... objects) {
- if (PRINT_VERBOSE || FORCE_ALL) {
- Logger.verbose(LIB_NAME_DRAW, data, objects);
- }
- }
-
- public static void warning(final String data, final Object... objects) {
- if (PRINT_WARNING || FORCE_ALL) {
- Logger.warning(LIB_NAME_DRAW, data, objects);
- }
- }
-
- private Log() {}
-
-}
diff --git a/src/org/atriasoft/aknot/model/IntrospectionModel.java b/src/org/atriasoft/aknot/model/IntrospectionModel.java
index 73e245e..eb47dfd 100644
--- a/src/org/atriasoft/aknot/model/IntrospectionModel.java
+++ b/src/org/atriasoft/aknot/model/IntrospectionModel.java
@@ -4,10 +4,13 @@ import java.util.List;
import java.util.Map;
import org.atriasoft.aknot.exception.AknotException;
-import org.atriasoft.aknot.internal.Log;
import org.atriasoft.aknot.pojo.IntrospectionProperty;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public abstract class IntrospectionModel {
+ final static Logger LOGGER = LoggerFactory.getLogger(IntrospectionModel.class);
public static final String STUPID_TOCKEN = "___aé\"'__-è==**ù!^$:;,;AZEARTYUIOPMLKJHGFDSQW>XCVBN?"; // can not exist ....
protected static final Boolean DEFAULT_ATTRIBUTE = false;
protected static final Boolean DEFAULT_IGNORE_UNBKNOWN = false;
@@ -106,7 +109,7 @@ public abstract class IntrospectionModel {
*/
public Object getValueConverted(final Object value, final Class> classTypeLocal) throws AknotException {
// Note if the type is an Array<>() or a List<>() ==> we parse element by element ... then we need to keep the undertype...
- Log.debug("======>>>>>>> convert : {} ==> {} ", value.getClass().getCanonicalName(), classTypeLocal.getCanonicalName());
+ LOGGER.debug("======>>>>>>> convert : {} ==> {} ", value.getClass().getCanonicalName(), classTypeLocal.getCanonicalName());
if (value.getClass() == Long.class) {
if (classTypeLocal == long.class || classTypeLocal == Long.class) {
return value;
@@ -197,7 +200,7 @@ public abstract class IntrospectionModel {
return (double) 0;
}
}
- Log.error("======>>>>>>> convert : {} ==> {} Can not do it !!!", value.getClass().getCanonicalName(), classTypeLocal.getCanonicalName());
+ LOGGER.error("======>>>>>>> convert : {} ==> {} Can not do it !!!", value.getClass().getCanonicalName(), classTypeLocal.getCanonicalName());
return value;
}
diff --git a/src/org/atriasoft/aknot/pojo/IntrospectionModelComplex.java b/src/org/atriasoft/aknot/pojo/IntrospectionModelComplex.java
index fa3048c..d999383 100644
--- a/src/org/atriasoft/aknot/pojo/IntrospectionModelComplex.java
+++ b/src/org/atriasoft/aknot/pojo/IntrospectionModelComplex.java
@@ -19,13 +19,15 @@ import org.atriasoft.aknot.ReflectClass;
import org.atriasoft.aknot.ReflectTools;
import org.atriasoft.aknot.StringSerializer;
import org.atriasoft.aknot.exception.AknotException;
-import org.atriasoft.aknot.internal.Log;
import org.atriasoft.aknot.model.ConstructorModel;
import org.atriasoft.aknot.model.IntrospectionModel;
import org.atriasoft.etk.Tools;
import org.atriasoft.etk.util.ArraysTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class IntrospectionModelComplex extends IntrospectionModel {
+ final static Logger LOGGER = LoggerFactory.getLogger(IntrospectionModelComplex.class);
private final boolean isRecord;
// 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...
@@ -53,18 +55,18 @@ public class IntrospectionModelComplex extends IntrospectionModel {
}
this.isRecord = Record.class.isAssignableFrom(classType);
if (classType.isPrimitive()) {
- Log.critical("Detect primitive ==> impossible case !!! ");
+ LOGGER.error("[CRITICAL] Detect primitive ==> impossible case !!! ");
}
final Boolean isDefaultManaged = ReflectTools.getIsDefaultManaged(classType, IntrospectionModel.DEFAULT_MANAGED);
// ------------------------------------------------------------------------
// -- Parse constructor
// ------------------------------------------------------------------------
- Log.error("Introspect class: '" + classType.getCanonicalName() + "'");
+ LOGGER.error("Introspect class: '" + classType.getCanonicalName() + "'");
final Constructor>[] constructors = this.classType.getConstructors();
- Log.warning(" Constructors: (" + constructors.length + ")");
+ LOGGER.warn(" Constructors: (" + constructors.length + ")");
Constructor> emptyConstructorTmp = null;
for (final Constructor> elem : constructors) {
- Log.error(" Constructor ??? : {}", elem.toGenericString());
+ LOGGER.error(" Constructor ??? : {}", elem.toGenericString());
// we does not manage private field
if (!Modifier.isPublic(elem.getModifiers())) {
continue;
@@ -76,7 +78,7 @@ public class IntrospectionModelComplex extends IntrospectionModel {
}
if (elem.getParameterCount() == 0) {
emptyConstructorTmp = elem;
- Log.error(" >>> " + elem.toGenericString());
+ LOGGER.error(" >>> " + elem.toGenericString());
} else {
int offsetSubClass = 0;
if (this.isSubClass) {
@@ -84,7 +86,7 @@ public class IntrospectionModelComplex extends IntrospectionModel {
}
if (elem.getParameterCount() == 1 && offsetSubClass == 1) {
emptyConstructorTmp = elem;
- Log.error(" >>> " + elem.toGenericString());
+ LOGGER.error(" >>> " + elem.toGenericString());
} else {
// Retrieve full description in constructor properties...
String[] namesBeans = ReflectTools.getNames(elem, null);
@@ -129,8 +131,8 @@ public class IntrospectionModelComplex extends IntrospectionModel {
continue;
}
if (checkIfOneIsNull(namesBeans, 0)) {
- Log.verbose(" - " + elem.toGenericString());
- Log.verbose(" ==> unmanaged (missing names description: " + Arrays.toString(namesBeans) + ")");
+ LOGGER.trace(" - " + elem.toGenericString());
+ LOGGER.trace(" ==> unmanaged (missing names description: " + Arrays.toString(namesBeans) + ")");
} else {
// check default attributes in the global list ... (do it at the end to be sure the constructor is VALID ...
for (int iii = 0; iii < namesBeans.length; iii++) {
@@ -197,11 +199,11 @@ public class IntrospectionModelComplex extends IntrospectionModel {
}
}
this.constructorEmpty = emptyConstructorTmp;
- Log.error(" ==> constructor = {}", this.constructorEmpty);
+ LOGGER.error(" ==> constructor = {}", this.constructorEmpty);
// Order the constructor from the bigger number of element to the lowest...
Collections.sort(this.constructors, (a, b) -> a.values().length - b.values().length);
for (final ConstructorModel elem : this.constructors) {
- Log.verbose(" * " + elem.constructor().toGenericString());
+ LOGGER.trace(" * " + elem.constructor().toGenericString());
final StringBuilder tmpPrint = new StringBuilder(" ==> (");
if (this.isSubClass) {
tmpPrint.append("null, ");
@@ -213,7 +215,7 @@ public class IntrospectionModelComplex extends IntrospectionModel {
tmpPrint.append(elem.values()[iii]);
}
tmpPrint.append(")");
- Log.verbose(tmpPrint.toString());
+ LOGGER.trace(tmpPrint.toString());
}
final List recordAllPossibleValues = new ArrayList<>();
@@ -231,7 +233,7 @@ public class IntrospectionModelComplex extends IntrospectionModel {
// -- Parse Field
// ------------------------------------------------------------------------
final Field[] fields = this.classType.getFields();
- Log.verbose(" Fields: (" + fields.length + ")");
+ LOGGER.trace(" Fields: (" + fields.length + ")");
for (final Field elem : fields) {
// we does not manage static field
if (Modifier.isStatic(elem.getModifiers())) {
@@ -313,14 +315,14 @@ public class IntrospectionModelComplex extends IntrospectionModel {
prop.setSetter(modifier);
prop.setGetter(modifier);
}
- Log.verbose(" - " + elem.toGenericString());
+ LOGGER.trace(" - " + elem.toGenericString());
}
final List methods = ReflectClass.getFilterGenericFucntion(this.classType, recordAllPossibleValues, true, true, true);
- Log.verbose(" Methods: (" + methods.size() + ")");
+ LOGGER.trace(" Methods: (" + methods.size() + ")");
for (final Method elem : methods) {
- Log.verbose(" - " + elem.toGenericString());
+ LOGGER.trace(" - " + elem.toGenericString());
}
// Separate the methods and filer as:
@@ -549,8 +551,8 @@ public class IntrospectionModelComplex extends IntrospectionModel {
throw new AknotException("No constructor accessible for class: " + this.classType.getCanonicalName());
}
try {
- Log.error("create class : {} with subClass={}", this.classType.getCanonicalName(), this.isSubClass);
- Log.error(" ==> constructor = {}", this.constructorEmpty);
+ LOGGER.error("create class : {} with subClass={}", this.classType.getCanonicalName(), this.isSubClass);
+ LOGGER.error(" ==> constructor = {}", this.constructorEmpty);
if (this.isSubClass) {
final Object tmp2 = null;
tmp = this.constructorEmpty.newInstance(tmp2);
@@ -573,51 +575,51 @@ public class IntrospectionModelComplex extends IntrospectionModel {
}
public void display() {
- Log.print("Class: {} nbProperty:{}", this.classType.getCanonicalName(), this.elements.size());
- Log.print("Managed:");
+ LOGGER.info("Class: {} nbProperty:{}", this.classType.getCanonicalName(), this.elements.size());
+ LOGGER.info("Managed:");
for (final IntrospectionProperty prop : this.elements) {
- Log.print(" * Property/node : {}", prop.getBeanName());
- Log.print(" names: {}", Arrays.toString(prop.getNames()));
- Log.print(" list: {}", prop.getListName());
- //Log.print(" managed: {}", prop.isManaged());
- Log.print(" attribute: {}", prop.isAttribute());
- Log.print(" text: {}", prop.isText());
- Log.print(" case-sensitive: {}", prop.isCaseSensitive());
- Log.print(" optionnal: {}", prop.isOptionnal());
- Log.print(" constructor: {}", prop.isCanBeSetByConstructor());
- Log.print(" get/set: {} / {}", prop.canGetValue(), prop.canSetValue());
- Log.print(" type: {}", prop.getType().getCanonicalName());
+ LOGGER.info(" * Property/node : {}", prop.getBeanName());
+ LOGGER.info(" names: {}", Arrays.toString(prop.getNames()));
+ LOGGER.info(" list: {}", prop.getListName());
+ //LOGGER.info(" managed: {}", prop.isManaged());
+ LOGGER.info(" attribute: {}", prop.isAttribute());
+ LOGGER.info(" text: {}", prop.isText());
+ LOGGER.info(" case-sensitive: {}", prop.isCaseSensitive());
+ LOGGER.info(" optionnal: {}", prop.isOptionnal());
+ LOGGER.info(" constructor: {}", prop.isCanBeSetByConstructor());
+ LOGGER.info(" get/set: {} / {}", prop.canGetValue(), prop.canSetValue());
+ LOGGER.info(" type: {}", prop.getType().getCanonicalName());
if (prop.getSubType() != null) {
- Log.print(" sub-type: {}", prop.getSubType().getCanonicalName());
+ LOGGER.info(" sub-type: {}", prop.getSubType().getCanonicalName());
} else {
- Log.print(" sub-type: null");
+ LOGGER.info(" sub-type: null");
}
}
- Log.info("Un-Managed:");
+ LOGGER.info("Un-Managed:");
for (final IntrospectionProperty prop : this.elementUnManaged) {
- Log.print(" * Property/node : {}", prop.getBeanName());
- Log.print(" names: {}", Arrays.toString(prop.getNames()));
- Log.print(" list: {}", prop.getListName());
- //Log.print(" managed: {}", prop.isManaged());
- Log.print(" attribute: {}", prop.isAttribute());
- Log.print(" text: {}", prop.isText());
- Log.print(" case-sensitive: {}", prop.isCaseSensitive());
- Log.print(" optionnal: {}", prop.isOptionnal());
- Log.print(" constructor: {}", prop.isCanBeSetByConstructor());
- Log.print(" get/set: {} / {}", prop.canGetValue(), prop.canSetValue());
- Log.print(" type: {}", prop.getType().getCanonicalName());
+ LOGGER.info(" * Property/node : {}", prop.getBeanName());
+ LOGGER.info(" names: {}", Arrays.toString(prop.getNames()));
+ LOGGER.info(" list: {}", prop.getListName());
+ //LOGGER.info(" managed: {}", prop.isManaged());
+ LOGGER.info(" attribute: {}", prop.isAttribute());
+ LOGGER.info(" text: {}", prop.isText());
+ LOGGER.info(" case-sensitive: {}", prop.isCaseSensitive());
+ LOGGER.info(" optionnal: {}", prop.isOptionnal());
+ LOGGER.info(" constructor: {}", prop.isCanBeSetByConstructor());
+ LOGGER.info(" get/set: {} / {}", prop.canGetValue(), prop.canSetValue());
+ LOGGER.info(" type: {}", prop.getType().getCanonicalName());
if (prop.getSubType() != null) {
- Log.print(" sub-type: {}", prop.getSubType().getCanonicalName());
+ LOGGER.info(" sub-type: {}", prop.getSubType().getCanonicalName());
} else {
- Log.print(" sub-type: null");
+ LOGGER.info(" sub-type: null");
}
}
}
protected IntrospectionProperty findBeanNodeDescription(final String propertyBeanName, final boolean attributeIndependent) throws AknotException {
- Log.debug("Find node description for element: {}", propertyBeanName);
+ LOGGER.debug("Find node description for element: {}", propertyBeanName);
for (final IntrospectionProperty prop : this.elements) {
- Log.debug(" ==> {} => {}", prop.getBeanName(), prop.isAttribute());
+ LOGGER.debug(" ==> {} => {}", prop.getBeanName(), prop.isAttribute());
if (!attributeIndependent && prop.isAttribute()) {
continue;
}
@@ -755,10 +757,10 @@ public class IntrospectionModelComplex extends IntrospectionModel {
@Override
public String getTreeNameOfSubNode(final String nodeBeanName, final boolean attributeIndependent) throws AknotException {
- Log.debug(" nodeType='" + nodeBeanName + "'");
+ LOGGER.debug(" nodeType='" + nodeBeanName + "'");
final IntrospectionProperty propMethode = findBeanNodeDescription(nodeBeanName, attributeIndependent);
if (propMethode != null && propMethode.canSetValue()) {
- Log.debug(" ==> find '" + propMethode.getNames());
+ LOGGER.debug(" ==> find '" + propMethode.getNames());
return propMethode.getListName();
}
throw new AknotException("can not find the field '" + nodeBeanName + "'");
@@ -766,10 +768,10 @@ public class IntrospectionModelComplex extends IntrospectionModel {
@Override
public Class> getTypeOfProperty(final String nodeName) throws AknotException {
- Log.debug("nodeType='" + nodeName + "'");
+ LOGGER.debug("nodeType='" + nodeName + "'");
final IntrospectionProperty propField = findPropertyDescription(nodeName);
if (propField != null && propField.canSetValue()) {
- Log.debug(" ==> find '" + propField.getNames());
+ LOGGER.debug(" ==> find '" + propField.getNames());
return propField.getType();
}
@@ -785,10 +787,10 @@ public class IntrospectionModelComplex extends IntrospectionModel {
public Class> getTypeOfSubNode(final String nodeBeanNames, final boolean attributeIndependent) throws AknotException {
final String[] elemstNames = nodeBeanNames.split("#");
final String nodeBeanName = elemstNames[0];
- Log.debug("NodeType='" + nodeBeanName + "'");
+ LOGGER.debug("NodeType='" + nodeBeanName + "'");
final IntrospectionProperty propMethode = findBeanNodeDescription(nodeBeanName, attributeIndependent);
if (propMethode != null && propMethode.canSetValue()) {
- Log.debug(" ==> find '" + propMethode.getNames());
+ LOGGER.debug(" ==> find '" + propMethode.getNames());
if (propMethode.hasFactory()) {
return propMethode.getCompatible(elemstNames[1]);
} else {
@@ -802,10 +804,10 @@ public class IntrospectionModelComplex extends IntrospectionModel {
public Class> getTypeOfSubNodeList(final String nodeBeanNames, final boolean attributeIndependent) throws AknotException {
final String[] elemstNames = nodeBeanNames.split("#");
final String nodeBeanName = elemstNames[0];
- Log.debug(" nodeType='" + nodeBeanName + "'");
+ LOGGER.debug(" nodeType='" + nodeBeanName + "'");
final IntrospectionProperty propMethode = findBeanNodeDescription(nodeBeanName, attributeIndependent);
if (propMethode != null && propMethode.canSetValue()) {
- Log.debug(" ==> find '" + propMethode.getNames());
+ LOGGER.debug(" ==> find '" + propMethode.getNames());
if (propMethode.hasFactory()) {
return propMethode.getCompatible(elemstNames[1]);
} else {
@@ -817,10 +819,10 @@ public class IntrospectionModelComplex extends IntrospectionModel {
@Override
public Class> getTypeOfSubProperty(final String nodeName) throws AknotException {
- Log.debug(" nodeType='" + nodeName + "'");
+ LOGGER.debug(" nodeType='" + nodeName + "'");
final IntrospectionProperty propField = findPropertyDescription(nodeName);
if (propField != null && propField.canSetValue()) {
- Log.debug(" ==> find '" + propField.getNames());
+ LOGGER.debug(" ==> find '" + propField.getNames());
return propField.getSubType();
}
throw new AknotException("can not find the field '" + nodeName + "' available: " + getNodeAvaillable());
@@ -839,17 +841,17 @@ public class IntrospectionModelComplex extends IntrospectionModel {
@Override
public Object getValue(final String propertyName, final String propertyValue) throws AknotException {
- Log.debug(" propertyName='" + propertyName + "' propertyValue='" + propertyValue + "' ");
+ LOGGER.debug(" propertyName='" + propertyName + "' propertyValue='" + propertyValue + "' ");
// by default use setter to set the property
final IntrospectionProperty propMethode = findNodeDescription(propertyName);
if (propMethode != null && propMethode.canSetValue()) {
- Log.verbose(" ==> find '" + propMethode.getNames());
+ LOGGER.trace(" ==> find '" + propMethode.getNames());
return propMethode.createValue(propertyValue);
}
// try with direct field
final IntrospectionProperty propField = findPropertyDescription(propertyName);
if (propField != null && propField.canSetValue()) {
- Log.verbose(" ==> find '" + propField.getNames());
+ LOGGER.trace(" ==> find '" + propField.getNames());
return propField.createValue(propertyValue);
}
throw new AknotException("can not find the field '" + propertyName + "'");
@@ -859,8 +861,8 @@ public class IntrospectionModelComplex extends IntrospectionModel {
public Object getValueFromText(final String text) throws AknotException {
// Note if the type is an Array<>() or a List<>() ==> we parse element by element ... then we need to keep the undertype...
Class> classTypeLocal = this.classType;
- Log.debug("======>>>>>>> Get input type : " + this.classType.getCanonicalName());
- //Log.debug("======>>>>>>> Get input component type : " + this.classType.getComponentType().getCanonicalName());
+ LOGGER.debug("======>>>>>>> Get input type : " + this.classType.getCanonicalName());
+ //LOGGER.debug("======>>>>>>> Get input component type : " + this.classType.getComponentType().getCanonicalName());
if (this.classType.isArray()) {
// generic array ...
classTypeLocal = this.classType.getComponentType();
@@ -881,12 +883,12 @@ public class IntrospectionModelComplex extends IntrospectionModel {
*/
//Type tmpp = classType.getGenericSuperclass();
// Class> tmpp = classType.getInterfaces();
- // Log.warning("======>>>>>>> Find List '" + tmpp + "'");
+ // LOGGER.warn("======>>>>>>> Find List '" + tmpp + "'");
// for (int iii = 0; iii < tmpp.length; iii++) {
- // Log.warning(" - " + tmpp[iii]);
+ // LOGGER.warn(" - " + tmpp[iii]);
// }
}
- Log.debug("======>>>>>>> subElement input type : " + classTypeLocal.getCanonicalName());
+ LOGGER.debug("======>>>>>>> subElement input type : " + classTypeLocal.getCanonicalName());
if (this.valueof == null) {
if (StringSerializer.contains(classTypeLocal)) {
@@ -908,9 +910,9 @@ public class IntrospectionModelComplex extends IntrospectionModel {
@Override
public boolean hasTextModel() {
- Log.warning("in {}", this.classType.getCanonicalName());
+ LOGGER.warn("in {}", this.classType.getCanonicalName());
for (final IntrospectionProperty prop : this.elements) {
- Log.warning(" check {}, manage={} cas setValue={} isText={}", prop.getBeanName(), prop.isManaged(), prop.canSetValue(), prop.isText());
+ LOGGER.warn(" check {}, manage={} cas setValue={} isText={}", prop.getBeanName(), prop.isManaged(), prop.canSetValue(), prop.isText());
final Boolean isText = prop.isText();
if (isText != null && isText) {
return true;
@@ -925,12 +927,12 @@ public class IntrospectionModelComplex extends IntrospectionModel {
}
private void setValue(final Object data, final String beanName, final Object value, final boolean attributeIndependent) throws AknotException {
- Log.verbose(" Set value ='" + beanName + "' propertyValue='" + value + "' " + value.getClass().getCanonicalName());
+ LOGGER.trace(" Set value ='" + beanName + "' propertyValue='" + value + "' " + value.getClass().getCanonicalName());
{
// by default use setter to set the property
final IntrospectionProperty propMethode = findBeanNodeDescription(beanName, attributeIndependent);
if (propMethode != null && propMethode.canSetValue()) {
- Log.verbose(" ==> find '" + Arrays.toString(propMethode.getNames()) + " type=" + propMethode.getType() + " sub-type=" + propMethode.getSubType());
+ LOGGER.trace(" ==> 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) {
@@ -941,8 +943,8 @@ public class IntrospectionModelComplex extends IntrospectionModel {
final 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());
+ LOGGER.trace(" datas type: " + autoCast(propMethode.getType().componentType(), tmpp).getClass().getCanonicalName());
+ LOGGER.trace(" methode type: " + propMethode.getType().getCanonicalName());
propMethode.setExistingValue(data, autoCast(propMethode.getType().componentType(), tmpp));
}
} else if (tmpp.size() == 1) {
@@ -981,7 +983,7 @@ public class IntrospectionModelComplex extends IntrospectionModel {
{
final IntrospectionProperty propField = findBeanPropertyDescription(beanName);
if (propField != null && propField.canSetValue()) {
- Log.verbose(" ==> find '" + Arrays.toString(propField.getNames()) + " type=" + propField.getType() + " sub-type=" + propField.getSubType());
+ LOGGER.trace(" ==> 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
@@ -1032,8 +1034,8 @@ public class IntrospectionModelComplex extends IntrospectionModel {
final 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());
+ LOGGER.trace(" datas type: " + autoCast(propField.getType().componentType(), tmpp).getClass().getCanonicalName());
+ LOGGER.trace(" methode type: " + propField.getType().getCanonicalName());
propField.setExistingValue(data, autoCast(propField.getType().componentType(), tmpp));
}
} else if (tmpp.size() == 1) {
diff --git a/src/org/atriasoft/aknot/pojo/IntrospectionProperty.java b/src/org/atriasoft/aknot/pojo/IntrospectionProperty.java
index 9c33d73..9f24edf 100644
--- a/src/org/atriasoft/aknot/pojo/IntrospectionProperty.java
+++ b/src/org/atriasoft/aknot/pojo/IntrospectionProperty.java
@@ -8,12 +8,14 @@ import java.util.Map.Entry;
import org.atriasoft.aknot.StringSerializer;
import org.atriasoft.aknot.exception.AknotException;
-import org.atriasoft.aknot.internal.Log;
import org.atriasoft.aknot.model.InterfaceFactoryAccess;
import org.atriasoft.aknot.model.IntrospectionPropertyGetter;
import org.atriasoft.aknot.model.IntrospectionPropertySetter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public final class IntrospectionProperty {
+ final static Logger LOGGER = LoggerFactory.getLogger(IntrospectionProperty.class);
// if the element is not managed by us (set at null while not define by a function attribute, parameter ...)
private Boolean managed = null;
// Case sensitive in parsing XML or not (set at null while not define by a function attribute, parameter ...)
@@ -118,18 +120,18 @@ public final class IntrospectionProperty {
if (this.caseSensitive) {
for (final String elem : this.names) {
if (elem.contentEquals(name)) {
- Log.verbose(" - '{}' ==> true", elem);
+ LOGGER.trace(" - '{}' ==> true", elem);
return getType();
}
- Log.verbose(" - '{}' == false", elem);
+ LOGGER.trace(" - '{}' == false", elem);
}
} else {
for (final String elem : this.names) {
if (elem.equalsIgnoreCase(name)) {
- Log.verbose(" - '{}' ==> true", elem);
+ LOGGER.trace(" - '{}' ==> true", elem);
return getType();
}
- Log.verbose(" - '{}' == false", elem);
+ LOGGER.trace(" - '{}' == false", elem);
}
}
return null;
@@ -216,25 +218,25 @@ public final class IntrospectionProperty {
* @return true if the element is compatible, false otherwise
*/
public boolean isCompatible(final String name) {
- Log.verbose("Check compatible : '{}' in {}", name, Arrays.toString(this.names));
+ LOGGER.trace("Check compatible : '{}' in {}", name, Arrays.toString(this.names));
final InterfaceFactoryAccess factoryGenerator = getFactory();
if (factoryGenerator != null) {
- Log.verbose(" ===> Detect factory !!!!");
+ LOGGER.trace(" ===> Detect factory !!!!");
if (this.caseSensitive) {
for (final Entry> elem : factoryGenerator.getConversionMap().entrySet()) {
if (elem.getKey().contentEquals(name)) {
- Log.verbose(" + '{}' ==> true", elem.getKey());
+ LOGGER.trace(" + '{}' ==> true", elem.getKey());
return true;
}
- Log.verbose(" + '{}' == false", elem.getKey());
+ LOGGER.trace(" + '{}' == false", elem.getKey());
}
} else {
for (final Entry> elem : factoryGenerator.getConversionMap().entrySet()) {
if (elem.getKey().equalsIgnoreCase(name)) {
- Log.verbose(" + '{}' ==> true", elem.getKey());
+ LOGGER.trace(" + '{}' ==> true", elem.getKey());
return true;
}
- Log.verbose(" + '{}' == false", elem.getKey());
+ LOGGER.trace(" + '{}' == false", elem.getKey());
}
}
return false;
@@ -242,18 +244,18 @@ public final class IntrospectionProperty {
if (this.caseSensitive) {
for (final String elem : this.names) {
if (elem.contentEquals(name)) {
- Log.verbose(" - '{}' ==> true", elem);
+ LOGGER.trace(" - '{}' ==> true", elem);
return true;
}
- Log.verbose(" - '{}' == false", elem);
+ LOGGER.trace(" - '{}' == false", elem);
}
} else {
for (final String elem : this.names) {
if (elem.equalsIgnoreCase(name)) {
- Log.verbose(" - '{}' ==> true", elem);
+ LOGGER.trace(" - '{}' ==> true", elem);
return true;
}
- Log.verbose(" - '{}' == false", elem);
+ LOGGER.trace(" - '{}' == false", elem);
}
}
return false;
diff --git a/test/src/test/atriasoft/aknot/ExmlTestElement.java b/test/src/test/atriasoft/aknot/ExmlTestElement.java
index cdb7d42..ff640b6 100644
--- a/test/src/test/atriasoft/aknot/ExmlTestElement.java
+++ b/test/src/test/atriasoft/aknot/ExmlTestElement.java
@@ -5,15 +5,18 @@
*/
package test.atriasoft.aknot;
-import org.atriasoft.aknot.internal.Log;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ExmlTestElement {
+ final static Logger LOGGER = LoggerFactory.getLogger(ExmlTestElement.class);
+
@BeforeAll
public static void beforeClass() {
- Log.verbose("----------------------------------------------------------------");
+ LOGGER.trace("----------------------------------------------------------------");
}
@Test