Class WebQueryPresetPlugin
java.lang.Object
com.peterphi.std.guice.restclient.jaxb.webquery.plugin.WebQueryPresetPlugin
- All Implemented Interfaces:
WebQueryDecodePlugin
Simple WebQuery Decode Plugin that allows named presets for queries. Example usage:
new WebQueryPresetPlugin("preset") .withAllowMultiple(false) // Allow multiple presets to be specified in a single query .withFailIfUnsupported(true) // Throw an exception if an unsupported preset is used (the default) .withOption("running", q -> q.eq("state", "QUEUED", "RUNNING", "PAUSED")) .withOption("important", q -> q.ge("priority", "10")) .withOption("terminated", q -> q.eq("state", "FAILED", "SUCCESS", "CANCELLED"))
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.peterphi.std.guice.restclient.jaxb.webquery.plugin.WebQueryDecodePlugin
WebQueryDecodePlugin.Builder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Called before the native WebQuery.decode handles the provided key.void
Called to request that the plugin add the appropriate constraints toquery
withAllowMultiple
(boolean value) withFailIfUnsupported
(boolean value) withOption
(String value, Consumer<WebQuery> handler) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.peterphi.std.guice.restclient.jaxb.webquery.plugin.WebQueryDecodePlugin
handles
-
Constructor Details
-
WebQueryPresetPlugin
-
-
Method Details
-
withFailIfUnsupported
-
withAllowMultiple
-
withOption
-
handles
Description copied from interface:WebQueryDecodePlugin
Called before the native WebQuery.decode handles the provided key. If this method returns true the plugin is responsible for decoding/processing the key. Simple convenience method so implementors do not need to implementWebQueryDecodePlugin.handles(String, List)
- Specified by:
handles
in interfaceWebQueryDecodePlugin
- Parameters:
key
- the query string key- Returns:
- true if this plugin should handle the named key
-
process
Description copied from interface:WebQueryDecodePlugin
Called to request that the plugin add the appropriate constraints toquery
- Specified by:
process
in interfaceWebQueryDecodePlugin
- Parameters:
query
- the WebQuery being constructedkey
- the key (which this object has previously indicated that itWebQueryDecodePlugin.handles(String)
)values
- the values provided at the query string
-