info.hargrave.configuration.KeyException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of configurate Show documentation
Show all versions of configurate Show documentation
Configuration API that attempts to facilitate strongly-typed configuration
The newest version!
package info.hargrave.configuration;
/**
* Represents an exception occurring in relation to keys/values
* Date: 10/25/13
* Time: 8:49 AM
*/
public class KeyException extends Exception {
private final String exceptedKey;
private final Object exceptedValue;
/**
* Default constructor
* @param key key related to by the exception -- this is always required
* @param value value related to by the exception, can be null
* @param message message
*/
public KeyException(String message, String key, Object value){
super(message);
exceptedKey = key;
exceptedValue = value;
}
/**
* Instantiate the exception with a null (empty) value
* @param key key related to by the exception
* @param message message
*/
public KeyException(String message, String key){
this(message, key, null);
}
/**
* Get the key related to the exception
* @return key
*/
public String getKey(){
return exceptedKey;
}
/**
* Get the value related to the exception
* @return value
*/
public Object getValue(){
return exceptedValue;
}
/**
* Get whether or not there is a value related to the exception
* @return value
*/
public boolean hasValue(){
return exceptedValue != null;
}
}