コード例 #1
0
  public Class<?> getType(ELContext context, Object base, Object property) throws ELException {
    if (base != null) {
      return null;
    }
    if (property == null) {
      String message =
          MessageUtils.getExceptionMessageString(
              MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "property");
      throw new PropertyNotFoundException(message);
    }

    Integer index = IMPLICIT_OBJECTS.get(property.toString());

    if (index == null) {
      return null;
    }
    switch (index) {
      case FACES_CONTEXT:
      case VIEW:
        context.setPropertyResolved(true);
        return null;
      default:
        return null;
    }
  }
コード例 #2
0
 public boolean isReadOnly(ELContext context, Object base, Object property) throws ELException {
   if (base != null) {
     return false;
   }
   if (property == null) {
     String message =
         MessageUtils.getExceptionMessageString(
             MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "property");
     throw new PropertyNotFoundException(message);
   }
   // return value will be ignored unless context.propertyResolved is
   // set to true.
   Integer index = IMPLICIT_OBJECTS.get(property.toString());
   if (index == null) {
     return false;
   }
   switch (index) {
     case FACES_CONTEXT:
       context.setPropertyResolved(true);
       return true;
     case VIEW:
       context.setPropertyResolved(true);
       return true;
     default:
       return false;
   }
 }
コード例 #3
0
  public void setValue(ELContext context, Object base, Object property, Object val)
      throws ELException {
    if (base != null) {
      return;
    }
    if (property == null) {
      String message =
          MessageUtils.getExceptionMessageString(
              MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "property");
      throw new PropertyNotFoundException(message);
    }

    Integer index = IMPLICIT_OBJECTS.get(property.toString());
    if (index == null) {
      return;
    }
    switch (index) {
      case FACES_CONTEXT:
        throw new PropertyNotWritableException(
            MessageUtils.getExceptionMessageString(
                MessageUtils.OBJECT_IS_READONLY, "facesContext"));
      case VIEW:
        throw new PropertyNotWritableException(
            MessageUtils.getExceptionMessageString(MessageUtils.OBJECT_IS_READONLY, "view"));
      default:
    }
  }
コード例 #4
0
  public Object getValue(ELContext context, Object base, Object property) throws ELException {
    // variable resolution is a special case of property resolution
    // where the base is null.
    if (base != null) {
      return null;
    }
    if (property == null) {
      String message =
          MessageUtils.getExceptionMessageString(
              MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "property");
      throw new PropertyNotFoundException(message);
    }

    Integer index = IMPLICIT_OBJECTS.get(property.toString());

    if (index == null) {
      return null;
    }

    FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);

    switch (index.intValue()) {
      case FACES_CONTEXT:
        context.setPropertyResolved(true);
        return facesContext;
      case VIEW:
        context.setPropertyResolved(true);
        return facesContext.getViewRoot();
      case VIEW_SCOPE:
        context.setPropertyResolved(true);
        return facesContext.getViewRoot().getViewMap();
      case RESOURCE:
        context.setPropertyResolved(true);
        return facesContext.getApplication().getResourceHandler();
      default:
        return null;
    }
  }