Created
November 28, 2016 14:46
-
-
Save edefazio/aa93dbbaabcaf9427d423e28303d4f9d to your computer and use it in GitHub Desktop.
varcode generates .java code and also compiles, loads, and instantiates new instances from AdHoc models
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 quickstart.java; | |
import varcode.java.langmodel._class; | |
public class AdHocCode | |
{ | |
public static void main( String[] args ) | |
{ | |
_class _c = _class.of( "public class AdHoc" ) | |
.method( "public String toString()", | |
"return \"Hello AdHoc\";" ); | |
System.out.println( _c.author() ); //write the Java code | |
Object adHocInstance = _c.instance( ); //create a new instance | |
System.out.println( adHocInstance ); //prints "Hello AdHoc" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello AdHoc