use of co.cask.cdap.common.dataset.DatasetClassRewriter in project cdap by caskdata.
the class DatasetClassRewriterTest method rewrite.
private ClassDefinition rewrite(Class<? extends Dataset> dataset) throws Exception {
DatasetClassRewriter rewriter = new DatasetClassRewriter();
URL url = dataset.getClassLoader().getResource(dataset.getName().replace('.', '/') + ".class");
Assert.assertNotNull(url);
try (InputStream is = url.openStream()) {
return new ClassDefinition(rewriter.rewriteClass(dataset.getName(), is), Type.getInternalName(dataset));
}
}
Aggregations