net.sf.aguacate.function.spi.AbstractFunction Maven / Gradle / Ivy
package net.sf.aguacate.function.spi;
import java.util.Collection;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.sf.aguacate.function.Function;
public abstract class AbstractFunction implements Function {
private static final Logger MESSAGE_LOGGER = LogManager.getLogger("aguacate.function");
private final Collection methods;
private final String name;
public AbstractFunction(Collection methods, String name) {
this.methods = methods;
this.name = name;
}
@Override
public boolean validFor(String method) {
return methods.contains(method);
}
@Override
public String getName() {
return name;
}
protected void logFailure(String msg) {
MESSAGE_LOGGER.warn("{}({}): failure", msg, getName());
}
protected void logSuccess(String msg) {
MESSAGE_LOGGER.info("{}({}): success", msg, getName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy