Class AbstractArrayArg<T>

java.lang.Object
ubic.gemma.rest.util.args.AbstractArg<List<T>>
ubic.gemma.rest.util.args.AbstractArrayArg<T>
Type Parameters:
T - the type of elements the array contains
All Implemented Interfaces:
Arg<List<T>>
Direct Known Subclasses:
AbstractEntityArrayArg, ExcludeArg, StringArrayArg

public abstract class AbstractArrayArg<T> extends AbstractArg<List<T>>
Represents a comma-delimited array API argument.

If you use this alongside a QueryParam, make sure that you include a Parameter with the 'explode' attribute set to Explode.FALSE, otherwise the serialization will not be correct.

Author:
tesarst
  • Field Details

    • ARRAY_SCHEMA_DESCRIPTION_PREFIX

      public static final String ARRAY_SCHEMA_DESCRIPTION_PREFIX
      Prefix to use to describe the array schema in subclasses.
      See Also:
    • ARRAY_SCHEMA_COMPRESSION_DESCRIPTION

      public static final String ARRAY_SCHEMA_COMPRESSION_DESCRIPTION
      A description of the base64-gzip encoding to use in array schema descriptions in subclasses.
      See Also:
  • Constructor Details

    • AbstractArrayArg

      protected AbstractArrayArg(List<T> values)
  • Method Details

    • valueOf

      protected static <T extends AbstractArrayArg<?>> T valueOf(String arg, String ofWhat, Function<List<String>,T> func, boolean decompressArg) throws MalformedArgException
      Evaluate an input array argument.

      Split a string by the ',' comma character and trim the resulting pieces.

      This is meant to be used for parsing query arguments that use a comma as a delimiter.

      Parameters:
      arg - the string to process
      ofWhat - a description of what is expected
      func - a function to convert the resulting list of string to the specific array argument
      decompressArg - decompress the argument as per ArgUtils.decodeCompressedArg(String)
      Returns:
      trimmed strings exploded from the input.
      Throws:
      MalformedArgException - wrapping any raised IllegalArgumentException which may be caused by an empty string, an invalid base64-gzip encoded input or such an exception raised by the passed function