
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
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 extends Annotation> 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 extends Annotation> type) {
super(formatMessage(type, null));
}
public ErrorCreatingAnnotationInstanceException(@Nonnull Class extends Annotation> type, @Nonnull String message) {
super(formatMessage(type, message));
}
public ErrorCreatingAnnotationInstanceException(@Nonnull Class extends Annotation> type, @Nonnull String message, @Nonnull Throwable cause) {
super(formatMessage(type, message), cause);
}
public ErrorCreatingAnnotationInstanceException(@Nonnull Class extends Annotation> type, @Nonnull Throwable cause) {
super(formatMessage(type, null), cause);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy