Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 44 additions & 39 deletions examples/plugins/csv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>com.helger.jcodemodel.examples.plugin</groupId>
<artifactId>csv</artifactId>
<name>JCodeModel CSV Plugin Example</name>
<name>JCodeModel Example Generator CSV</name>
<description>demonstrates and validates the usage of the jcodemodel plugin alongside the CSV generator</description>

<build>
Expand Down Expand Up @@ -61,13 +61,14 @@
<goal>generate-source</goal>
</goals>
<configuration>
<rootPackage>com.helger.jcodemodel.examples.plugin.csv.resolve</rootPackage>
<data>
p com.helger.jcodemodel.examples.plugin.csv.resolve,,,get
com.helger.jcodemodel.examples.plugin.csv.resolve.Parent,children,Child[],set,private
com.helger.jcodemodel.examples.plugin.csv.resolve.Child,parent,Parent,private,set
com.helger.jcodemodel.examples.plugin.csv.resolve.Imported,,,set
com.helger.jcodemodel.examples.plugin.csv.resolve.Imported,model,com.helger.jcodemodel.JCodeModel,private
com.helger.jcodemodel.examples.plugin.csv.resolve.Imported,modelArr,com.helger.jcodemodel.JCodeModel[],private
p .,,,get
Parent,children,Child[],set,private
Child,parent,Parent,private,set
Imported,,,set
Imported,model,com.helger.jcodemodel.JCodeModel,private
Imported,modelArr,com.helger.jcodemodel.JCodeModel[],private
</data>
</configuration>
</execution>
Expand All @@ -78,10 +79,11 @@
<goal>generate-source</goal>
</goals>
<configuration>
<rootPackage>com.helger.jcodemodel.examples.plugin.csv.lastupdated</rootPackage>
<data>
com.helger.jcodemodel.examples.plugin.csv.lastupdated.LastUpdated,,,set,get,private,lastupdated
com.helger.jcodemodel.examples.plugin.csv.lastupdated.LastUpdated,i,int
com.helger.jcodemodel.examples.plugin.csv.lastupdated.LastUpdated,s,string
LastUpdated,,,set,get,private,lastupdated
LastUpdated,i,int
LastUpdated,s,string
</data>
</configuration>
</execution>
Expand All @@ -91,16 +93,17 @@
<goal>generate-source</goal>
</goals>
<configuration>
<rootPackage>com.helger.jcodemodel.examples.plugin.csv.redirect</rootPackage>
<data>
com.helger.jcodemodel.examples.plugin.csv.redirect.ABC,,,private,get,set
com.helger.jcodemodel.examples.plugin.csv.redirect.ABC,a,int
com.helger.jcodemodel.examples.plugin.csv.redirect.ABC,b,bool
com.helger.jcodemodel.examples.plugin.csv.redirect.ABC,c,char
com.helger.jcodemodel.examples.plugin.csv.redirect.Redirected,,,private,redirect
com.helger.jcodemodel.examples.plugin.csv.redirect.Redirected,abc,ABC,set
com.helger.jcodemodel.examples.plugin.csv.redirect.Redirected,jCatchBlock,com.helger.jcodemodel.JCatchBlock,set
ABC,,,private,get,set
ABC,a,int
ABC,b,bool
ABC,c,char
Redirected,,,private,redirect
Redirected,abc,ABC,set
Redirected,jCatchBlock,com.helger.jcodemodel.JCatchBlock,set

com.helger.jcodemodel.examples.plugin.csv.redirect.ClassRedirect,e,java.lang.ArrayIndexOutOfBoundsException,set,redirect
ClassRedirect,e,java.lang.ArrayIndexOutOfBoundsException,set,redirect
</data>
</configuration>
</execution>
Expand All @@ -110,39 +113,41 @@
<goal>generate-source</goal>
</goals>
<configuration>
<rootPackage>com.helger.jcodemodel.examples.plugin.csv</rootPackage>
<data>
p com.helger.jcodemodel.examples.plugin.csv.inherit,,,set,get,private
com.helger.jcodemodel.examples.plugin.csv.inherit.Point,x,int
com.helger.jcodemodel.examples.plugin.csv.inherit.Point,y,int
com.helger.jcodemodel.examples.plugin.csv.inherit.City,,Point
com.helger.jcodemodel.examples.plugin.csv.inherit.City,name,string
com.helger.jcodemodel.examples.plugin.csv.inherit.City,zip,int
p inherit,,,set,get,private
inherit.Point,x,int
inherit.Point,y,int
inherit.City,,Point
inherit.City,name,string
inherit.City,zip,int

com.helger.jcodemodel.examples.plugin.csv.inherit.Dated,,java.io.Serializable,lastupdated
com.helger.jcodemodel.examples.plugin.csv.inherit.Dated,created,date, final, getter
inherit.Dated,,java.io.Serializable,lastupdated
inherit.Dated,created,date, final, getter
</data>
</configuration>
</execution>
<execution>
<id>final</id>
<id>immutable</id>
<goals>
<goal>generate-source</goal>
</goals>
<configuration>
<rootPackage>com.helger.jcodemodel.examples.plugin.csv.immutable</rootPackage>
<data>
p com.helger.jcodemodel.examples.plugin.csv.immutable,,,set,get,private,final
com.helger.jcodemodel.examples.plugin.csv.immutable.Animal,dob,date
com.helger.jcodemodel.examples.plugin.csv.immutable.Animal,id,long
com.helger.jcodemodel.examples.plugin.csv.immutable.Animal,name,string,mutable
com.helger.jcodemodel.examples.plugin.csv.immutable.Animal,parents,Animal[]
com.helger.jcodemodel.examples.plugin.csv.immutable.Animal,children,Animal, list
com.helger.jcodemodel.examples.plugin.csv.immutable.Dog,,Animal
com.helger.jcodemodel.examples.plugin.csv.immutable.Dog,species,string
com.helger.jcodemodel.examples.plugin.csv.immutable.Dog,master,string,mutable
p .,,,set,get,private,final
Animal,dob,date
Animal,id,long
Animal,name,string,mutable
Animal,parents,Animal[]
Animal,children,Animal list
Dog,,Animal
Dog,species,string
Dog,master,string,mutable

