Search in sources :

Example 1 with MethodDeclaration

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

the class MethodDeclarationPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    MethodDeclaration entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(8);
    list.add(entity.getModifiers());
    list.add(entity.getTypeParameters());
    list.add(entity.getReturnType());
    list.add(entity.getName());
    list.add(entity.getParameters());
    list.add(entity.getThrownExceptions());
    list.add(entity.getBody());
    list.add(entity.getJavadoc());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) MethodDeclaration(org.whole.lang.java.model.MethodDeclaration) ArrayList(java.util.ArrayList)

Example 2 with MethodDeclaration

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

the class MethodDeclarationPart method refreshVisuals.

@Override
protected void refreshVisuals() {
    MethodDeclaration entity = getModelEntity();
    MethodDeclarationFigure methodDeclarationFigure = (MethodDeclarationFigure) getFigure();
    methodDeclarationFigure.showTypeParameters(!EntityUtils.isResolver(entity.getTypeParameters()));
    methodDeclarationFigure.showThrownExceptions(!EntityUtils.isResolver(entity.getThrownExceptions()));
    methodDeclarationFigure.showBodyDeclaration(!EntityUtils.isResolver(entity.getBody()));
}
Also used : MethodDeclarationFigure(org.whole.lang.java.ui.figures.MethodDeclarationFigure) MethodDeclaration(org.whole.lang.java.model.MethodDeclaration)

Example 3 with MethodDeclaration

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

the class SelectQueriesTest method testSelectTemplateWithTwoNestedSelectQueries.

@Test
public void testSelectTemplateWithTwoNestedSelectQueries() {
    ITemplateManager tm = SelectQueriesTemplateManager.instance();
    Model m = new XmlModel().create();
    PathExpression pe1 = (PathExpression) tm.create("selectTemplateWithTwoNestedSelectQueries");
    for (ClassDeclaration t : BehaviorUtils.<ClassDeclaration>compileAndLazyEvaluate(pe1, m)) {
        assertEquals(JavaEntityDescriptorEnum.ClassDeclaration, t.wGetEntityDescriptor());
        BodyDeclarations bodyDeclarations = t.getBodyDeclarations();
        MethodDeclaration md = (MethodDeclaration) bodyDeclarations.wGet(bodyDeclarations.wSize() - 1);
        assertEquals(bodyDeclarations.wSize() - 1, md.getBody().wSize());
    }
}
Also used : ClassDeclaration(org.whole.lang.java.model.ClassDeclaration) PathExpression(org.whole.lang.queries.model.PathExpression) MethodDeclaration(org.whole.lang.java.model.MethodDeclaration) XmlModel(org.whole.lang.models.codebase.XmlModel) Model(org.whole.lang.models.model.Model) ITemplateManager(org.whole.lang.templates.ITemplateManager) XmlModel(org.whole.lang.models.codebase.XmlModel) BodyDeclarations(org.whole.lang.java.model.BodyDeclarations) Test(org.junit.Test)

Example 4 with MethodDeclaration

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

the class ScannerTest method testPatternIterator.

@Test
public void testPatternIterator() {
    IEntity fact = new Factorial().create();
    IEntityIterator<IEntity> i = IteratorFactory.childMatcherIterator().withPattern(JavaEntityDescriptorEnum.MethodDeclaration);
    i.reset(fact);
    while (i.hasNext()) {
        MethodDeclaration md = (MethodDeclaration) i.next();
        md.getName();
    }
}
Also used : Factorial(org.whole.lang.java.codebase.Factorial) IEntity(org.whole.lang.model.IEntity) MethodDeclaration(org.whole.lang.java.model.MethodDeclaration) Test(org.junit.Test)

Aggregations

MethodDeclaration (org.whole.lang.java.model.MethodDeclaration)4 Test (org.junit.Test)2 IEntity (org.whole.lang.model.IEntity)2 ArrayList (java.util.ArrayList)1 Factorial (org.whole.lang.java.codebase.Factorial)1 BodyDeclarations (org.whole.lang.java.model.BodyDeclarations)1 ClassDeclaration (org.whole.lang.java.model.ClassDeclaration)1 MethodDeclarationFigure (org.whole.lang.java.ui.figures.MethodDeclarationFigure)1 XmlModel (org.whole.lang.models.codebase.XmlModel)1 Model (org.whole.lang.models.model.Model)1 PathExpression (org.whole.lang.queries.model.PathExpression)1 ITemplateManager (org.whole.lang.templates.ITemplateManager)1