name.remal.annotation.ErrorCreatingAnnotationInstanceException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common Show documentation
Show all versions of common Show documentation
Java & Kotlin tools: common
package name.remal.annotation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.annotation.Annotation;
public class ErrorCreatingAnnotationInstanceException extends RuntimeException {
private static String formatMessage(@NotNull Class extends Annotation> type, @Nullable String message) {
StringBuilder sb = new StringBuilder();
sb.append("Error creating annotation ").append(type.getName()).append(" instance");
if (message != null && !message.isEmpty()) {
sb.append(": ").append(message);
}
return sb.toString();
}
public ErrorCreatingAnnotationInstanceException(@NotNull Class extends Annotation> type) {
super(formatMessage(type, null));
}
public ErrorCreatingAnnotationInstanceException(@NotNull Class extends Annotation> type, @NotNull String message) {
super(formatMessage(type, message));
}
public ErrorCreatingAnnotationInstanceException(@NotNull Class extends Annotation> type, @NotNull String message, @NotNull Throwable cause) {
super(formatMessage(type, message), cause);
}
public ErrorCreatingAnnotationInstanceException(@NotNull Class extends Annotation> type, @NotNull Throwable cause) {
super(formatMessage(type, null), cause);
}
}