Search in sources :

Example 1 with SingleVariableDeclaration

use of org.whole.lang.java.model.SingleVariableDeclaration in project whole by wholeplatform.

the class SingleVariableDeclarationPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    SingleVariableDeclaration entity = getModelEntity();
    Varargs varargs = entity.getVarargs();
    SingleVariableDeclarationFigure figure = (SingleVariableDeclarationFigure) getFigure();
    figure.showVarargs(!EntityUtils.isResolver(varargs) && varargs.wBooleanValue());
    List<IEntity> list = new ArrayList<IEntity>(4);
    list.add(entity.getModifiers());
    list.add(entity.getType());
    list.add(entity.getName());
    list.add(entity.getVarargsAnnotations());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) SingleVariableDeclaration(org.whole.lang.java.model.SingleVariableDeclaration) Varargs(org.whole.lang.java.model.Varargs) ArrayList(java.util.ArrayList) SingleVariableDeclarationFigure(org.whole.lang.java.ui.figures.SingleVariableDeclarationFigure)

Example 2 with SingleVariableDeclaration

use of org.whole.lang.java.model.SingleVariableDeclaration 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());
    }
}
Also used : Assignment(org.whole.lang.java.model.Assignment) PathExpression(org.whole.lang.queries.model.PathExpression) IEntity(org.whole.lang.model.IEntity) SingleVariableDeclaration(org.whole.lang.java.model.SingleVariableDeclaration) ExpressionStatement(org.whole.lang.java.model.ExpressionStatement) XmlModel(org.whole.lang.models.codebase.XmlModel) Model(org.whole.lang.models.model.Model) IBindingManager(org.whole.lang.bindings.IBindingManager) XmlModel(org.whole.lang.models.codebase.XmlModel) ITemplateManager(org.whole.lang.templates.ITemplateManager) Feature(org.whole.lang.models.model.Feature) FieldDeclaration(org.whole.lang.java.model.FieldDeclaration) Test(org.junit.Test)

Aggregations

SingleVariableDeclaration (org.whole.lang.java.model.SingleVariableDeclaration)2 IEntity (org.whole.lang.model.IEntity)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 IBindingManager (org.whole.lang.bindings.IBindingManager)1 Assignment (org.whole.lang.java.model.Assignment)1 ExpressionStatement (org.whole.lang.java.model.ExpressionStatement)1 FieldDeclaration (org.whole.lang.java.model.FieldDeclaration)1 Varargs (org.whole.lang.java.model.Varargs)1 SingleVariableDeclarationFigure (org.whole.lang.java.ui.figures.SingleVariableDeclarationFigure)1 XmlModel (org.whole.lang.models.codebase.XmlModel)1 Feature (org.whole.lang.models.model.Feature)1 Model (org.whole.lang.models.model.Model)1 PathExpression (org.whole.lang.queries.model.PathExpression)1 ITemplateManager (org.whole.lang.templates.ITemplateManager)1