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

org.metaeffekt.notice.engine.NoticeParameterValidationContext Maven / Gradle / Ivy

There is a newer version: 0.117.0
Show newest version
/*
 * Copyright 2021-2024 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.metaeffekt.notice.engine;

import org.metaeffekt.core.maven.inventory.mojo.ExecutionStatus;

import java.util.HashSet;
import java.util.Set;

public class NoticeParameterValidationContext extends ExecutionStatus {

    private final String artifactQualifer;

    final Set messages = new HashSet<>();

    public NoticeParameterValidationContext(String artifactQualifier) {
        this.artifactQualifer = artifactQualifier;
    }

    // FIXME: separate issue and hint as parameters

    @Override
    public void warn(String message) {
        super.warn(String.format("%-100s: %s", artifactQualifer, message));
    }

    public void warn(String messageTemplate, Object... object) {
        warn(String.format(messageTemplate, object));
    }

    @Override
    public void error(String message) {
        super.error(String.format("%-100s: %s", artifactQualifer, message));
    }

    public void error(String messageTemplate, Object... object) {
        error(String.format(messageTemplate, object));
    }

    @Override
    public void info(String message) {
        super.info(String.format("%-100s: %s", artifactQualifer, message));
    }

    public void info(String messageTemplate, Object... object) {
        info(String.format(messageTemplate, object));
    }

    public void debug(String messageTemplate, Object... object) {
        // FIXME: enable debug level
    }

    public Set getMessages() {
        return messages;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy