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

com.softicar.platform.common.code.validator.PlatformCodeViolationCollection Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.code.validator;

import com.softicar.platform.common.core.java.classes.name.JavaClassName;
import java.util.ArrayList;
import java.util.Collection;

class PlatformCodeViolationCollection {

	private final Collection violationMessages;

	public PlatformCodeViolationCollection() {

		this.violationMessages = new ArrayList<>();
	}

	public void addViolation(String message, Object...arguments) {

		violationMessages.add(String.format(message, arguments));
	}

	public void addClassHasMainMethodViolation(JavaClassName className) {

		addViolation("Class may not have `main` method: %s", className);
	}

	public void addClassUsesForbiddenClassViolation(JavaClassName className, JavaClassName forbiddenClass) {

		addViolation("Reference to forbidden class: %s --> %s", className, forbiddenClass);
	}

	public boolean isEmpty() {

		return violationMessages.isEmpty();
	}

	public Collection getMessages() {

		return violationMessages;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy