Package org.modelmapper.spring.data
Class UriTemplateIdentifierProcessor
java.lang.Object
org.modelmapper.spring.data.UriTemplateIdentifierProcessor
- All Implemented Interfaces:
AggregateIdentifierProcessor,org.springframework.plugin.core.Plugin<Class<?>>
An
IdentifierProcessor that allows to register UriTemplates for aggregate types so that the model
mapping is able to extract the actual aggregate identifier from URIs.- Author:
- Oliver Drotbohm
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCollection<Class<?>>Returns additional identifier types that the processor will be able to handle.postProcessIdentifier(Object identifier, Class<?> sourceType, Class<?> targetType) Post process the identifier obtained from the aggregate to finally constitute the value to be set on the target object.preProcessIdentifier(Object identifier, Class<?> targetType) Pre-process the identifier obtained from the source object to finally resolve an aggregate from the returned value.Registers the given URI template for the given aggregate type.Registers the given URI template for the given aggregate type.Registers the givenUriTemplateand template variable name for the given aggregate type.boolean
-
Constructor Details
-
UriTemplateIdentifierProcessor
public UriTemplateIdentifierProcessor()
-
-
Method Details
-
register
Registers the given URI template for the given aggregate type. Assumes a single URI template parameter be in place.- Parameters:
type- must not be null.uriTemplate- must not be null or empty.- Returns:
- will never be null.
-
register
public UriTemplateIdentifierProcessor register(Class<?> type, org.springframework.web.util.UriTemplate template) Registers the given URI template for the given aggregate type. Assumes a single URI template parameter be in place.- Parameters:
type- must not be null.uriTemplate- must not be null.- Returns:
- will never be null.
-
register
public UriTemplateIdentifierProcessor register(Class<?> type, org.springframework.web.util.UriTemplate template, String variableName) Registers the givenUriTemplateand template variable name for the given aggregate type.- Parameters:
type- must not be null.template- must not be null.variableName- must not be null or empty.- Returns:
- will never be null.
-
preProcessIdentifier
Description copied from interface:AggregateIdentifierProcessorPre-process the identifier obtained from the source object to finally resolve an aggregate from the returned value.- Specified by:
preProcessIdentifierin interfaceAggregateIdentifierProcessor- Parameters:
identifier- the original identifier obtained from the source object. Must not be null.targetType- the target aggregate type the given identifier is supposed to eventually identify. Must not be null.- Returns:
- will never be null.
-
postProcessIdentifier
Description copied from interface:AggregateIdentifierProcessorPost process the identifier obtained from the aggregate to finally constitute the value to be set on the target object.- Specified by:
postProcessIdentifierin interfaceAggregateIdentifierProcessor- Parameters:
identifier- the original identifier of the aggregate to be transformed into the target object's property value. Must not be null.sourceType- the source aggregate type. Must not be null.targetType- the target type to create for this aggregate. Can be used to decide whether to actually apply post-processing.- Returns:
- will never be null.
-
getAdditionalIdentifierTypes
Description copied from interface:AggregateIdentifierProcessorReturns additional identifier types that the processor will be able to handle.- Specified by:
getAdditionalIdentifierTypesin interfaceAggregateIdentifierProcessor- Returns:
- will never be null.
-
supports
- Specified by:
supportsin interfaceorg.springframework.plugin.core.Plugin<Class<?>>
-