javax.el.PropertyNotFoundException类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中javax.el.PropertyNotFoundException类的一些代码示例,展示了PropertyNotFoundException类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PropertyNotFoundException类的具体详情如下:
包路径:javax.el.PropertyNotFoundException
类名称:PropertyNotFoundException

PropertyNotFoundException介绍

[英]Thrown when a property could not be found while evaluating a ValueExpression or MethodExpression.

For example, this could be triggered by an index out of bounds while setting an array value, or by an unreadable property while getting the value of a JavaBeans property.
[中]在计算ValueExpression或MethodExpression时找不到属性时引发。
例如,设置数组值时索引超出边界,或获取JavaBeans属性值时无法读取的属性,都可能会触发这种情况。

代码示例

代码示例来源:origin: javax.el/javax.el-api

context.setPropertyResolved(base, property);
if (isReadOnly) {
  throw new PropertyNotWritableException();
  throw new PropertyNotFoundException();

代码示例来源:origin: org.apache.shale/shale-test

/**
 * <p>Set the value of a scoped object for the specified name.</p>
 *
 * @param context <code>ELContext</code> for evaluating this value
 * @param base Base object against which this evaluation occurs
 *  (must be null because we are evaluating a top level variable)
 * @param property Property name to be accessed
 * @param value New value to be set
 */
public void setValue(ELContext context, Object base, Object property, Object value) {
  if (base != null) {
    return;
  }
  if (property == null) {
    throw new PropertyNotFoundException("No property specified");
  }
  FacesContext fcontext = (FacesContext) context.getContext(FacesContext.class);
  ResourceBundle bundle =
   fcontext.getApplication().getResourceBundle(fcontext, property.toString());
  if (bundle != null) {
    context.setPropertyResolved(true);
    throw new PropertyNotWritableException(property.toString());
  }
}

代码示例来源:origin: com.sun.facelets/jsf-facelets

public boolean isReadOnly(ELContext context, Object base,
    Object property) {
  if (property == null) {
    return true;
  }
  try {
    context.setPropertyResolved(true);
    if (base == null) {
      return false; // what can I do?
    } else {
      if (base instanceof List || base.getClass().isArray()) {
        return this.getPropertyResolver().isReadOnly(base,
            Integer.parseInt(property.toString()));
      } else {
        return this.getPropertyResolver().isReadOnly(base,
            property);
      }
    }
  } catch (PropertyNotFoundException e) {
    throw new javax.el.PropertyNotFoundException(e.getMessage(), e
        .getCause());
  } catch (EvaluationException e) {
    throw new ELException(e.getMessage(), e.getCause());
  }
}

代码示例来源:origin: de.odysseus.juel/juel-impl

@Override 
public Object eval(Bindings bindings, ELContext context) {
  ValueExpression expression = bindings.getVariable(index);
  if (expression != null) {
    return expression.getValue(context);
  }
  context.setPropertyResolved(false);
  Object result = context.getELResolver().getValue(context, null, name);
  if (!context.isPropertyResolved()) {
    throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
  }
  return result;
}

代码示例来源:origin: com.sun.faces/jsf-impl

public Object getValue(FacesContext context) throws EvaluationException,
    PropertyNotFoundException {
  ELContext ctx = context.getELContext();
  try {
    return this.delegate.getValue(ctx);
  } catch (javax.el.PropertyNotFoundException e) {
    throw new PropertyNotFoundException(e.getMessage(), e.getCause());
  } catch (ELException e) {
    throw new EvaluationException(e.getMessage(), e.getCause());
  }
}

代码示例来源:origin: beckchr/juel

public void setValue(Bindings bindings, ELContext context, Object value) throws ELException {
  if (!lvalue) {
    throw new ELException(LocalMessages.get("error.value.set.rvalue", getStructuralId(bindings)));
  }
  Object base = prefix.eval(bindings, context);
  if (base == null) {
    throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix));
  }
  Object property = getProperty(bindings, context);
  if (property == null && strict) {
    throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", "null", base));
  }
  context.setPropertyResolved(false);
  Class<?> type = context.getELResolver().getType(context, base, property);
  if (context.isPropertyResolved()) {
    if (type != null && (value != null || type.isPrimitive())) {
      value = bindings.convert(value, type);
    }
    context.setPropertyResolved(false);
  }
  context.getELResolver().setValue(context, base, property, value);
  if (!context.isPropertyResolved()) {
    throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", property, base));
  }
}

代码示例来源:origin: de.odysseus.juel/juel-impl

public Class<?> getType(Bindings bindings, ELContext context) {
  ValueExpression expression = bindings.getVariable(index);
  if (expression != null) {
    return expression.getType(context);
  }
  context.setPropertyResolved(false);
  Class<?> result = context.getELResolver().getType(context, null, name);
  if (!context.isPropertyResolved()) {
    throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
  }
  return result;
}

代码示例来源:origin: de.odysseus.juel/juel-impl

public boolean isReadOnly(Bindings bindings, ELContext context) {
  ValueExpression expression = bindings.getVariable(index);
  if (expression != null) {
    return expression.isReadOnly(context);
  }
  context.setPropertyResolved(false);
  boolean result = context.getELResolver().isReadOnly(context, null, name);
  if (!context.isPropertyResolved()) {
    throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
  }
  return result;
}

代码示例来源:origin: com.github.albfernandez.richfaces/richfaces-a4j

