Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DeviceValidationException extends RuntimeException {
- static String DEFAULT_TEXT = "Device is not valid";
- DeviceValidationException(){
- this(DEFAULT_TEXT);
- }
- DeviceValidationException(String text){
- super(text);
- }
- DeviceValidationException(String text, Device object){
- this(getText(text, object));
- }
- private static String getText(String text, Device object) {
- if(!object.isValid()) {
- return String.valueOf(object) + " not valid. " + text;
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement