Created
June 30, 2012 19:27
-
-
Save hasghari/3025179 to your computer and use it in GitHub Desktop.
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.apache.avro.Protocol; | |
import org.apache.avro.compiler.idl.Idl; | |
import org.apache.avro.compiler.idl.ParseException; | |
import org.apache.avro.compiler.specific.ProtocolTask; | |
import org.apache.avro.compiler.specific.SpecificCompiler; | |
import org.apache.tools.ant.BuildException; | |
import java.io.File; | |
import java.io.IOException; | |
public class IdlTask extends ProtocolTask { | |
@Override | |
protected void doCompile(File src, File dir) throws IOException { | |
Idl parser = new Idl(src); | |
try { | |
Protocol protocol = parser.CompilationUnit(); | |
SpecificCompiler compiler = new SpecificCompiler(protocol); | |
compiler.setStringType(getStringType()); | |
compiler.compileToDestination(src, dir); | |
} catch (ParseException e) { | |
throw new BuildException(e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment