All Downloads are FREE. Search and download functionalities are using the official Maven repository.

poussecafe.doc.model.boundedcontextdoc.BoundedContextDocFactory Maven / Gradle / Ivy

There is a newer version: 0.29.0
Show newest version
package poussecafe.doc.model.boundedcontextdoc;

import javax.lang.model.element.PackageElement;
import poussecafe.doc.model.AnnotationsResolver;
import poussecafe.doc.model.ComponentDocFactory;
import poussecafe.domain.DomainException;
import poussecafe.domain.Factory;

public class BoundedContextDocFactory extends Factory {

    public BoundedContextDoc newBoundedContextDoc(PackageElement packageDoc) {
        if(!isBoundedContextDoc(packageDoc)) {
            throw new DomainException("Package " + packageDoc.getQualifiedName().toString() + " is not a valid bounded context");
        }

        String name = annotationsResolver.boundedContext(packageDoc);
        BoundedContextDoc boundedContextDoc = newAggregateWithId(BoundedContextDocId.ofPackageName(packageDoc.getQualifiedName().toString()));
        boundedContextDoc.componentDoc(componentDocFactory.buildDoc(name, packageDoc));
        return boundedContextDoc;
    }

    private AnnotationsResolver annotationsResolver;

    private ComponentDocFactory componentDocFactory;

    public boolean isBoundedContextDoc(PackageElement packageDoc) {
        return annotationsResolver.isBoundedContext(packageDoc);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy