Last active
February 8, 2017 17:58
-
-
Save edefazio/f1bed02ff66524149c215311c6d6f356 to your computer and use it in GitHub Desktop.
varcode build model of annotation type example
This file contains hidden or 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
package usecase.model; | |
import varcode.java.adhoc.Export; | |
import varcode.java.model._annotationType; | |
public class ModelAnnotationType | |
{ | |
static _annotationType _ModelOfAnnotation = _annotationType.of( | |
"package usecase.model;", | |
"import java.lang.annotation.Retention;", | |
"import java.lang.annotation.RetentionPolicy;", | |
"/** Annotation Type Javadoc comment */", | |
"@Retention(RetentionPolicy.RUNTIME)", | |
"public @interface ModelOfAnnotation" ) | |
.property( "float", "price" ) | |
.property( "boolean", "isOpen" ) | |
//properties with defaults | |
.property( "int", "count", 1 ) | |
.property( String.class, "property", "\"defaultValue\"" ) | |
.property( String[].class, "arrayString", "{\"A\", \"B\"}" ); | |
public static void main( String[] args ) | |
{ | |
System.out.println( _ModelOfAnnotation ); | |
Export.dir( "C:\\MyApp\\src\\main\\java\\" ).toFile( _ModelOfAnnotation ); | |
Class clazz = _ModelOfAnnotation.loadClass(); | |
Export.dir( "C:\\MyApp\\target\\classes\\" ).toFile( clazz ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment