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

io.github.sporklibrary.exceptions.BindException Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package io.github.sporklibrary.exceptions;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * Exception that is thrown when binding fails.
 */
public class BindException extends RuntimeException
{
	public BindException(Class annotation, String message)
	{
		super(annotation.getSimpleName() + " failed: " + message);
	}

	public BindException(Class annotation, Class parent, String reason, Exception cause)
	{
		super(annotation.getSimpleName() + " failed for " + parent.getSimpleName()  + ": " + reason, cause);
	}

	public BindException(Class annotation, Class parent, String reason)
	{
		super(annotation.getSimpleName() + " failed for " + parent.getSimpleName()  + ": " + reason);
	}

	public BindException(Class annotation, Class parent, Field field, String reason)
	{
		super(annotation.getSimpleName() + " failed for " + parent.getSimpleName() + " at field '" + field.getName() + "': " + reason);
	}

	public BindException(Class annotation, Class parent, Field field, String reason, Exception cause)
	{
		super(annotation.getSimpleName() + " failed for " + parent.getSimpleName() + " at field '" + field.getName() + "': " + reason, cause);
	}

	public BindException(Class annotation, Class parent, Method method, String reason)
	{
		super(annotation.getSimpleName() + " failed for " + parent.getSimpleName() + " at method '" + method.getName() + "': " + reason);
	}

	public BindException(Class annotation, Class parent, Method method, String reason, Exception cause)
	{
		super(annotation.getSimpleName() + " failed for " + parent.getSimpleName() + " at method '" + method.getName() + "': " + reason, cause);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy