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

name.remal.annotation.ErrorCreatingAnnotationInstanceException Maven / Gradle / Ivy

The newest version!
package name.remal.annotation;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.annotation.Annotation;

public class ErrorCreatingAnnotationInstanceException extends RuntimeException {

    private static String formatMessage(@Nonnull Class type, @Nullable String message) {
        StringBuilder sb = new StringBuilder();
        sb.append("Error creating annotation ").append(type.getName()).append(" instance");
        if (null != message && !message.isEmpty()) {
            sb.append(": ").append(message);
        }
        return sb.toString();
    }

    public ErrorCreatingAnnotationInstanceException(@Nonnull Class type) {
        super(formatMessage(type, null));
    }

    public ErrorCreatingAnnotationInstanceException(@Nonnull Class type, @Nonnull String message) {
        super(formatMessage(type, message));
    }

    public ErrorCreatingAnnotationInstanceException(@Nonnull Class type, @Nonnull String message, @Nonnull Throwable cause) {
        super(formatMessage(type, message), cause);
    }

    public ErrorCreatingAnnotationInstanceException(@Nonnull Class type, @Nonnull Throwable cause) {
        super(formatMessage(type, null), cause);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy