use of org.whole.lang.java.model.FieldDeclaration in project whole by wholeplatform.
the class SelectQueriesTest method testSelectTupleOfTemplatesAs.
@Test
public void testSelectTupleOfTemplatesAs() {
Model model = new XmlModel().create();
ITemplateManager tm = SelectQueriesTemplateManager.instance();
PathExpression query = (PathExpression) tm.create("selectTupleOfTemplatesAs");
IBindingManager bm = BindingManagerFactory.instance.createArguments();
for (IEntity tuple : BehaviorUtils.compileAndLazyEvaluate(query, model, bm)) {
FieldDeclaration f = (FieldDeclaration) tuple.wGet(0);
SingleVariableDeclaration p = (SingleVariableDeclaration) tuple.wGet(1);
ExpressionStatement s = (ExpressionStatement) tuple.wGet(2);
Feature e = (Feature) tuple.wGet(3);
String ptype = e.getType().wStringValue();
String pname = e.getName().wStringValue();
assertSame(f, bm.wGet("field"));
assertEquals(ptype, f.getType().wStringValue());
assertSame(p, bm.wGet("param"));
assertEquals(ptype, p.getType().wStringValue());
assertEquals(pname, p.getName().wStringValue());
assertSame(s, bm.wGet("init"));
assertEquals(pname, ((Assignment) s.getExpression()).getRightHandSide().wStringValue());
}
}
use of org.whole.lang.java.model.FieldDeclaration in project whole by wholeplatform.
the class SelectQueriesTest method testSelectTupleWithTemplates.
@Test
public void testSelectTupleWithTemplates() {
ITemplateManager tm = SelectQueriesTemplateManager.instance();
Grammar model = new TestXmlGrammar().create();
IBindingManager bm = BindingManagerFactory.instance.createArguments();
PathExpression query = (PathExpression) tm.create("selectTupleWithTemplates");
for (IEntity tuple : BehaviorUtils.compileAndLazyEvaluate(query, model, bm)) {
FieldDeclaration fd = (FieldDeclaration) tuple.wGet(0);
Feature f = (Feature) tuple.wGet(1);
As e = (As) tuple.wGet(2);
assertEquals(e.getName().getValue(), fd.getFragments().wGet(0).wGet(0).wStringValue());
assertEquals(e.getRule().wStringValue(), fd.getType().wStringValue());
assertEquals(e.getName().getValue(), f.getName().wStringValue());
assertEquals(e.getRule().wStringValue(), f.getType().wStringValue());
}
}
use of org.whole.lang.java.model.FieldDeclaration in project whole by wholeplatform.
the class FieldDeclarationPart method getModelSpecificChildren.
protected List<IEntity> getModelSpecificChildren() {
List<IEntity> list = new ArrayList<IEntity>(4);
FieldDeclaration fieldDeclaration = getModelEntity();
list.add(fieldDeclaration.getJavadoc());
list.add(fieldDeclaration.getModifiers());
list.add(fieldDeclaration.getType());
list.add(fieldDeclaration.getFragments());
return list;
}
Aggregations