use of org.whole.lang.java.codebase.JavaClassTemplateFactory in project whole by wholeplatform.
the class PojoUtilsTest method getCompilationUnits.
public static Misc getCompilationUnits(Class<?>... classes) {
MiscEntityFactory mef = MiscEntityFactory.instance;
Misc misc = mef.createMisc(0);
for (int i = 0; i < classes.length; i++) {
JavaClassTemplateFactory javaSourceTemplateFactory = new JavaClassTemplateFactory(classes[i]);
CompilationUnit compilationUnit = javaSourceTemplateFactory.create();
Any stageUpFragment = CommonsEntityAdapterFactory.createStageUpFragment(MiscEntityDescriptorEnum.Any, compilationUnit);
misc.wAdd(stageUpFragment);
}
return misc;
}
use of org.whole.lang.java.codebase.JavaClassTemplateFactory in project whole by wholeplatform.
the class WorkflowsInterpreterVisitor method getJavaTemplateFactory.
protected ITemplateFactory<CompilationUnit> getJavaTemplateFactory(LoadJavaModel entity) {
entity.getClassName().accept(this);
String className = getResultString();
if (!Matcher.matchImpl(WorkflowsEntityDescriptorEnum.ClassPath, entity.getClassProvider()))
throw new UnsupportedOperationException("The Eclipse Workspace is not available");
try {
return new JavaClassTemplateFactory(Class.forName(className, false, ReflectionFactory.getClassLoader(getBindings())));
} catch (ClassNotFoundException e) {
throw new WholeIllegalArgumentException(e).withSourceEntity(entity).withBindings(getBindings());
}
}
use of org.whole.lang.java.codebase.JavaClassTemplateFactory in project whole by wholeplatform.
the class WorkflowsInterpreterVisitorTest method testLoadJavaModel.
@Test
public void testLoadJavaModel() {
IEntity loadJavaModelTest = WorkflowsTestTemplateManager.instance().create("loadJavaModelTest");
IBindingManager args = BindingManagerFactory.instance.createArguments();
InterpreterOperation.interpret(loadJavaModelTest, args);
Assert.assertTrue(Matcher.match(args.wGet("model"), new JavaClassTemplateFactory(SampleModel.class).create()));
}
Aggregations