Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2004-2008 the original author or authors.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  *      http://www.apache.org/licenses/LICENSE-2.0
  * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.binding.convert;
Thrown when an attempt to execute a type conversion fails.

Author(s):
Keith Donald
The value we tried to convert. Transient because we cannot guarantee that the value is Serializable.
	private transient Object value;

The source type we tried to convert the value from.
	private Class sourceClass;

The target type we tried to convert the value to.
	private Class targetClass;

Creates a new conversion exception.

Parameters:
value the value we tried to convert
sourceClass the value's original type
targetClass the value's target type
cause the cause of the conversion failure
	public ConversionExecutionException(Object valueClass sourceClassClass targetClassThrowable cause) {
		super(defaultMessage(valuesourceClasstargetClasscause), cause);
		this. = value;
		this. = sourceClass;
		this. = targetClass;
	}

Creates a new conversion exception.

Parameters:
value the value we tried to convert
sourceClass the value's original type
targetClass the value's target type
message a descriptive message of what went wrong.
	public ConversionExecutionException(Object valueClass sourceClassClass targetClassString message) {
		super(message);
		this. = value;
		this. = sourceClass;
		this. = targetClass;
	}

Returns the actual value we tried to convert, an instance of getSourceClass().
	public Object getValue() {
		return ;
	}

Returns the source type we tried to convert the value from.
	public Class getSourceClass() {
		return ;
	}

Returns the target type we tried to convert the value to.
	public Class getTargetClass() {
		return ;
	}
	private static String defaultMessage(Object valueClass sourceClassClass targetClassThrowable cause) {
		return "Unable to convert value " + StylerUtils.style(value) + " from type '" + sourceClass.getName()
"' to type '" + targetClass.getName() + "'; reason = '" + cause.getMessage() + "'";
	}
New to GrepCode? Check out our FAQ X