1 16 package org.springframework.binding.convert; 17 18 import org.springframework.core.NestedRuntimeException; 19 20 24 public class ConversionException extends NestedRuntimeException { 25 26 29 private Object value; 30 31 34 private Class targetClass; 35 36 41 public ConversionException(Object value, Class targetClass) { 42 super("Unable to convert value '" + value + "' of type '" + (value != null ? value.getClass().getName() : null) 43 + "' to class '" + targetClass.getName() + "'"); 44 this.value = value; 45 this.targetClass = targetClass; 46 } 47 48 54 public ConversionException(Object value, Class targetClass, Throwable cause) { 55 super("Unable to convert value '" + value + "' of type '" + (value != null ? value.getClass().getName() : null) 56 + "' to class '" + targetClass.getName() + "'", cause); 57 this.value = value; 58 this.targetClass = targetClass; 59 } 60 61 68 public ConversionException(Object value, Class targetClass, Throwable cause, String message) { 69 super(message, cause); 70 this.value = value; 71 this.targetClass = targetClass; 72 } 73 74 78 public Object getValue() { 79 return value; 80 } 81 82 85 public Class getTargetClass() { 86 return targetClass; 87 } 88 } | Popular Tags |