diff --git a/.classpath b/.classpath
index 6c4f306..bd326c0 100644
--- a/.classpath
+++ b/.classpath
@@ -1,19 +1,21 @@
-
+
+
-
+
+
-
+
-
+
@@ -21,15 +23,10 @@
-
+
-
+
-
-
-
-
-
-
+
diff --git a/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder (2).launch b/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder (2).launch
new file mode 100644
index 0000000..1ee8204
--- /dev/null
+++ b/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder (2).launch
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.project b/.project
index 42c4cb7..efaf6cf 100644
--- a/.project
+++ b/.project
@@ -17,12 +17,23 @@
- net.sf.eclipsecs.core.CheckstyleBuilder
+ org.eclipse.ui.externaltools.ExternalToolBuilder
+ full,incremental,
+
+
+ LaunchConfigHandle
+ <project>/.externalToolBuilders/net.sf.eclipsecs.core.CheckstyleBuilder (2).launch
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+ org.eclipse.m2e.core.maven2Nature
org.eclipse.jdt.core.javanature
net.sf.eclipsecs.core.CheckstyleNature
org.python.pydev.pythonNature
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..bcc1acb
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,129 @@
+
+ 4.0.0
+ jatria-soft
+ ejson
+ 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
+
+
+ jatria-soft
+ aknot
+ 0.1.0
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.9.3
+ test
+
+
+ org.slf4j
+ slf4j-simple
+ 2.0.7
+ 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/org/atriasoft/ejson/Ejson.java b/src/org/atriasoft/ejson/Ejson.java
index ed4b0b7..a2b32ce 100644
--- a/src/org/atriasoft/ejson/Ejson.java
+++ b/src/org/atriasoft/ejson/Ejson.java
@@ -11,20 +11,22 @@ import org.atriasoft.ejson.builder.BuilderGeneric;
import org.atriasoft.ejson.exception.EjsonBuilderException;
import org.atriasoft.ejson.exception.EjsonParserErrorMulti;
import org.atriasoft.ejson.generator.GeneratorGeneric;
-import org.atriasoft.ejson.internal.Log;
import org.atriasoft.ejson.model.JsonNode;
import org.atriasoft.ejson.parser.ParseJson;
import org.atriasoft.ejson.parser.ParsingProperty;
import org.atriasoft.etk.Uri;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class Ejson {
+ final static Logger LOGGER = LoggerFactory.getLogger(Ejson.class);
/**
* Display the Document on console
*/
public static void display(final JsonNode root) {
final StringBuilder tmpp = new StringBuilder();
GeneratorGeneric.serialize(root, tmpp, 0);
- Log.info("Generated JSON : \n{}", tmpp.toString());
+ LOGGER.info("Generated JSON : \n{}", tmpp.toString());
}
/**
@@ -51,7 +53,7 @@ public class Ejson {
property.setDisplayError(true);
final byte[] elemData = Uri.getAllData(data);
if (elemData == null) {
- Log.error("Can not read the Stream : {}", data);
+ LOGGER.error("Can not read the Stream : {}", data);
return null;
}
final String dataToParse = new String(elemData);
diff --git a/src/org/atriasoft/ejson/JsonMapper.java b/src/org/atriasoft/ejson/JsonMapper.java
index 2a5aa52..53cb8b3 100644
--- a/src/org/atriasoft/ejson/JsonMapper.java
+++ b/src/org/atriasoft/ejson/JsonMapper.java
@@ -13,12 +13,14 @@ import org.atriasoft.ejson.builder.BuilderIntrospection;
import org.atriasoft.ejson.builder.IntrospectionObject;
import org.atriasoft.ejson.exception.EjsonException;
import org.atriasoft.ejson.exception.EjsonNodeDoesNotExist;
-import org.atriasoft.ejson.internal.Log;
import org.atriasoft.ejson.parser.ParseJson;
import org.atriasoft.ejson.parser.ParsingProperty;
import org.atriasoft.etk.Uri;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class JsonMapper {
+ final static Logger LOGGER = LoggerFactory.getLogger(JsonMapper.class);
private static String readFile(final Path path, final Charset encoding) throws IOException {
final byte[] encoded = Files.readAllBytes(path);
@@ -67,7 +69,7 @@ public class JsonMapper {
final IntrospectionObject introspectionObject = (IntrospectionObject) parser.parse(data, property);
introspectionObject.generateTheObject(true);
final Object listRet = introspectionObject.getData();
- Log.error("elements: {} , {}", listRet.getClass(), classType);
+ LOGGER.error("elements: {} , {}", listRet.getClass(), classType);
if (listRet != null && !listRet.getClass().isArray() && listRet.getClass() == classType) {
return (T) listRet;
} else if (listRet != null && listRet.getClass().isArray() && listRet.getClass().componentType() == classType) {
@@ -97,7 +99,7 @@ public class JsonMapper {
final byte[] elemData = Uri.getAllData(uri);
if (elemData == null) {
- Log.error("Can not read the Stream : " + uri);
+ LOGGER.error("Can not read the Stream : " + uri);
return null;
}
final String content = new String(elemData);
diff --git a/src/org/atriasoft/ejson/builder/BuilderIntrospection.java b/src/org/atriasoft/ejson/builder/BuilderIntrospection.java
index 91ff880..5954359 100644
--- a/src/org/atriasoft/ejson/builder/BuilderIntrospection.java
+++ b/src/org/atriasoft/ejson/builder/BuilderIntrospection.java
@@ -13,12 +13,15 @@ import org.atriasoft.aknot.exception.AknotException;
import org.atriasoft.aknot.model.IntrospectionModel;
import org.atriasoft.aknot.model.ModelType;
import org.atriasoft.aknot.pojo.CacheIntrospectionModel;
+import org.atriasoft.aknot.pojo.IntrospectionProperty;
import org.atriasoft.ejson.exception.EjsonBuilderException;
import org.atriasoft.ejson.exception.EjsonException;
import org.atriasoft.ejson.exception.EjsonNodeDoesNotExist;
-import org.atriasoft.ejson.internal.Log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class BuilderIntrospection implements Builder {
+ final static Logger LOGGER = LoggerFactory.getLogger(BuilderIntrospection.class);
// Keep in cach all the object alredy parsed ==> optimize CPU
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).
@@ -33,7 +36,7 @@ public class BuilderIntrospection implements Builder {
@Override
public void endParsing(final Object element) throws EjsonBuilderException, AknotException {
- Log.verbose("End of Element: {}", element);
+ LOGGER.trace("End of Element: {}", element);
if (element == null) {
return;
}
@@ -63,13 +66,13 @@ public class BuilderIntrospection implements Builder {
if (parent == null) {
return null;
}
- Log.verbose("new element on NodeName=" + nodeName);
+ LOGGER.trace("new element on NodeName=" + nodeName);
final IntrospectionObject introspectionObject = (IntrospectionObject) parent;
final IntrospectionModel model = introspectionObject.getModelIntrospection();
Class> typeClass = null;
String listTreeName = null;
if (!introspectionObject.isSubNodeOrPropertyExist(nodeName) && model.isIgnoreUnknown()) {
- Log.debug("Ignore array: '" + nodeName + "', it does not exist.");
+ LOGGER.debug("Ignore array: '" + nodeName + "', it does not exist.");
return null;
}
try {
@@ -86,7 +89,7 @@ public class BuilderIntrospection implements Builder {
// specific case for List ==> need to get the subType in introspection ...
if (typeClass.isArray()) {
final Class> subTypeClass = typeClass.getComponentType();
- Log.verbose("Create array new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
+ LOGGER.trace("Create array new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
IntrospectionModel inferData = null;
inferData = this.cacheModel.findOrCreate(ModelType.LIST, listTreeName, subTypeClass);
// Create the data when object is ended created...
@@ -99,13 +102,13 @@ public class BuilderIntrospection implements Builder {
} catch (final AknotException e) {
throw new EjsonBuilderException("Node does not exist: " + e.getMessage());
}
- Log.verbose("Create List new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
+ LOGGER.trace("Create List new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
IntrospectionModel inferData = null;
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 + "'");
+ LOGGER.trace("Create new class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
final IntrospectionModel inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, null, typeClass);
// Create the data when object is ended created...
return new IntrospectionObject(inferData);
@@ -115,7 +118,7 @@ public class BuilderIntrospection implements Builder {
@Override
public void newArrayFinished(final Object parent, String tmpName, final Object element) throws EjsonException, AknotException {
- Log.error("New element fionished : ==> " + tmpName);
+ LOGGER.error("New element fionished : ==> " + tmpName);
if (parent == null || element == null) {
return;
}
@@ -279,7 +282,7 @@ public class BuilderIntrospection implements Builder {
throw new EjsonBuilderException("Object created inside a non list ... ==> impssible case");
}
final Class> typeClass = model.getClassType();
- Log.verbose("Create new class: '" + typeClass.getCanonicalName() + "'");
+ LOGGER.trace("Create new class: '" + typeClass.getCanonicalName() + "'");
final IntrospectionModel inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, null, typeClass);
// Create the data when object is ended created...
return new IntrospectionObject(inferData);
@@ -289,7 +292,7 @@ public class BuilderIntrospection implements Builder {
@Override
public Object newObject(final Object parent, final String nodeName) throws EjsonException, AknotException {
- Log.verbose("new element on NodeName=" + nodeName);
+ LOGGER.trace("new element on NodeName=" + nodeName);
final IntrospectionObject introspectionObject = (IntrospectionObject) parent;
final IntrospectionModel model = introspectionObject.getModelIntrospection();
Class> typeClass = null;
@@ -298,7 +301,7 @@ public class BuilderIntrospection implements Builder {
throw new EjsonBuilderException("Object is not compatible with an requested array: " + nodeName);
} else {
if (!introspectionObject.isSubNodeOrPropertyExist(nodeName) && model.isIgnoreUnknown()) {
- Log.debug("Ignore node: '" + nodeName + "' Does not exist...");
+ LOGGER.debug("Ignore node: '" + nodeName + "' Does not exist...");
return null;
}
try {
@@ -312,7 +315,7 @@ public class BuilderIntrospection implements Builder {
// specific case for List ==> need to get the subType in introspection ...
if (typeClass.isArray()) {
final Class> subTypeClass = typeClass.getComponentType();
- Log.verbose("Create array new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
+ LOGGER.trace("Create array new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
IntrospectionModel inferData = null;
// when we request a list elements, we need to add the element in a list, then we need the return is LIST and not ARRAY
inferData = this.cacheModel.findOrCreate(ModelType.LIST, listTreeName, subTypeClass);
@@ -327,13 +330,13 @@ public class BuilderIntrospection implements Builder {
} catch (final AknotException e) {
throw new EjsonBuilderException("Node does not exist: " + e.getMessage());
}
- Log.verbose("Create List new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
+ LOGGER.trace("Create List new 'SUB' class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
IntrospectionModel inferData = null;
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 + "'");
+ LOGGER.trace("Create new class: '" + typeClass.getCanonicalName() + "' for node '" + nodeName + "'");
final IntrospectionModel inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, listTreeName, typeClass);
// Create the data when object is ended created...
return new IntrospectionObject(inferData);
@@ -361,7 +364,7 @@ public class BuilderIntrospection implements Builder {
final String beanName = model.getTextBeanName();
if (beanName == null) {
if (model.isIgnoreUnknown()) {
- Log.debug("Ignore node : **TEXT**");
+ LOGGER.debug("Ignore node : **TEXT**");
return;
}
throw new EjsonBuilderException("The node **TEXT** Does not exist...");
@@ -373,7 +376,7 @@ public class BuilderIntrospection implements Builder {
final Object out = StringSerializer.valueOf(typeClass, value);
introspectionObject.putProperty(beanName, out);
} else if (typeClass.isArray()) {
- Log.error("Not managed !!! ");
+ LOGGER.error("Not managed !!! ");
/*
final String[] elems = propertyValue.split(";");
final Class> subTypeClass = typeClass.getComponentType();
@@ -386,11 +389,11 @@ public class BuilderIntrospection implements Builder {
introspectionObject.putProperty(propertyName, out);
*/
} else if (List.class.isAssignableFrom(typeClass)) {
- Log.error("Not managed !!! ");
+ LOGGER.error("Not managed !!! ");
/*
final String[] elems = propertyValue.split(";");
final Class> subTypeClass = introspectionObject.getTypeOfSubProperty(propertyName);
- Log.verbose("Create List new 'SUB' class: '" + typeClass.getCanonicalName() + "' for property '" + propertyName + "'");
+ LOGGER.trace("Create List new 'SUB' class: '" + typeClass.getCanonicalName() + "' for property '" + propertyName + "'");
final IntrospectionModel inferData = this.cacheModel.findOrCreate(ModelType.NORMAL, null, subTypeClass);
final List