Class ParamUtils

java.lang.Object
com.aoapps.taglib.ParamUtils

public final class ParamUtils extends Object
Helper utility for handling parameter values.
Author:
AO Industries, Inc.
  • Field Details

    • PARAM_ATTRIBUTE_PREFIX

      public static final String PARAM_ATTRIBUTE_PREFIX
      The prefix for param.* dynamic attributes.
      See Also:
  • Method Details

    • addParam

      public static void addParam(String fromTagName, JspTag from, String name, Object value) throws JspTagException
      Adds one parameter to the first parent of the given tag that implements ParamsAttribute. If value is null, the parameter is not added.

      The conversion to string may be deferred, or the value may be streamed instead of being converted to a string. It is incorrect to change the state of the provided value; doing so may or may not affect the value of the resulting parameter.

      Parameters:
      fromTagName - the name of the tag searching from
      from - the tag to search from
      name - the name of the parameter (required)
      value - the value of the parameter
      Throws:
      JspTagException
      See Also:
    • addParam

      public static void addParam(ParamsAttribute paramsAttribute, String name, Object value)
      Adds one parameter to the given ParamsAttribute parent tag. If value is null, the parameter is not added.

      The conversion to string may be deferred, or the value may be streamed instead of being converted to a string. It is incorrect to change the state of the provided value; doing so may or may not affect the value of the resulting parameter.

      Parameters:
      paramsAttribute - the parent tag that will receive the parameters
      name - the name of the parameter (required)
      value - the value of the parameter
    • addIterableParams

      public static void addIterableParams(ParamsAttribute paramsAttribute, String name, Iterable<?> values)
      Adds a set of parameters to the given ParamsAttribute parent tag. If value is null, no parameters are added. If any element is null, the parameter is not added for the element.

      The conversion to string may be deferred, or the value may be streamed instead of being converted to a string. It is incorrect to change the state of the provided value; doing so may or may not affect the value of the resulting parameter.

      Parameters:
      paramsAttribute - the parent tag that will receive the parameters
      name - the name of the parameter (required)
    • addIteratorParams

      public static void addIteratorParams(ParamsAttribute paramsAttribute, String name, Iterator<?> values)
      Adds a set of parameters to the given ParamsAttribute parent tag. If value is null, no parameters are added. If any element is null, the parameter is not added for the element.

      The conversion to string may be deferred, or the value may be streamed instead of being converted to a string. It is incorrect to change the state of the provided value; doing so may or may not affect the value of the resulting parameter.

      Parameters:
      paramsAttribute - the parent tag that will receive the parameters
      name - the name of the parameter (required)
    • addEnumerationParams

      public static void addEnumerationParams(ParamsAttribute paramsAttribute, String name, Enumeration<?> values) throws JspTagException
      Adds a set of parameters to the given ParamsAttribute parent tag. If value is null, no parameters are added. If any element is null, the parameter is not added for the element.

      The conversion to string may be deferred, or the value may be streamed instead of being converted to a string. It is incorrect to change the state of the provided value; doing so may or may not affect the value of the resulting parameter.

      Parameters:
      paramsAttribute - the parent tag that will receive the parameters
      name - the name of the parameter (required)
      Throws:
      JspTagException
    • addArrayParams

      public static void addArrayParams(ParamsAttribute paramsAttribute, String name, Object values) throws JspTagException
      Adds an array of parameters to the given ParamsAttribute parent tag. If value is null, no parameters are added. If any element is null, the parameter is not added for the element.

      The conversion to string may be deferred, or the value may be streamed instead of being converted to a string. It is incorrect to change the state of the provided value; doing so may or may not affect the value of the resulting parameter.

      Parameters:
      paramsAttribute - the parent tag that will receive the parameters
      name - the name of the parameter (required)
      Throws:
      JspTagException
    • addDynamicAttribute

      public static boolean addDynamicAttribute(String uri, String localName, Object value, List<String> expectedPatterns, ParamsAttribute paramsAttribute) throws JspTagException
      Adds the param.* dynamic attributes. Handles Iterable, Iterator, Enumeration, arrays, and direct coercion.

      The conversion to string may be deferred, or the value may be streamed instead of being converted to a string. It is incorrect to change the state of the provided value; doing so may or may not affect the value of the resulting parameter.

      Returns:
      true when added, or false when attribute not expected and has not been added.
      Throws:
      JspTagException
      See Also: