Last active
January 22, 2017 00:30
-
-
Save edefazio/adbbd9cd500617d3202b2a2a3c7ebf68 to your computer and use it in GitHub Desktop.
varcode _interface model building 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.Java; | |
import varcode.java.adhoc.Export; | |
import varcode.java.model._interface; | |
public class ModelInterface | |
{ | |
static _interface _ModelOfInterface = _interface.of( | |
"package usecase.model;", | |
"import java.util.UUID;", | |
"import java.io.Serializable", | |
"/** Interface Javadoc comment */", | |
"@Deprecated", | |
"public interface ModelOfInterface<P> extends Serializable" ) | |
.field( "public static final long serialVersionUID = 4L;" ) | |
.field( | |
"/** Field JavaDoc */", | |
"@Deprecated", | |
"public static final int staticField = 101;" ) | |
.method( "/** Javadoc */", | |
"@Deprecated", | |
"public void soundOff();") | |
.method( | |
"/** Default Method Javadoc*/", | |
"@Deprecated", | |
"public default String getId( String prefix )", | |
"return prefix + UUID.randomUUID().toString();" ); | |
public static void main( String[] args ) | |
{ | |
Export.dir( "C:\\temp\\java\\" ).toFile( _ModelOfInterface ); | |
//compile & load the interface class | |
Class interfaceClass = _ModelOfInterface.loadClass(); | |
//export the class file "C:/temp/classes/usecase.model.ModelOfInterface.class" | |
Export.dir( "C:\\temp\\classes\\").toFile( interfaceClass ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the content of the exported .java source file: "C:\temp\java\usecase\model\ModelOfInterface.java"