package org.javafunk.funk;

import org.javafunk.funk.functors.functions.NullaryFunction;

import java.util.NoSuchElementException;

public class Exceptions {
    public static NullaryFunction<RuntimeException> runtimeFactory(final String message) {
        return new NullaryFunction<RuntimeException>() {
            @Override public RuntimeException call() {
                return new RuntimeException(message);
            }
        };
    }

    public static NullaryFunction<RuntimeException> runtimeFactory() {
        return new NullaryFunction<RuntimeException>() {
            @Override public RuntimeException call() {
                return new RuntimeException();
            }
        };
    }

    public static NullaryFunction<? extends RuntimeException> nullPointerFactory() {
        return new NullaryFunction<RuntimeException>() {
            @Override public RuntimeException call() {
                return new NullPointerException();
            }
        };
    }

    public static NullaryFunction<NullPointerException> nullPointerFactory(final String message) {
        return new NullaryFunction<NullPointerException>() {
            @Override public NullPointerException call() {
                return new NullPointerException(message);
            }
        };
    }

    public static NullaryFunction<IllegalArgumentException> illegalArgumentFactory(final String message) {
        return new NullaryFunction<IllegalArgumentException>() {
            @Override public IllegalArgumentException call() {
                return new IllegalArgumentException(message);
            }
        };
    }

    public static NullaryFunction<NoSuchElementException> noSuchElementFactory(final String message) {
        return new NullaryFunction<NoSuchElementException>() {
            @Override public NoSuchElementException call() {
                return new NoSuchElementException(message);
            }
        };
    }

    public static NullaryFunction<ArithmeticException> arithmeticFactory(final String message) {
        return new NullaryFunction<ArithmeticException>() {
            @Override public ArithmeticException call() {
                return new ArithmeticException(message);
            }
        };
    }
}

@@ -1,8 +1,263 @@
+/*%0A * Copyright (C) 2011-Present Funk committers.%0A * All rights reserved.%0A *%0A * The software in this package is published under the terms of the BSD%0A * style license a copy of which has been included with this distribution in%0A * the LICENSE.txt file.%0A */%0A
 package 

Add copyright preamble to Exceptions.