public class SoapstoneServiceBuilder
extends java.lang.Object
SoapstoneService
This requires a map of URL paths to WebServiceClass. Optionally it can also be provided with an
ExceptionMapper to map exceptions to WebApplicationException and a vendor name, for use
in custom headers.
| Constructor and Description |
|---|
SoapstoneServiceBuilder(java.util.Map<java.lang.String,WebServiceClass<?>> pathToWebServiceClassMap)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
SoapstoneService |
build()
Builds the
SoapstoneService. |
SoapstoneServiceBuilder |
withDocumentationProvider(DocumentationProvider documentationProvider)
Provide a
DocumentationProvider for extracting documentation for use in Open API documents |
SoapstoneServiceBuilder |
withExceptionMapper(ExceptionMapper exceptionMapper)
Provide an
ExceptionMapper to map exceptions caught during operation invocation to
WebApplicationException |
SoapstoneServiceBuilder |
withObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Provide an
ObjectMapper for mapping java objects to JSON and vice versa |
SoapstoneServiceBuilder |
withSupportedDeleteOperations(java.lang.String... regex)
Provide a list of regular expressions for operation names which should be supported as DELETE methods
|
SoapstoneServiceBuilder |
withSupportedGetOperations(java.lang.String... regex)
Provide a list of regular expressions for operation names which should be supported as GET methods
|
SoapstoneServiceBuilder |
withSupportedPutOperations(java.lang.String... regex)
Provide a list of regular expressions for operation names which should be supported as PUT methods
|
SoapstoneServiceBuilder |
withTagProvider(java.util.function.Function<java.lang.String,java.lang.String> tagProvider)
Provide a function for assigning tags to web service operations based on path.
|
SoapstoneServiceBuilder |
withTypeNameProvider(java.util.function.Function<java.lang.Class<?>,java.lang.String> typeNameProvider)
Provide a function for assigning display names to types when generating schemas in Open API documents.
|
SoapstoneServiceBuilder |
withVendor(java.lang.String vendor)
Provide a vendor name
|
public SoapstoneServiceBuilder(java.util.Map<java.lang.String,WebServiceClass<?>> pathToWebServiceClassMap)
Requires a map of URL paths to WebServiceClass. See WebServiceClass.forClass(Class, Supplier).
pathToWebServiceClassMap - map of paths to web service classespublic SoapstoneServiceBuilder withObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
ObjectMapper for mapping java objects to JSON and vice versa
This is optional. If not specified then a default mapper will be used which registers
the com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule and sets
DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES
to false.
objectMapper - provided mapperpublic SoapstoneServiceBuilder withExceptionMapper(ExceptionMapper exceptionMapper)
ExceptionMapper to map exceptions caught during operation invocation to
WebApplicationException
This is optional. If not specified then all invocation errors will be mapped to internal server errors (HTTP code 500).
exceptionMapper - provided mapperpublic SoapstoneServiceBuilder withVendor(java.lang.String vendor)
This will be used wherever the vendor would, by convention be used, e.g. for custom headers:
X-Vendor-Header
This is optional and will default to 'Soapstone'.
vendor - vendor namepublic SoapstoneServiceBuilder withSupportedGetOperations(java.lang.String... regex)
Optional. All expressions will be treated as case-insensitive.
regex - regular expressions for matching operation namespublic SoapstoneServiceBuilder withSupportedDeleteOperations(java.lang.String... regex)
Optional. All expressions will be treated as case-insensitive.
regex - regular expressions for matching operation namespublic SoapstoneServiceBuilder withSupportedPutOperations(java.lang.String... regex)
Optional. All expressions will be treated as case-insensitive.
regex - regular expressions for matching operation namespublic SoapstoneServiceBuilder withDocumentationProvider(DocumentationProvider documentationProvider)
DocumentationProvider for extracting documentation for use in Open API documents
Use the DocumentationProviderBuilder to construct the provider.
This is optional. If not provided, no documentation will be added to Open API documents produced.
documentationProvider - documentation providerpublic SoapstoneServiceBuilder withTagProvider(java.util.function.Function<java.lang.String,java.lang.String> tagProvider)
The function should accept the path to a web service class (as provided in SoapstoneServiceBuilder(Map))
and return a tag as a string.
This is optional. If not provided, no tags will be added to Open API documents produced.
tagProvider - tag providerpublic SoapstoneServiceBuilder withTypeNameProvider(java.util.function.Function<java.lang.Class<?>,java.lang.String> typeNameProvider)
The default behaviour is to use the simple class name, which may result in clashes. Since the names are used as keys to identify the corresponding schemas, this in turn results in incorrect schemas being displayed. The names impact display only so it is safe to provide a custom name.
typeNameProvider - type name providerpublic SoapstoneService build()
SoapstoneService.SoapstoneService with the appropriate fields setCopyright © 2020 Alfa Financial Software Ltd. All rights reserved.