Package ubic.gemma.rest.util.args
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
- 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 aParameter
with the 'explode' attribute set toExplode.FALSE
, otherwise the serialization will not be correct.- Author:
- tesarst
-
-
Field Summary
Fields Modifier and Type Field Description static String
ARRAY_SCHEMA_COMPRESSION_DESCRIPTION
A description of the base64-gzip encoding to use in array schema descriptions in subclasses.static String
ARRAY_SCHEMA_DESCRIPTION_PREFIX
Prefix to use to describe the array schema in subclasses.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractArrayArg(List<T> values)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static <T extends AbstractArrayArg<?>>
TvalueOf(String arg, String ofWhat, Function<List<String>,T> func, boolean decompressArg)
Evaluate an input array argument.-
Methods inherited from class ubic.gemma.rest.util.args.AbstractArg
getValue, toString
-
-
-
-
Field Detail
-
ARRAY_SCHEMA_DESCRIPTION_PREFIX
public static final String ARRAY_SCHEMA_DESCRIPTION_PREFIX
Prefix to use to describe the array schema in subclasses.- See Also:
ArraySchema
, Constant Field Values
-
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:
ArraySchema
, Constant Field Values
-
-
Method Detail
-
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 processofWhat
- a description of what is expectedfunc
- a function to convert the resulting list of string to the specific array argumentdecompressArg
- decompress the argument as perArgUtils.decodeCompressedArg(String)
- Returns:
- trimmed strings exploded from the input.
- Throws:
MalformedArgException
- wrapping any raisedIllegalArgumentException
which may be caused by an empty string, an invalid base64-gzip encoded input or such an exception raised by the passed function
-
-