Package org.omnifaces.cdi

Examples of org.omnifaces.cdi.Param


  @Produces
  @Param
  public <V> ParamValue<V> produce(InjectionPoint injectionPoint) {

    // @Param is the annotation on the injection point that holds all data for this request parameter
    Param requestParameter = getQualifier(injectionPoint, Param.class);

    FacesContext context = FacesContext.getCurrentInstance();
    UIComponent component = context.getViewRoot();

    String label = getLabel(requestParameter, injectionPoint);

    // TODO: Save/restore existing potentially existing label?
    component.getAttributes().put("label", label);

    // Get raw submitted value from the request
    String submittedValue = getRequestParameter(context, getName(requestParameter, injectionPoint));
    Object convertedValue = null;
    boolean valid = true;

    try {

      // Convert the submitted value

      Converter converter = getConverter(requestParameter, getTargetType(injectionPoint));
      if (converter != null) {
        convertedValue = converter.getAsObject(context, component, submittedValue);
      } else {
        convertedValue = submittedValue;
      }

      // Check for required

      if (requestParameter.required() && isEmpty(convertedValue)) {
        addRequiredMessage(context, component, label, submittedValue, getRequiredMessage(requestParameter));
      }

      // Validate the converted value
View Full Code Here

TOP

Related Classes of org.omnifaces.cdi.Param

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.