Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public class DeviceValidationException extends RuntimeException {
  2.  
  3. static String DEFAULT_TEXT = "Device is not valid";
  4.  
  5. DeviceValidationException(){
  6. this(DEFAULT_TEXT);
  7. }
  8. DeviceValidationException(String text){
  9. super(text);
  10. }
  11. DeviceValidationException(String text, Device object){
  12. this(getText(text, object));
  13. }
  14.  
  15. private static String getText(String text, Device object) {
  16. if(!object.isValid()) {
  17. return String.valueOf(object) + " not valid. " + text;
  18. }
  19. return text;
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement