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.expression;

An evaluation exception indicating an expression failed to evaluate because the source value could not be coerced to the target class

Author(s):
Scott Andrews
public class ValueCoercionException extends EvaluationException {
	private transient Object value;
	private Class targetClass;

Creates a new property not found exception

Parameters:
contextClass the class of object upon which coercion was attempted
property the property that could not be coerced
value the value that could not be coerced
targetClass the class the value could not be coerced to
	public ValueCoercionException(Class contextClassString propertyObject valueClass targetClass) {
		this(contextClasspropertyvaluetargetClassnull);
		this. = value;
		this. = targetClass;
	}

Creates a new property not found exception

Parameters:
contextClass the class of object upon which coercion was attempted
property the property that could not be coerced
value the value that could not be coerced
targetClass the class the value could not be coerced to
cause root cause of the failure
	public ValueCoercionException(Class contextClassString propertyObject valueClass targetClassThrowable cause) {
		super(contextClassproperty"Value [" + value + "] could not be coerced to type [" + targetClass.getName()
"]"cause);
		this. = value;
		this. = targetClass;
	}

Returns:
the value that could not be coerced; this value is a transient field
	public Object getValue() {
		return ;
	}

Returns:
the class the value could not be coerced to
	public Class getTargetClass() {
		return ;
	}
New to GrepCode? Check out our FAQ X