com.helger.jcodemodel.examples.plugin.csv.immutable.WeirdReference,,java.lang.ref.WeakReference,get,set
com.helger.jcodemodel.examples.plugin.csv.immutable.WeirdReference,created,date,final
com.helger.jcodemodel.examples.plugin.csv.immutable.WeirdReference, visible , boolean, mutable
WeirdReference,,java.lang.ref.WeakReference,get,set
WeirdReference,created,date,final
WeirdReference, visible , boolean, mutable
</data>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,8 @@ public void setE(ArrayIndexOutOfBoundsException e) {
this.e = e;
}

public void printStackTrace(PrintWriter arg0) {
e.printStackTrace(arg0);
}

public void printStackTrace() {
e.printStackTrace();
}

public void printStackTrace(PrintStream arg0) {
e.printStackTrace(arg0);
}

public StackTraceElement[] getStackTrace() {
return e.getStackTrace();
public void addSuppressed(Throwable arg0) {
e.addSuppressed(arg0);
}

public Throwable fillInStackTrace() {
Expand All @@ -37,27 +25,39 @@ public Throwable getCause() {
return e.getCause();
}

public Throwable initCause(Throwable arg0) {
return e.initCause(arg0);
public String getLocalizedMessage() {
return e.getLocalizedMessage();
}

public String getMessage() {
return e.getMessage();
}

public StackTraceElement[] getStackTrace() {
return e.getStackTrace();
}

public Throwable[] getSuppressed() {
return e.getSuppressed();
}

public String getLocalizedMessage() {
return e.getLocalizedMessage();
public Throwable initCause(Throwable arg0) {
return e.initCause(arg0);
}

public void setStackTrace(StackTraceElement[] arg0) {
e.setStackTrace(arg0);
public void printStackTrace() {
e.printStackTrace();
}

public void addSuppressed(Throwable arg0) {
e.addSuppressed(arg0);
public void printStackTrace(PrintStream arg0) {
e.printStackTrace(arg0);
}

public void printStackTrace(PrintWriter arg0) {
e.printStackTrace(arg0);
}

public void setStackTrace(StackTraceElement[] arg0) {
e.setStackTrace(arg0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@ public char getC() {
return abc.getC();
}

public JBlock body() {
return jCatchBlock.body();
}

public AbstractJClass exception() {
return jCatchBlock.exception();
}

public void generate(IJFormatter arg0) {
jCatchBlock.generate(arg0);
}

public JVar param() {
return jCatchBlock.param();
}

public JVar param(String arg0) {
return jCatchBlock.param(arg0);
}

public JBlock body() {
return jCatchBlock.body();
}

public void generate(IJFormatter arg0) {
jCatchBlock.generate(arg0);
}
}
2 changes: 1 addition & 1 deletion examples/plugins/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>com.helger.jcodemodel.examples.plugin</groupId>
<artifactId>helloworld</artifactId>
<name>JCodeModel HelloWorld Example</name>
<name>JCodeModel Example Generator HelloWorld</name>
<description>demonstrates and validates the usage of the jcodemodel plugin alongside the helloworld generator</description>

<build>
Expand Down
133 changes: 133 additions & 0 deletions examples/plugins/json/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.helger.jcodemodel.examples</groupId>
<artifactId>plugins</artifactId>
<version>4.0.1-SNAPSHOT</version>
</parent>
<groupId>com.helger.jcodemodel.examples.plugin</groupId>
<artifactId>json</artifactId>
<name>JCodeModel Example Generator JSON</name>
<description>demonstrates and validates the usage of the jcodemodel plugin alongside the Json generator</description>

<build>
<plugins>
<plugin>
<groupId>com.helger.jcodemodel</groupId>
<artifactId>jcodemodel-maven-plugin</artifactId>
<executions>
<execution>
<id>basic</id>
<goals>
<goal>generate-source</goal>
</goals>
<configuration>
<rootPackage>com.helger.jcodemodel.examples.plugin.json.basic</rootPackage>
<data>
{
"package":[
"get",
"set"
],
"A":{
"var":{
"a":{
"class":"int",
"options":[
"private",
"final"
]
}
}
},
"B":{
"extends":"A",
"var":{
"b":{
"class":"int",
"options":[
"private"
]
}
}
},
"C":{
"var":{
"redirect":{
"class":"B",
"options":[
"private",
"redirect"
]
}
}
}
}
</data>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.helger.jcodemodel.plugin.generators</groupId>
<artifactId>json</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>src/generated/java</directory>
</fileset>
</filesets>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/generated/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<!--only here to be called later in the maven reactor-->
<dependency>
<groupId>com.helger.jcodemodel.examples.plugin</groupId>
<artifactId>helloworld</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.helger.jcodemodel.examples.plugin.json.basic;

public class A {
private final int a;

public A(int a) {
this.a = a;
}

/**
* @return the {@link #a}
*/
public int getA() {
return a;
}
}
Loading