-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e108170
commit ed08c34
Showing
17 changed files
with
180 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
test/app/src/main/java/org/bsc/maven/plugin/processor/test/SampleClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.bsc.maven.plugin.processor.test; | ||
|
||
@GenerateClass | ||
public class SampleClass { | ||
|
||
final public String id; | ||
final public String name; | ||
|
||
public SampleClass(String id, String name ) { | ||
this.name = name; | ||
this.id = id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.bsc.maven</groupId> | ||
<artifactId>maven-processor-plugin-test-processors</artifactId> | ||
<packaging>jar</packaging> | ||
<name>MAVEN PROCESSOR PLUGIN TEST::Processor</name> | ||
<description></description> | ||
|
||
<parent> | ||
<groupId>org.bsc.maven</groupId> | ||
<artifactId>maven-processor-plugin-parent</artifactId> | ||
<version>4.6-SNAPSHOT</version> | ||
</parent> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.bsc.util</groupId> | ||
<artifactId>processor-utils</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...essors/src/main/java/org/bsc/maven/plugin/processor/test/TestGenerateSourceProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* To change this template, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package org.bsc.maven.plugin.processor.test; | ||
|
||
import org.bsc.processor.BaseAbstractProcessor; | ||
|
||
import javax.annotation.processing.Filer; | ||
import javax.annotation.processing.RoundEnvironment; | ||
import javax.annotation.processing.SupportedAnnotationTypes; | ||
import javax.annotation.processing.SupportedSourceVersion; | ||
import javax.lang.model.SourceVersion; | ||
import javax.lang.model.element.Element; | ||
import javax.lang.model.element.ElementKind; | ||
import javax.lang.model.element.TypeElement; | ||
import javax.tools.FileObject; | ||
import javax.tools.StandardLocation; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.Set; | ||
|
||
import static java.lang.String.format; | ||
|
||
/** | ||
* | ||
* @author softphone | ||
* | ||
* | ||
*/ | ||
//@SupportedSourceVersion(SourceVersion.RELEASE_8) | ||
@SupportedSourceVersion(SourceVersion.RELEASE_9) | ||
//@SupportedOptions( {"subfolder", "filepath", "templateUri"}) | ||
@SupportedAnnotationTypes( { "org.bsc.maven.plugin.processor.test.GenerateClass" }) | ||
public class TestGenerateSourceProcessor extends BaseAbstractProcessor { | ||
|
||
void writeSourceCode( Element e ) { | ||
|
||
final java.net.URL url = getClass().getClassLoader().getResource("GeneratedClass_java.txt"); | ||
try { | ||
|
||
final FileObject source = super.createSourceOutputFile( Paths.get("test"), Paths.get("GeneratedClass.java") ); | ||
|
||
try( java.io.OutputStream os = source.openOutputStream(); java.io.InputStream is = url.openStream() ) { | ||
os.write(is.readAllBytes()); | ||
} | ||
|
||
} catch (Exception ex) { | ||
error( format("error writing source file [%s]", url ), ex); | ||
} | ||
} | ||
/** | ||
* | ||
* @param annotations | ||
* @param roundEnv | ||
* @return | ||
*/ | ||
@Override | ||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { | ||
if (roundEnv.processingOver()) return false; | ||
|
||
super.elementStreamFromAnnotations( annotations, roundEnv, e -> true ) | ||
.peek( System.out::println) | ||
.forEach( this::writeSourceCode ); | ||
|
||
return true; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package test; | ||
|
||
public class GeneratedClass { | ||
|
||
|
||
} |
18 changes: 0 additions & 18 deletions
18
test/src/main/java/org/bsc/maven/plugin/processor/test/ServiceDocumentation.java
This file was deleted.
Oops, something went wrong.
87 changes: 0 additions & 87 deletions
87
test/src/main/java/org/bsc/maven/plugin/processor/test/TestWikiProcessor.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
test/src/main/java/org/bsc/maven/plugin/processor/test/TestWikiProcessorClass.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.