Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.springframework.binding.expression.el;
  
  import javax.el.ELContext;
  
A ValueExpression decorator that decorates a target ValueExpression returned by a EL Implementation's javax.el.ExpressionFactory to allow use of Spring's type conversion system for coersing expression values. The Unified EL specification currently provides no standard way of plugging in custom type converters. This decorator allows Spring type converters to be utilized with any EL implementation.

Author(s):
Keith Donald
 
 
 
 	private Class expectedType;
 
 
 	private boolean template;
 
 	public BindingValueExpression(ValueExpression targetExpressionClass expectedType,
 			ConversionService conversionServiceboolean template) {
 		Assert.notNull(expectedType"The expectedType Class is required");
 		Assert.notNull(conversionService"The ConversionService to perform type coersions is required");
 		this. = targetExpression;
 		this. = expectedType;
 		this. = conversionService;
 		this. = template;
 	}
 
 	public Class getExpectedType() {
 	}
 
 		return .getType(context);
 	}
 
 		Object value = .getValue(context);
 		return convertValueIfNecessary(valuecontext);
 	}
 
 		return .isReadOnly(context);
 	}
 
 	public void setValue(ELContext contextObject valuethrows NullPointerExceptionPropertyNotFoundException,
 		value = convertValueIfNecessary(value.getType(context), context);
 		.setValue(contextvalue);
 	}
 
 	public String getExpressionString() {
 		if () {
 		} else {
 			String rawExpressionString = .getExpressionString();
 			return rawExpressionString.substring("#{".length(), rawExpressionString.length() - 1);
 		}
 	}
 
 	public boolean isLiteralText() {
 	}
 
 	public boolean equals(Object obj) {
 		if (!(obj instanceof BindingValueExpression)) {
 			return false;
 		}
 		return .equals(exp.targetExpression);
 	}
 
 	public int hashCode() {
 	}
 
 	private Object convertValueIfNecessary(Object valueClass expectedTypeObject context)
 		if (expectedType == null) {
 			return value;
 		} else {
 			try {
 				return .executeConversion(valueexpectedType);
catch (ConversionException e) {
				throw new ValueCoercionException(context.getClass(), getExpressionString(), valueexpectedTypee);
			}
		}
	}
New to GrepCode? Check out our FAQ X