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 example; | |
| import draft.java.*; | |
| import draft.java.file._export; | |
| import draft.java.macro.*; | |
| import junit.framework.TestCase; | |
| import java.util.*; | |
| public class _draft_2_$macro extends TestCase { |
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 tutorial; | |
| import draft.java.*; | |
| import draft.java.file._export; | |
| import draft.java.macro.*; | |
| import junit.framework.TestCase; | |
| import java.util.*; | |
| /** |
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
| /env --module-path C:\temp\jars\draft.jar;C:\temp\jars\javaparser-core-3.6.14.jar; --add-modules draft | |
| import draft.java.*; | |
| import draft.java.auto.*; | |
| _class _c = _class.of("draftshell.gen.Point").fields("int x,y"); | |
| _autoDto.to(_c); | |
| _out.to("C:\\temp", _c); |
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 draft.tutorial.usecase; | |
| import com.squareup.javapoet.*; | |
| import draft.java.*; | |
| import draft.java.macro.*; | |
| import draft.java.runtime.*; | |
| import draft.java.template.$method; | |
| import java.io.IOException; | |
| import java.util.*; | |
| import javax.lang.model.element.Modifier; |
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 com.squareup.javapoet.adhoc; | |
| import com.squareup.javapoet.*; | |
| import javax.lang.model.element.Modifier; | |
| import junit.framework.TestCase; | |
| import run.adhoc.*; | |
| /** | |
| * Show how to work with the JavaPoetAdhoc abstraction, to compile/load and | |
| * use dynamically build code from JavaPoet 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 com.squareup.javapoet.adhoc; | |
| import com.squareup.javapoet.JavaFile; | |
| import run.adhoc.*; | |
| /** | |
| * Adapts JavaPoet's {@link JavaFile} code model to the {@link javax.tools.JavaCompiler} | |
| * infrastructure through Adhocs {@link CodeModelFile}. We want to reduce the | |
| * friction for compiling / loading and using the Java source code 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 org.jdraft.mr; | |
| import com.github.javaparser.*; | |
| import com.github.javaparser.ast.CompilationUnit; | |
| import com.github.javaparser.ast.Node; | |
| import com.github.javaparser.utils.PositionUtils; | |
| import junit.framework.TestCase; | |
| import org.jdraft._field; | |
| import org.jdraft._method; |
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
| import org.jdraft.*; | |
| import org.jdraft.adhoc.*; | |
| import org.jdraft.macro.*; | |
| import java.net.UUID; | |
| public class BuildAndUseTest extends TestCase { | |
| public void testBuildAndUseModel(){ | |
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 test.othertools; | |
| import junit.framework.TestCase; | |
| import org.jdraft._class; | |
| import org.jdraft._method; | |
| import org.jdraft.pattern.$method; | |
| import org.jdraft.runtime._proxy; | |
| /** | |
| * A Rewrite taken from the presentation at Voxxed Days Ticino 2019 by Luca Molteni |
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 test.othertools; | |
| import junit.framework.TestCase; | |
| import org.jdraft._method; | |
| import org.jdraft.pattern.$typeRef; | |
| /** | |
| * Luca Molteni presented an example at the Voxxed Days Ticino 2019 | |
| * https://youtu.be/1pSj6OQsq9k?list=PLRsbF2sD7JVorYibvQrrG34UQ6YE3PaVP&t=2214 | |
| * replaced using jdraft API |