/** * This error indicates that the runtime system does not support a required feature. */ @Immutable public abstract class SupportError extends InitializationError { /* -------------------------------------------------- Cause -------------------------------------------------- */ @Pure @Override public abstract @Nonnull Throwable getCause(); }
/** * This exception allows to tunnel checked exceptions through the methods of {@link Iterable}. */ @Immutable public abstract class IterationException extends UncheckedException {}
/** * A conversion exception indicates a problem when converting or recovering an object. * * @see RecoveryException * @see ConnectionException */ @Immutable public abstract class ConversionException extends ExternalException {}
/** * A recovery exception indicates that the recovered data does not fulfill the preconditions of its class. * * @see Check */ @Immutable public abstract class RecoveryException extends ConversionException { /* -------------------------------------------------- Cause -------------------------------------------------- */ @Pure @Override @TODO(task = "Why do we have to repeat this declaration in order to get null as the default cause?", date = "2017-01-24", author = Author.KASPAR_ETTER) public abstract @Nullable Throwable getCause(); }
/** * This interface extends the {@link Throwable} class with useful methods. */ @Immutable public interface CustomThrowable { /* -------------------------------------------------- Summary -------------------------------------------------- */ /** * Returns a one-line summary of this external exception. */ @Pure public default @Nonnull String getSummary() { return Throwables.getSummary((Throwable) this); } }
/** * The connection exception constitutes the upper bound of the converter’s generic exception. */ @Immutable public abstract class ConnectionException extends ConversionException { /* -------------------------------------------------- Message -------------------------------------------------- */ @Pure @Override public @Nonnull String getMessage() { return "The conversion failed due to an interrupted connection or violated constraints."; } /* -------------------------------------------------- Cause -------------------------------------------------- */ @Pure @Override public abstract @Nonnull Exception getCause(); }
/** * An unchecked exception allows the programmer to avoid throwing a checked exception. * It is often used when an operation that always succeeds under normal circumstances fails. */ @Immutable public abstract class UncheckedException extends RuntimeException implements CustomThrowable { /* -------------------------------------------------- Cause -------------------------------------------------- */ @Pure @Override public abstract @Nonnull Exception getCause(); /* -------------------------------------------------- Message -------------------------------------------------- */ @Pure @Override public @Nonnull String getMessage() { return "This exception wraps a " + getCause().getClass().getSimpleName() + "."; } }
/** * A configuration error indicates that a configuration has not been initialized with a provider. */ @Immutable public abstract class ConfigurationError extends InitializationError { /* -------------------------------------------------- Configuration -------------------------------------------------- */ /** * Returns the configuration which has not been initialized with a provider. */ @Pure public abstract @Nonnull Configuration<?> getConfiguration(); /* -------------------------------------------------- Message -------------------------------------------------- */ @Pure @Override public @Nonnull String getMessage() { return Strings.format("The configuration $ has not been initialized with a provider.", getConfiguration()); } }
/** * An external exception indicates an abnormal condition that is caused by an external component. * This means that also formally correct programs can throw external exceptions. * All custom non-runtime exceptions extend this class. * * @see InternalException */ @Immutable public abstract class ExternalException extends Exception implements CustomThrowable { /* -------------------------------------------------- Message -------------------------------------------------- */ @Pure @Override public abstract @Nonnull String getMessage(); /* -------------------------------------------------- Cause -------------------------------------------------- */ @Pure @Override public abstract @Nullable Throwable getCause(); }
/** * An initialization error indicates a problem during initialization from which the program cannot recover. * Like all errors, an initialization error should never be caught. * * @see SupportError */ @Immutable public abstract class InitializationError extends Error implements CustomThrowable { /* -------------------------------------------------- Message -------------------------------------------------- */ @Pure @Override public abstract @Nonnull String getMessage(); /* -------------------------------------------------- Cause -------------------------------------------------- */ @Pure @Override public @Nullable Throwable getCause() { return null; } }
/** * An internal exception indicates a condition that should never occur in a correct program. * A server might still want to catch internal exceptions in order to continue its operation. * * @see CaseException */ @Immutable public abstract class InternalException extends RuntimeException implements CustomThrowable { /* -------------------------------------------------- Message -------------------------------------------------- */ @Pure @Override public abstract @Nonnull String getMessage(); /* -------------------------------------------------- Cause -------------------------------------------------- */ @Pure @Override public @Nullable Throwable getCause() { return null; } }
@Immutable public abstract class DependencyError extends InitializationError {
@Immutable public abstract class CaseException extends InternalException {
@Immutable public abstract class InitializerError extends InitializationError {
@Immutable class UncheckedExceptionSubclass extends UncheckedException { /* -------------------------------------------------- Cause -------------------------------------------------- */ private final @Nonnull Exception cause; @Pure @Override public @Nonnull Exception getCause() { return cause; } /* -------------------------------------------------- Constructors -------------------------------------------------- */ UncheckedExceptionSubclass(@Nonnull Exception cause) { this.cause = cause; } }
@Immutable class IterationExceptionSubclass extends IterationException { /* -------------------------------------------------- Cause -------------------------------------------------- */ private final @Nonnull Exception cause; @Pure @Override public @Nonnull Exception getCause() { return cause; } /* -------------------------------------------------- Constructors -------------------------------------------------- */ IterationExceptionSubclass(@Nonnull Exception cause) { this.cause = cause; } }
@Immutable public interface Circumfix {
@Immutable public class ImportingTypeVisitor extends ProcessingUtility.QualifiedNameTypeVisitor {
/** * An asynchronous observer executes the notifications on a separate thread sequentially. */ @Immutable public static class AsynchronousObserver<OBSERVER extends Observer> implements Observer { private final static @Nonnull ThreadFactory threadFactory = NamedThreadFactory.with("Observer"); protected final @Nonnull ExecutorService executorService = Executors.newSingleThreadExecutor(threadFactory); protected final @Nonnull OBSERVER observer; protected AsynchronousObserver(@Captured @Modified @Nonnull OBSERVER observer) { this.observer = observer; } }
@Immutable public abstract class Option /* extends RootClass */ {