Search in sources :

Example 1 with MethodDeclarationRepresentation

use of org.ndx.agile.architecture.sequence.generator.javaparser.adapter.MethodDeclarationRepresentation in project agile-architecture-documentation-system by Riduidel.

the class SequenceDiagramConstructionKit method activateCreation.

public void activateCreation(ObjectCreationRepresentation objectCreationRepresentation) {
    createIfNeeded(objectCreationRepresentation, (objectCreation, toComponent) -> {
        components.add(toComponent);
        methodCalls.append("create ").append(componentId(toComponent)).append('\n');
        // Don't forget to add the "new" call
        Optional<MethodDeclarationRepresentation> declaration = objectCreation.containerOfType(MethodDeclarationRepresentation.class);
        declaration.stream().forEach(decl -> {
            Component fromComponent = classesToComponents.get(decl.className);
            methodCalls.append(componentId(fromComponent)).append("->").append(componentId(toComponent)).append(":new\n");
        });
    });
}
Also used : MethodDeclarationRepresentation(org.ndx.agile.architecture.sequence.generator.javaparser.adapter.MethodDeclarationRepresentation) Component(com.structurizr.model.Component)

Example 2 with MethodDeclarationRepresentation

use of org.ndx.agile.architecture.sequence.generator.javaparser.adapter.MethodDeclarationRepresentation in project agile-architecture-documentation-system by Riduidel.

the class SequenceDiagramGenerator method findImplementationOf.

private MethodDeclarationRepresentation findImplementationOf(MethodCallRepresentation methodCallRepresentation) {
    Component component = classesToComponents.get(methodCallRepresentation.calledTypeName);
    MethodDeclarationRepresentation representation = null;
    for (CodeElement code : component.getCode()) {
        representation = callGraphModel.getClassFor(code.getType()).getMethodFor(methodCallRepresentation);
        // This will be null.
        if (representation != null) {
            if (!representation.getChildren().isEmpty()) {
                break;
            }
        }
    }
    return representation;
}
Also used : MethodDeclarationRepresentation(org.ndx.agile.architecture.sequence.generator.javaparser.adapter.MethodDeclarationRepresentation) Component(com.structurizr.model.Component) CodeElement(com.structurizr.model.CodeElement)

Aggregations

Component (com.structurizr.model.Component)2 MethodDeclarationRepresentation (org.ndx.agile.architecture.sequence.generator.javaparser.adapter.MethodDeclarationRepresentation)2 CodeElement (com.structurizr.model.CodeElement)1