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

personthecat.catlib.exception.InvalidEnumConstantException Maven / Gradle / Ivy

Go to download

Utilities for serialization, commands, noise generation, IO, and some new data types.

The newest version!
package personthecat.catlib.exception;

import java.util.Arrays;

import static personthecat.catlib.util.Shorthand.f;

public class InvalidEnumConstantException extends RuntimeException {
    public InvalidEnumConstantException(final String name, final Class> clazz) {
        super(createMessage(name, clazz));
    }

    private static String createMessage(final String name, final Class> clazz) {
        final String values = Arrays.toString(clazz.getEnumConstants());
        return f("{} \"{}\" does not exist. Valid options are: {}", clazz.getSimpleName(), name, values);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy