|
AnnomarkExample
Example project to demonstrate annomark
Using the annomark-example projectThis is a project that demonstrates the features of "annomark". It creates some classes and xml files based on various annotations. Some of the features demonstrated by the example project:
For SVN and maven2 users1. Checkout the annomark-example from Source with SVN. 2. Build the project mvn clean package 3. Look into the target/generated/src/main directory For maven2 users that cannot checkout from SVN1. Download annomark-example-project.zip and extract 2. Build the project mvn clean package 3. Look into the target/generated/src/main directory Annomark explained1. The pom launches a groovy script that contains all instructions and configurations pom.xml: <java classname="org.codehaus.gram.Gram" fork="true"
failonerror="true">
<classpath refid="maven.test.classpath"/>
<arg value="${basedir}/src/main/java/com/agimatec"/>
<arg value="src/main/groovy/JAMLauncher.groovy"/>
</java>
2. The groovy script configures annomark: JAMLancher.groovy import java.util.*;
import com.agimatec.annotations.jam.*;
import com.agimatec.annotations.*;
def dtoClasses = new HashSet();
dtoClasses.addAll(classes.findAll { it.getAnnotation(DTO.class) != null });
dtoClasses.addAll(classes.findAll { it.getAnnotation(DTOs.class) != null });
generator = new JAMDtoGenerator();
generator.setTemplateDir("../annomark/templates");
generator.addInstruction("java-pojo", "target/generated/src/main/java", null)
.setUsageQualifier("Edit")
.setPrefix("Transfer")
.setSuffix(".java")
.setDefaultPackage("com.agimatec.annomark.example.transfer");
// ... more instructions here ...
generator.generate(dtoClasses);
3. Study the example
|
► Sign in to add a comment