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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCalled before the native WebQuery.decode handles the provided key.voidCalled to request that the plugin add the appropriate constraints toquerywithAllowMultiple(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, waitMethods 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:WebQueryDecodePluginCalled 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:
handlesin interfaceWebQueryDecodePlugin- Parameters:
key- the query string key- Returns:
- true if this plugin should handle the named key
-
process
Description copied from interface:WebQueryDecodePluginCalled to request that the plugin add the appropriate constraints toquery- Specified by:
processin 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
-