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

com.structurizr.inspection.model.AbstractElementInspection Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.structurizr.inspection.model;

import com.structurizr.inspection.Inspection;
import com.structurizr.inspection.Inspector;
import com.structurizr.inspection.Severity;
import com.structurizr.inspection.Violation;
import com.structurizr.model.Element;

abstract class AbstractElementInspection extends Inspection {

    public AbstractElementInspection(Inspector inspector) {
        super(inspector);
    }

    public final Violation run(Element element) {
        Severity severity = getInspector().getSeverityStrategy().getSeverity(this, element);
        Violation violation = inspect(element);

        return violation == null ? null : violation.withSeverity(severity);
    }

    protected String terminologyFor(Element element) {
        return getWorkspace().getViews().getConfiguration().getTerminology().findTerminology(element).toLowerCase();
    }

    protected String nameOf(Element element) {
        String canonicalName = element.getCanonicalName();
        return canonicalName.substring(canonicalName.indexOf("://") + 3);
    }

    protected abstract Violation inspect(Element element);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy