Annotation Interface Spec
- Author:
- Tomasz Kaczmarzyk, Matt S.Y. Ho
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]String[]The constant value designed for specification without related HTTP param.String[]The default value to use as a fallback when the request parameter is not provided or has an empty value.String[]String[]Please remember about adding required Maven dependenecy to your project before using jsonPaths.Attribute is used to specify behaviour on missing path variable.String[]HTTP query parameter name (or names) to be used for matching with entity attributes.charCharacter used to param delimitation.booleanAttribute determines that provided params value is in SpEL (Spring Expression Language) format.String[]booleanAttribute determines that constVal/defaultVal value is in SpEL (Spring Expression Language) format.
-
Element Details
-
path
String pathAttribute name (or more generally, path in the entity graph) to be filtered.
For example, consider a
Customerentity with fieldString firstName. If you want to filter customers by id, set@Spec.pathattribute to "id". -
spec
Class<? extends org.springframework.data.jpa.domain.Specification> specType of the filter to apply. This should be class that implementsSpecificationinterface. Use one of the built-in classes or implement your own. Built-in classes typically extendPathSpecificationand are described in README.md- See Also:
-
-
-
params
String[] paramsHTTP query parameter name (or names) to be used for matching with entity attributes.
For example, setting
paramsto "name" will mean that you expect?name=Valuein upcoming HTTP requests.If not set (and
headersandpathVarsare not used), then defaults to the same name as the filtered attribute of the entity (seepath).- Default:
- {}
-
paramSeparator
char paramSeparatorCharacter used to param delimitation. Param delimitation is skipped when separator has a 0 value.- Default:
- '\u0000'
-
pathVars
String[] pathVars- Default:
- {}
-
headers
String[] headers- Default:
- {}
-
jsonPaths
String[] jsonPathsPlease remember about adding required Maven dependenecy to your project before using jsonPaths. See README.md for details.- Default:
- {}
-
config
String[] config- Default:
- {}
-
constVal
String[] constValThe constant value designed for specification without related HTTP param. Const value can be a raw string or SpEL expression. SpEL expression requirevalueInSpELto be set totrueandSpecificationArgumentResolverto be properly with theAbstractApplicationContext, see README.md for details.Supplying
constVal()implicitly setsdefaultVal()to empty- Default:
- {}
-
defaultVal
String[] defaultValThe default value to use as a fallback when the request parameter is not provided or has an empty value. Default value can be a raw string or SpEL expression (could SpecificationArgumentResolver. SpEL expression requirevalueInSpELto be set totrueandSpecificationArgumentResolverto be properly with theAbstractApplicationContext, see README.md for details.Supplying
constVal()implicitly setsdefaultVal()to empty- Default:
- {}
-
valueInSpEL
boolean valueInSpELAttribute determines that constVal/defaultVal value is in SpEL (Spring Expression Language) format. Attribute is ignored when SpEL support is disabled, see README.md to get more information about enabling/disabling SpEL support.- Default:
- false
-
paramsInSpEL
boolean paramsInSpELAttribute determines that provided params value is in SpEL (Spring Expression Language) format. Attribute is ignored when SpEL support is disabled, see README.md to get more information about enabling/disabling SpEL support.- Default:
- false
-
onTypeMismatch
OnTypeMismatch onTypeMismatch- Default:
- EMPTY_RESULT
-
missingPathVarPolicy
MissingPathVarPolicy missingPathVarPolicyAttribute is used to specify behaviour on missing path variable. Missing param policy should be set to IGNORE when controller endpoint contains multiple paths with different path variables. For more details see README.md- Default:
- EXCEPTION
-