1 16 package org.springframework.binding.format; 17 18 import org.springframework.core.NestedRuntimeException; 19 20 25 public class InvalidFormatException extends NestedRuntimeException { 26 27 private String invalidValue; 28 29 private String expectedFormat; 30 31 public InvalidFormatException(String invalidValue, String expectedFormat) { 32 this(invalidValue, expectedFormat, (Throwable )null); 33 } 34 35 public InvalidFormatException(String invalidValue, String expectedFormat, Throwable cause) { 36 super("Invalid format for value " + invalidValue + "; the expected format was '" + expectedFormat + "'", cause); 37 this.invalidValue = invalidValue; 38 this.expectedFormat = expectedFormat; 39 } 40 41 public InvalidFormatException(String invalidValue, String expectedFormat, String message, Throwable cause) { 42 super(message, cause); 43 this.invalidValue = invalidValue; 44 this.expectedFormat = expectedFormat; 45 } 46 47 public String getInvalidValue() { 48 return invalidValue; 49 } 50 51 public String getExpectedFormat() { 52 return expectedFormat; 53 } 54 } | Popular Tags |