@Override
public Object getValue(FacesContext context) throws ELException {
  try {
    return expression.getValue(context.getELContext());
  } catch (javax.el.PropertyNotFoundException e) {
    throw new PropertyNotFoundException(e);
  } catch (ELException e) {
    throw new ELException(e);
  }
}

代码示例来源:origin: com.sun.faces/jsf-impl

public Class getType(FacesContext context) throws EvaluationException,
    PropertyNotFoundException {
  ELContext ctx = context.getELContext();
  try {
    return this.delegate.getType(ctx);
  } catch (javax.el.PropertyNotFoundException e) {
    throw new PropertyNotFoundException(e.getMessage(), e.getCause());
  } catch (ELException e) {
    throw new EvaluationException(e.getMessage(), e.getCause());
  }
}

代码示例来源:origin: com.sun.faces/jsf-impl

public boolean isReadOnly(FacesContext context) throws EvaluationException,
    PropertyNotFoundException {
  ELContext ctx = context.getELContext();
  try {
    return this.delegate.isReadOnly(ctx);
  } catch (javax.el.PropertyNotFoundException e) {
    throw new PropertyNotFoundException(e.getMessage(), e.getCause());
  } catch (ELException e) {
    throw new EvaluationException(e.getMessage(), e.getCause());
  }
}

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-el

@Override
public Class<?> getType(ELContext context, Object base, Object property) {
  Objects.requireNonNull(context);
  if (base instanceof List<?>) {
    context.setPropertyResolved(base, property);
    List<?> list = (List<?>) base;
    int idx = coerce(property);
    if (idx < 0 || idx >= list.size()) {
      throw new PropertyNotFoundException(
          new ArrayIndexOutOfBoundsException(idx).getMessage());
    }
    return Object.class;
  }
  return null;
}

代码示例来源:origin: jboss.web/jbossweb

public Object getValue(EvaluationContext ctx) throws ELException {
  VariableMapper varMapper = ctx.getVariableMapper();
  if (varMapper != null) {
    ValueExpression expr = varMapper.resolveVariable(this.image);
    if (expr != null) {
      return expr.getValue(ctx.getELContext());
    }
  }
  ctx.setPropertyResolved(false);
  Object result = ctx.getELResolver().getValue(ctx, null, this.image);
  if (ctx.isPropertyResolved()) {
    return result;
  } else {
    throw new PropertyNotFoundException("Could not resolve property '" + this.image + "'");
  }
}

代码示例来源:origin: org.apache.tomcat.embed/tomcat-embed-el

@Override
public void setValue(ELContext context, Object base, Object property,
    Object value) {
  Objects.requireNonNull(context);
  if (base instanceof List<?>) {
    context.setPropertyResolved(base, property);
    @SuppressWarnings("unchecked") // Must be OK to cast to Object
    List<Object> list = (List<Object>) base;
    if (this.readOnly) {
      throw new PropertyNotWritableException(Util.message(context,
          "resolverNotWriteable", base.getClass().getName()));
    }
    int idx = coerce(property);
    try {
      list.set(idx, value);
    } catch (UnsupportedOperationException e) {
      throw new PropertyNotWritableException(e);
    } catch (IndexOutOfBoundsException e) {
      throw new PropertyNotFoundException(e);
    }
  }
}

代码示例来源:origin: com.github.albfernandez.richfaces/richfaces-a4j

@Override
public void setValue(FacesContext context, Object value) throws ELException {
  try {
    expression.setValue(context.getELContext(), value);
  } catch (javax.el.PropertyNotFoundException e) {
    throw new PropertyNotFoundException(e);
  } catch (ELException e) {
    throw new ELException(e);
  }
}

代码示例来源:origin: javax.el/javax.el-api

context.setPropertyResolved(true);
int index = toInteger (property);
if (index < 0 || index >= Array.getLength(base)) {
  throw new PropertyNotFoundException();

代码示例来源:origin: com.sun.faces/jsf-impl

public void setValue(FacesContext context, Object value)
    throws EvaluationException, PropertyNotFoundException {
  ELContext ctx = context.getELContext();
  try {
    this.delegate.setValue(ctx, value);
  } catch (PropertyNotWritableException e) {
    throw new PropertyNotFoundException(e.getMessage(), e.getCause());
  } catch (javax.el.PropertyNotFoundException e) {
    throw new PropertyNotFoundException(e.getMessage(), e.getCause());
  } catch (ELException e) {
    throw new EvaluationException(e.getMessage(), e.getCause());
  }
}

代码示例来源:origin: com.github.albfernandez.richfaces/richfaces-a4j

@Override
public Class<?> getType(FacesContext context) throws ELException {
  try {
    return expression.getType(context.getELContext());
  } catch (javax.el.PropertyNotFoundException e) {
    throw new PropertyNotFoundException(e);
  } catch (ELException e) {
    throw new ELException(e);
  }
}

代码示例来源:origin: com.github.albfernandez.richfaces/richfaces-a4j

@Override
public boolean isReadOnly(FacesContext context) throws ELException {
  try {
    return expression.isReadOnly(context.getELContext());
  } catch (javax.el.PropertyNotFoundException e) {
    throw new PropertyNotFoundException(e);
  } catch (ELException e) {
    throw new ELException(e);
  }
}

代码示例来源:origin: javax.el/javax.el-api

context.setPropertyResolved(true);
List list = (List) base;
int index = toInteger(property);
if (index < 0 || index >= list.size()) {
  throw new PropertyNotFoundException();

相关文章