本文整理匯總了Java中javax.el.ELException類的典型用法代碼示例。如果您正苦於以下問題:Java ELException類的具體用法?Java ELException怎麽用?Java ELException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ELException類屬於javax.el包,在下文中一共展示了ELException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getValue
import javax.el.ELException; //導入依賴的package包/類
public Object getValue(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
try {
return this.variableResolver.resolveVariable(property
.toString());
} catch (javax.servlet.jsp.el.ELException e) {
throw new ELException(e.getMessage(), e.getCause());
}
}
}
if (!context.isPropertyResolved()) {
return getDefaultResolver().getValue(context, base, property);
}
return null;
}
示例2: coerceToEnum
import javax.el.ELException; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public static final Enum<?> coerceToEnum(final Object obj,
@SuppressWarnings("rawtypes") Class type) {
if (obj == null || "".equals(obj)) {
return null;
}
if (type.isAssignableFrom(obj.getClass())) {
return (Enum<?>) obj;
}
if (!(obj instanceof String)) {
throw new ELException(MessageFactory.get("error.convert",
obj, obj.getClass(), type));
}
Enum<?> result;
try {
result = Enum.valueOf(type, (String) obj);
} catch (IllegalArgumentException iae) {
throw new ELException(MessageFactory.get("error.convert",
obj, obj.getClass(), type));
}
return result;
}
示例3: isReadOnly
import javax.el.ELException; //導入依賴的package包/類
@Override
public boolean isReadOnly(EvaluationContext ctx) throws ELException {
VariableMapper varMapper = ctx.getVariableMapper();
if (varMapper != null) {
ValueExpression expr = varMapper.resolveVariable(this.image);
if (expr != null) {
return expr.isReadOnly(ctx.getELContext());
}
}
ctx.setPropertyResolved(false);
boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image);
if (!ctx.isPropertyResolved()) {
throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled.null", this.image));
}
return result;
}
示例4: isReadOnly
import javax.el.ELException; //導入依賴的package包/類
@Override
public boolean isReadOnly(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null && property != null) {
int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
if (idx >= 0) {
context.setPropertyResolved(true);
return true;
}
}
return false;
}
示例5: getValue
import javax.el.ELException; //導入依賴的package包/類
@Override
public Object getValue(EvaluationContext ctx)
throws ELException {
Object obj = this.children[0].getValue(ctx);
if (obj == null) {
return Boolean.TRUE;
} else if (obj instanceof String) {
return Boolean.valueOf(((String) obj).length() == 0);
} else if (obj instanceof Object[]) {
return Boolean.valueOf(((Object[]) obj).length == 0);
} else if (obj instanceof Collection<?>) {
return Boolean.valueOf(((Collection<?>) obj).isEmpty());
} else if (obj instanceof Map<?,?>) {
return Boolean.valueOf(((Map<?,?>) obj).isEmpty());
}
return Boolean.FALSE;
}
示例6: setValue
import javax.el.ELException; //導入依賴的package包/類
@Override
public void setValue(EvaluationContext ctx, Object value)
throws ELException {
VariableMapper varMapper = ctx.getVariableMapper();
if (varMapper != null) {
ValueExpression expr = varMapper.resolveVariable(this.image);
if (expr != null) {
expr.setValue(ctx.getELContext(), value);
return;
}
}
ctx.setPropertyResolved(false);
ctx.getELResolver().setValue(ctx, null, this.image, value);
if (!ctx.isPropertyResolved()) {
throw new PropertyNotFoundException(MessageFactory.get(
"error.resolver.unhandled.null", this.image));
}
}
示例7: createMethodExpression
import javax.el.ELException; //導入依賴的package包/類
public MethodExpression createMethodExpression(Class<?> expectedReturnType,
Class<?>[] expectedParamTypes) throws ELException {
Node n = this.build();
if (!n.isParametersProvided() && expectedParamTypes == null) {
throw new NullPointerException(MessageFactory
.get("error.method.nullParms"));
}
if (n instanceof AstValue || n instanceof AstIdentifier) {
return new MethodExpressionImpl(expression, n, this.fnMapper,
this.varMapper, expectedReturnType, expectedParamTypes);
} else if (n instanceof AstLiteralExpression) {
return new MethodExpressionLiteral(expression, expectedReturnType,
expectedParamTypes);
} else {
throw new ELException("Not a Valid Method Expression: "
+ expression);
}
}
示例8: coerceToCharacter
import javax.el.ELException; //導入依賴的package包/類
public static final Character coerceToCharacter(final Object obj)
throws ELException {
if (obj == null || "".equals(obj)) {
return Character.valueOf((char) 0);
}
if (obj instanceof String) {
return Character.valueOf(((String) obj).charAt(0));
}
if (ELArithmetic.isNumber(obj)) {
return Character.valueOf((char) ((Number) obj).shortValue());
}
Class<?> objType = obj.getClass();
if (obj instanceof Character) {
return (Character) obj;
}
throw new ELException(MessageFactory.get("error.convert",
obj, objType, Character.class));
}
示例9: testJavaKeyWordIdentifier
import javax.el.ELException; //導入依賴的package包/類
@Test
public void testJavaKeyWordIdentifier() {
ExpressionFactory factory = ExpressionFactory.newInstance();
ELContext context = new ELContextImpl();
TesterBeanA beanA = new TesterBeanA();
beanA.setInt("five");
ValueExpression var =
factory.createValueExpression(beanA, TesterBeanA.class);
context.getVariableMapper().setVariable("this", var);
// Should fail
Exception e = null;
try {
factory.createValueExpression(context, "${this}", String.class);
} catch (ELException ele) {
e = ele;
}
assertNotNull(e);
}
示例10: ExpressionBuilder
import javax.el.ELException; //導入依賴的package包/類
/**
*
*/
public ExpressionBuilder(String expression, ELContext ctx)
throws ELException {
this.expression = expression;
FunctionMapper ctxFn = ctx.getFunctionMapper();
VariableMapper ctxVar = ctx.getVariableMapper();
if (ctxFn != null) {
this.fnMapper = new FunctionMapperFactory(ctxFn);
}
if (ctxVar != null) {
this.varMapper = new VariableMapperFactory(ctxVar);
}
}
示例11: getType
import javax.el.ELException; //導入依賴的package包/類
public Class<?> getType(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
try {
Object obj = this.variableResolver.resolveVariable(property
.toString());
return (obj != null) ? obj.getClass() : null;
} catch (javax.servlet.jsp.el.ELException e) {
throw new ELException(e.getMessage(), e.getCause());
}
}
}
if (!context.isPropertyResolved()) {
return getDefaultResolver().getType(context, base, property);
}
return null;
}
示例12: getType
import javax.el.ELException; //導入依賴的package包/類
@Override
public Class<?> getType(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
try {
Object obj = this.variableResolver.resolveVariable(property.toString());
return (obj != null) ? obj.getClass() : null;
} catch (javax.servlet.jsp.el.ELException e) {
throw new ELException(e.getMessage(), e.getCause());
}
}
}
if (!context.isPropertyResolved()) {
return elResolver.getType(context, base, property);
}
return null;
}
示例13: prepare
import javax.el.ELException; //導入依賴的package包/類
private void prepare(Node node) throws ELException {
try {
node.accept(this);
} catch (Exception e) {
if (e instanceof ELException) {
throw (ELException) e;
} else {
throw (new ELException(e));
}
}
if (this.fnMapper instanceof FunctionMapperFactory) {
this.fnMapper = ((FunctionMapperFactory) this.fnMapper).create();
}
if (this.varMapper instanceof VariableMapperFactory) {
this.varMapper = ((VariableMapperFactory) this.varMapper).create();
}
}
示例14: setValue
import javax.el.ELException; //導入依賴的package包/類
@Override
public void setValue(ELContext context, Object base, Object property,
Object value) throws NullPointerException,
PropertyNotFoundException, PropertyNotWritableException,
ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
String key = property.toString();
PageContext page = (PageContext) context
.getContext(JspContext.class);
int scope = page.getAttributesScope(key);
if (scope != 0) {
page.setAttribute(key, value, scope);
} else {
page.setAttribute(key, value);
}
}
}
}
示例15: getValue
import javax.el.ELException; //導入依賴的package包/類
@Override
public Object getValue(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
throw new NullPointerException();
}
if (base == null) {
context.setPropertyResolved(true);
if (property != null) {
String key = property.toString();
PageContext page = (PageContext) context
.getContext(JspContext.class);
return page.findAttribute(key);
}
}
return null;
}