[FEAT] use Maven a build system root tool
This commit is contained in:
parent
05f6d03922
commit
a27ff134f6
21
.classpath
21
.classpath
@ -1,13 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src">
|
<classpathentry including="**/*.java" kind="src" output="out/maven/classes" path="src">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
|
||||||
@ -20,5 +21,17 @@
|
|||||||
<attribute name="module" value="true"/>
|
<attribute name="module" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="out/eclipse/classes"/>
|
<classpathentry kind="src" output="out/maven/test-classes" path="test/src">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="out/maven/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
6
.project
6
.project
@ -16,8 +16,14 @@
|
|||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
|
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
|
119
pom.xml
Normal file
119
pom.xml
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.atriasoft</groupId>
|
||||||
|
<artifactId>death</artifactId>
|
||||||
|
<version>0.1.0</version>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.version>3.1</maven.compiler.version>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
||||||
|
<maven.dependency.version>3.1.1</maven.dependency.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>gitea</id>
|
||||||
|
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>gitea</id>
|
||||||
|
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||||
|
</repository>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>gitea</id>
|
||||||
|
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>5.9.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-simple</artifactId>
|
||||||
|
<version>2.0.7</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src</sourceDirectory>
|
||||||
|
<testSourceDirectory>test/src</testSourceDirectory>
|
||||||
|
<directory>${project.basedir}/out/maven/</directory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${maven.compiler.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
<!--<encoding>${project.build.sourceEncoding}</encoding>-->
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- Create the source bundle -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- junit results -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.0.0-M5</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>fully.qualified.MainClass</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- Java-doc generation for stand-alone site -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<configuration>
|
||||||
|
<show>private</show>
|
||||||
|
<nohelp>true</nohelp>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<!-- Generate Java-docs As Part Of Project Reports -->
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<configuration>
|
||||||
|
<show>public</show>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
|
||||||
|
</project>
|
@ -12,7 +12,7 @@ public class ActionList {
|
|||||||
public void add(final Class<?> clazz) {
|
public void add(final Class<?> clazz) {
|
||||||
final String name = PropertiesInterface.getCommand(clazz);
|
final String name = PropertiesInterface.getCommand(clazz);
|
||||||
if (name == null || name.isEmpty()) {
|
if (name == null || name.isEmpty()) {
|
||||||
Log.error("Can not add an action without name. for: {}", clazz.getCanonicalName());
|
LOGGER.error("Can not add an action without name. for: {}", clazz.getCanonicalName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.subActions.put(name, clazz);
|
this.subActions.put(name, clazz);
|
||||||
|
@ -46,78 +46,78 @@ public class ArgumentManager {
|
|||||||
if (value.startsWith("--")) {
|
if (value.startsWith("--")) {
|
||||||
final String[] elements = value.split("=");
|
final String[] elements = value.split("=");
|
||||||
elements[0] = elements[0].substring(2);
|
elements[0] = elements[0].substring(2);
|
||||||
Log.verbose("find element (--) : {}", Arrays.toString(elements));
|
LOGGER.trace("find element (--) : {}", Arrays.toString(elements));
|
||||||
final String parameter = elements[0];
|
final String parameter = elements[0];
|
||||||
String newValue = null;
|
String newValue = null;
|
||||||
if (!this.properties.existParameter(parameter)) {
|
if (!this.properties.existParameter(parameter)) {
|
||||||
Log.error("Parameter Does not exist for '{}'", value);
|
LOGGER.error("Parameter Does not exist for '{}'", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
if (!this.properties.haveParameter(parameter)) {
|
if (!this.properties.haveParameter(parameter)) {
|
||||||
// Boolean value
|
// Boolean value
|
||||||
if (elements.length != 1) {
|
if (elements.length != 1) {
|
||||||
Log.error("Boolean parameter can not have parameters for '{}", value);
|
LOGGER.error("Boolean parameter can not have parameters for '{}", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
} else if (elements.length == 1) {
|
} else if (elements.length == 1) {
|
||||||
if (iii == this.arguments.size() - 1) {
|
if (iii == this.arguments.size() - 1) {
|
||||||
Log.error("Missing parameters for '{}' (no more arguments)", value);
|
LOGGER.error("Missing parameters for '{}' (no more arguments)", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
newValue = this.arguments.get(iii + 1);
|
newValue = this.arguments.get(iii + 1);
|
||||||
if (newValue.startsWith("-")) {
|
if (newValue.startsWith("-")) {
|
||||||
Log.error("Missing parameters for '{}' (next argument is a parameter (start with '-'))", value);
|
LOGGER.error("Missing parameters for '{}' (next argument is a parameter (start with '-'))", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
iii++;
|
iii++;
|
||||||
} else if (elements.length == 2) {
|
} else if (elements.length == 2) {
|
||||||
newValue = elements[1];
|
newValue = elements[1];
|
||||||
} else {
|
} else {
|
||||||
Log.error("too much parameters for '{}' (only 1 = is authorized)", value);
|
LOGGER.error("too much parameters for '{}' (only 1 = is authorized)", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
this.properties.setParameter(tmp, parameter, newValue);
|
this.properties.setParameter(tmp, parameter, newValue);
|
||||||
} else if (value.startsWith("-")) {
|
} else if (value.startsWith("-")) {
|
||||||
final String[] elements = value.split("=");
|
final String[] elements = value.split("=");
|
||||||
elements[0] = elements[0].substring(1);
|
elements[0] = elements[0].substring(1);
|
||||||
Log.verbose("find element (-) : {}", Arrays.toString(elements));
|
LOGGER.trace("find element (-) : {}", Arrays.toString(elements));
|
||||||
if (elements[0].length() != 1) {
|
if (elements[0].length() != 1) {
|
||||||
Log.error("Can not parse alias argument with a size != 1 for '{}'", value);
|
LOGGER.error("Can not parse alias argument with a size != 1 for '{}'", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
final char parameter = elements[0].charAt(0);
|
final char parameter = elements[0].charAt(0);
|
||||||
String newValue = null;
|
String newValue = null;
|
||||||
if (!this.properties.existParameterAlias(parameter)) {
|
if (!this.properties.existParameterAlias(parameter)) {
|
||||||
Log.error("Parameter Does not exist for '{}'", value);
|
LOGGER.error("Parameter Does not exist for '{}'", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
if (!this.properties.haveParameterAlias(parameter)) {
|
if (!this.properties.haveParameterAlias(parameter)) {
|
||||||
// Boolean value
|
// Boolean value
|
||||||
if (elements.length != 1) {
|
if (elements.length != 1) {
|
||||||
Log.critical("Boolean parameter can not have parameters for '{}'", value);
|
LOGGER.critical("Boolean parameter can not have parameters for '{}'", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (elements.length == 1) {
|
} else if (elements.length == 1) {
|
||||||
if (iii == this.arguments.size() - 1) {
|
if (iii == this.arguments.size() - 1) {
|
||||||
Log.error("Missing parameters for '{}' (no more arguments)", value);
|
LOGGER.error("Missing parameters for '{}' (no more arguments)", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
newValue = this.arguments.get(iii + 1);
|
newValue = this.arguments.get(iii + 1);
|
||||||
if (newValue.startsWith("-")) {
|
if (newValue.startsWith("-")) {
|
||||||
Log.error("Missing parameters for '{}' (next argument is a parameter (start with '-'))", value);
|
LOGGER.error("Missing parameters for '{}' (next argument is a parameter (start with '-'))", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
iii++;
|
iii++;
|
||||||
} else if (elements.length == 2) {
|
} else if (elements.length == 2) {
|
||||||
newValue = elements[1];
|
newValue = elements[1];
|
||||||
} else {
|
} else {
|
||||||
Log.error("too much parameters for '{}' (only 1 = is authorized)", value);
|
LOGGER.error("too much parameters for '{}' (only 1 = is authorized)", value);
|
||||||
showHelpAndExitError();
|
showHelpAndExitError();
|
||||||
}
|
}
|
||||||
this.properties.setParameterAlias(tmp, parameter, newValue);
|
this.properties.setParameterAlias(tmp, parameter, newValue);
|
||||||
} else {
|
} else {
|
||||||
Log.verbose("find element ( ) : {}", value);
|
LOGGER.trace("find element ( ) : {}", value);
|
||||||
if (this.properties.actions != null && this.properties.actions.exist(value)) {
|
if (this.properties.actions != null && this.properties.actions.exist(value)) {
|
||||||
// Find end of parsing ...
|
// Find end of parsing ...
|
||||||
endParsing = true;
|
endParsing = true;
|
||||||
@ -153,10 +153,10 @@ public class ArgumentManager {
|
|||||||
final List<Method> executor = localManager.properties.getExecutor();
|
final List<Method> executor = localManager.properties.getExecutor();
|
||||||
for (final Method exec : executor) {
|
for (final Method exec : executor) {
|
||||||
if (nbParameters != exec.getParameterCount()) {
|
if (nbParameters != exec.getParameterCount()) {
|
||||||
Log.error("Rejected executor, {} nbParameter={} injected={}", exec.getName(), exec.getParameterCount(), nbParameters);
|
LOGGER.error("Rejected executor, {} nbParameter={} injected={}", exec.getName(), exec.getParameterCount(), nbParameters);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Log.verbose("find executor, {}", exec.getName());
|
LOGGER.trace("find executor, {}", exec.getName());
|
||||||
try {
|
try {
|
||||||
switch (nbParameters) {
|
switch (nbParameters) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -258,7 +258,7 @@ public class ArgumentManager {
|
|||||||
localManager.argumentPostConfigure.get(10));
|
localManager.argumentPostConfigure.get(10));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.error("Does not manage more than 11 arguments");
|
LOGGER.error("Does not manage more than 11 arguments");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||||
|
@ -75,7 +75,7 @@ public class FieldProperty {
|
|||||||
list += elem;
|
list += elem;
|
||||||
}
|
}
|
||||||
list += "]";
|
list += "]";
|
||||||
Log.critical("Can not find property '{}'in the choice values : {}", newValue, list);
|
LOGGER.critical("Can not find property '{}'in the choice values : {}", newValue, list);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,19 +98,19 @@ public class FieldProperty {
|
|||||||
|
|
||||||
public void print() {
|
public void print() {
|
||||||
if (this.name != null) {
|
if (this.name != null) {
|
||||||
Log.print("Detect element: --{}", this.name);
|
LOGGER.print("Detect element: --{}", this.name);
|
||||||
}
|
}
|
||||||
if (this.alias != null) {
|
if (this.alias != null) {
|
||||||
Log.print(" alias: -{}", this.alias);
|
LOGGER.print(" alias: -{}", this.alias);
|
||||||
}
|
}
|
||||||
if (this.types[1] == null) {
|
if (this.types[1] == null) {
|
||||||
Log.print(" type: {}", this.types[0].getCanonicalName());
|
LOGGER.print(" type: {}", this.types[0].getCanonicalName());
|
||||||
} else {
|
} else {
|
||||||
Log.print(" type: {} / {}", this.types[0].getCanonicalName(), this.types[1].getCanonicalName());
|
LOGGER.print(" type: {} / {}", this.types[0].getCanonicalName(), this.types[1].getCanonicalName());
|
||||||
}
|
}
|
||||||
Log.print(" description: {}", this.description);
|
LOGGER.print(" description: {}", this.description);
|
||||||
if (this.choice != null) {
|
if (this.choice != null) {
|
||||||
Log.print(" choice: {}", Arrays.toString(this.choice));
|
LOGGER.print(" choice: {}", Arrays.toString(this.choice));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class PropertiesInterface {
|
|||||||
// -- Find property Field
|
// -- Find property Field
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
final Field[] fields = clazz.getFields();
|
final Field[] fields = clazz.getFields();
|
||||||
Log.verbose(" Fields: ({})", fields.length);
|
LOGGER.trace(" Fields: ({})", fields.length);
|
||||||
for (final Field elem : fields) {
|
for (final Field elem : fields) {
|
||||||
// we does not manage static field
|
// we does not manage static field
|
||||||
if (Modifier.isStatic(elem.getModifiers())) {
|
if (Modifier.isStatic(elem.getModifiers())) {
|
||||||
@ -63,13 +63,13 @@ public class PropertiesInterface {
|
|||||||
if (type[0] == ActionList.class) {
|
if (type[0] == ActionList.class) {
|
||||||
final Object data = elem.get(null);
|
final Object data = elem.get(null);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
Log.error("set a @ArgSubActions on a wrong field");
|
LOGGER.error("set a @ArgSubActions on a wrong field");
|
||||||
} else if (data instanceof final ActionList tmp) {
|
} else if (data instanceof final ActionList tmp) {
|
||||||
this.actions = tmp;
|
this.actions = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
Log.error("get error on @ArgSubActions !!!");
|
LOGGER.error("get error on @ArgSubActions !!!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -88,7 +88,7 @@ public class PropertiesInterface {
|
|||||||
|| element.types[0] == double.class || element.types[0] == Double.class || element.types[0] == String.class) {
|
|| element.types[0] == double.class || element.types[0] == Double.class || element.types[0] == String.class) {
|
||||||
// all is good
|
// all is good
|
||||||
} else {
|
} else {
|
||||||
Log.error("Can not manage other type than: [boolean,Boolean,String,int,Integer,long,Long,short,Short,float,Float,double,Double]");
|
LOGGER.error("Can not manage other type than: [boolean,Boolean,String,int,Integer,long,Long,short,Short,float,Float,double,Double]");
|
||||||
}
|
}
|
||||||
this.properties.add(element);
|
this.properties.add(element);
|
||||||
//element.print();
|
//element.print();
|
||||||
@ -98,7 +98,7 @@ public class PropertiesInterface {
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
final Method[] methods = clazz.getMethods();
|
final Method[] methods = clazz.getMethods();
|
||||||
for (final Method elem : methods) {
|
for (final Method elem : methods) {
|
||||||
Log.verbose("Detect function : {}", elem.getName());
|
LOGGER.trace("Detect function : {}", elem.getName());
|
||||||
// we does not manage static field
|
// we does not manage static field
|
||||||
if (Modifier.isStatic(elem.getModifiers())) {
|
if (Modifier.isStatic(elem.getModifiers())) {
|
||||||
continue;
|
continue;
|
||||||
@ -130,12 +130,12 @@ public class PropertiesInterface {
|
|||||||
|
|
||||||
public void displayHelp(final boolean withActions, int baseIndent) {
|
public void displayHelp(final boolean withActions, int baseIndent) {
|
||||||
if (baseIndent == 0) {
|
if (baseIndent == 0) {
|
||||||
Log.print("Usage:");
|
LOGGER.print("Usage:");
|
||||||
}
|
}
|
||||||
final StringBuilder applicationLine = new StringBuilder(spaces(4 + baseIndent));
|
final StringBuilder applicationLine = new StringBuilder(spaces(4 + baseIndent));
|
||||||
if (baseIndent != 0) {
|
if (baseIndent != 0) {
|
||||||
baseIndent += 4;
|
baseIndent += 4;
|
||||||
Log.print("{}-----------------------------", spaces(baseIndent));
|
LOGGER.print("{}-----------------------------", spaces(baseIndent));
|
||||||
}
|
}
|
||||||
if (this.classCommand != null) {
|
if (this.classCommand != null) {
|
||||||
applicationLine.append(this.classCommand).append(" ");
|
applicationLine.append(this.classCommand).append(" ");
|
||||||
@ -148,37 +148,37 @@ public class PropertiesInterface {
|
|||||||
if (this.actions != null && this.actions.getActions().size() != 0) {
|
if (this.actions != null && this.actions.getActions().size() != 0) {
|
||||||
applicationLine.append("<actions> [options-action]");
|
applicationLine.append("<actions> [options-action]");
|
||||||
}
|
}
|
||||||
Log.print(applicationLine.toString());
|
LOGGER.print(applicationLine.toString());
|
||||||
if (this.classDescription != null) {
|
if (this.classDescription != null) {
|
||||||
Log.print("{}{}", spaces(baseIndent), this.classDescription);
|
LOGGER.print("{}{}", spaces(baseIndent), this.classDescription);
|
||||||
}
|
}
|
||||||
if (this.properties.size() != 0) {
|
if (this.properties.size() != 0) {
|
||||||
Log.print("{} [options]", spaces(baseIndent));
|
LOGGER.print("{} [options]", spaces(baseIndent));
|
||||||
for (final FieldProperty prop : this.properties) {
|
for (final FieldProperty prop : this.properties) {
|
||||||
final String parameterExpect = haveParameter(prop) ? " [PARAMETER]" : "";
|
final String parameterExpect = haveParameter(prop) ? " [PARAMETER]" : "";
|
||||||
if (prop.alias != null && prop.name != null) {
|
if (prop.alias != null && prop.name != null) {
|
||||||
Log.print("{} -{} / --{}{}", spaces(baseIndent), prop.alias, prop.name, parameterExpect);
|
LOGGER.print("{} -{} / --{}{}", spaces(baseIndent), prop.alias, prop.name, parameterExpect);
|
||||||
} else if (prop.alias != null) {
|
} else if (prop.alias != null) {
|
||||||
Log.print("{} -{}{}", spaces(baseIndent), prop.alias, parameterExpect);
|
LOGGER.print("{} -{}{}", spaces(baseIndent), prop.alias, parameterExpect);
|
||||||
} else if (prop.name != null) {
|
} else if (prop.name != null) {
|
||||||
Log.print("{} --{}{}", spaces(baseIndent), prop.name, parameterExpect);
|
LOGGER.print("{} --{}{}", spaces(baseIndent), prop.name, parameterExpect);
|
||||||
}
|
}
|
||||||
if (prop.description != null) {
|
if (prop.description != null) {
|
||||||
Log.print("{} {}", spaces(baseIndent), prop.description);
|
LOGGER.print("{} {}", spaces(baseIndent), prop.description);
|
||||||
}
|
}
|
||||||
if (prop.choice != null) {
|
if (prop.choice != null) {
|
||||||
for (final ChoiceElement elem : prop.getChoiceList()) {
|
for (final ChoiceElement elem : prop.getChoiceList()) {
|
||||||
if (elem.destination() == null) {
|
if (elem.destination() == null) {
|
||||||
Log.print("{} - {}", spaces(baseIndent), elem.origin());
|
LOGGER.print("{} - {}", spaces(baseIndent), elem.origin());
|
||||||
} else {
|
} else {
|
||||||
Log.print("{} - {} ==> {}", spaces(baseIndent), elem.origin(), elem.destination());
|
LOGGER.print("{} - {} ==> {}", spaces(baseIndent), elem.origin(), elem.destination());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.actions != null && this.actions.getActions().size() != 0) {
|
if (this.actions != null && this.actions.getActions().size() != 0) {
|
||||||
Log.print("{} <actions>", spaces(baseIndent));
|
LOGGER.print("{} <actions>", spaces(baseIndent));
|
||||||
final Set<String> actions = this.actions.getActions();
|
final Set<String> actions = this.actions.getActions();
|
||||||
|
|
||||||
int sizeOfActions = 0;
|
int sizeOfActions = 0;
|
||||||
@ -190,10 +190,10 @@ public class PropertiesInterface {
|
|||||||
if (!withActions) {
|
if (!withActions) {
|
||||||
final String description = PropertiesInterface.getDescription(clazz);
|
final String description = PropertiesInterface.getDescription(clazz);
|
||||||
if (description == null || description.isEmpty()) {
|
if (description == null || description.isEmpty()) {
|
||||||
Log.print("{} {}", spaces(baseIndent), action);
|
LOGGER.print("{} {}", spaces(baseIndent), action);
|
||||||
} else {
|
} else {
|
||||||
final String emptyString = spaces(sizeOfActions - action.length());
|
final String emptyString = spaces(sizeOfActions - action.length());
|
||||||
Log.print("{} {}:{} {}", spaces(baseIndent), action, emptyString, description);
|
LOGGER.print("{} {}:{} {}", spaces(baseIndent), action, emptyString, description);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final PropertiesInterface tmpInterface = new PropertiesInterface(clazz);
|
final PropertiesInterface tmpInterface = new PropertiesInterface(clazz);
|
||||||
@ -201,8 +201,8 @@ public class PropertiesInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!withActions) {
|
if (!withActions) {
|
||||||
Log.print(" [options-action]");
|
LOGGER.print(" [options-action]");
|
||||||
Log.print(" Action have theire specifi help. (add -h or --help after action)");
|
LOGGER.print(" Action have theire specifi help. (add -h or --help after action)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,11 +292,11 @@ public class PropertiesInterface {
|
|||||||
property.field.set(tmp, newValue);
|
property.field.set(tmp, newValue);
|
||||||
} else {
|
} else {
|
||||||
// Impossible case !!!
|
// Impossible case !!!
|
||||||
Log.critical("Dead code");
|
LOGGER.critical("Dead code");
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
Log.critical("Can not SET the value : {}: {}", parameter, newValue);
|
LOGGER.critical("Can not SET the value : {}: {}", parameter, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -137,9 +137,9 @@ public class ReflectTools {
|
|||||||
if (empppe.length > paramId) {
|
if (empppe.length > paramId) {
|
||||||
if (empppe[paramId] instanceof final ParameterizedType plopppppp) {
|
if (empppe[paramId] instanceof final ParameterizedType plopppppp) {
|
||||||
final Type[] realType = plopppppp.getActualTypeArguments();
|
final Type[] realType = plopppppp.getActualTypeArguments();
|
||||||
//Log.info("ppplllppp: {}", realType.length);
|
//LOGGER.info("ppplllppp: {}", realType.length);
|
||||||
if (realType.length > 0) {
|
if (realType.length > 0) {
|
||||||
Log.warning(" -->> {}", realType[0]);
|
LOGGER.warn(" -->> {}", realType[0]);
|
||||||
internalModelClass = Class.forName(realType[0].getTypeName());
|
internalModelClass = Class.forName(realType[0].getTypeName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class ReflectTools {
|
|||||||
if (empppe[0] instanceof final ParameterizedType plopppppp) {
|
if (empppe[0] instanceof final ParameterizedType plopppppp) {
|
||||||
final Type[] realType = plopppppp.getActualTypeArguments();
|
final Type[] realType = plopppppp.getActualTypeArguments();
|
||||||
if (realType.length > 0) {
|
if (realType.length > 0) {
|
||||||
Log.warning(" -->> {}", realType[0]);
|
LOGGER.warn(" -->> {}", realType[0]);
|
||||||
internalModelClass = Class.forName(realType[0].getTypeName());
|
internalModelClass = Class.forName(realType[0].getTypeName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user