Class AnnotationMappingDiscoverer
java.lang.Object
org.springframework.hateoas.server.core.AnnotationMappingDiscoverer
- All Implemented Interfaces:
MappingDiscoverer
MappingDiscoverer
implementation that inspects mappings from a particular annotation.- Author:
- Oliver Gierke, Mark Paluch, Greg Turnquist, RĂ©da Housni Alaoui
-
Constructor Summary
ConstructorDescriptionAnnotationMappingDiscoverer
(Class<? extends Annotation> annotation) Creates anAnnotationMappingDiscoverer
for the given annotation type.AnnotationMappingDiscoverer
(Class<? extends Annotation> annotation, String mappingAttributeName) Creates anAnnotationMappingDiscoverer
for the given annotation type and attribute name. -
Method Summary
Modifier and TypeMethodDescriptiongetConsumes
(Method method) Returns theMediaType
s supported for consumption.getMapping
(Class<?> type) Returns the mapping associated with the given type.getMapping
(Class<?> type, Method method) Returns the mapping for the givenMethod
invoked on the given type.getMapping
(Method method) Returns the mapping associated with the givenMethod
.String[]
Returns the statically declared request parameters.getRequestMethod
(Class<?> type, Method method) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.hateoas.server.core.MappingDiscoverer
getUriMapping, getUriMapping, getUriMapping
-
Constructor Details
-
AnnotationMappingDiscoverer
Creates anAnnotationMappingDiscoverer
for the given annotation type. Will lookup thevalue
attribute by default.- Parameters:
annotation
- must not be null.
-
AnnotationMappingDiscoverer
public AnnotationMappingDiscoverer(Class<? extends Annotation> annotation, @Nullable String mappingAttributeName) Creates anAnnotationMappingDiscoverer
for the given annotation type and attribute name.- Parameters:
annotation
- must not be null.mappingAttributeName
- if null, it defaults tovalue
.
-
-
Method Details
-
getMapping
Description copied from interface:MappingDiscoverer
Returns the mapping associated with the given type.- Specified by:
getMapping
in interfaceMappingDiscoverer
- Parameters:
type
- must not be null.- Returns:
- the type-level mapping or null in case none is present.
-
getMapping
Description copied from interface:MappingDiscoverer
Returns the mapping associated with the givenMethod
. This will include the type-level mapping.- Specified by:
getMapping
in interfaceMappingDiscoverer
- Parameters:
method
- must not be null.- Returns:
- the method mapping including the type-level one or null if neither of them present.
-
getMapping
Description copied from interface:MappingDiscoverer
Returns the mapping for the givenMethod
invoked on the given type. This can be used to calculate the mapping for a super type method being invoked on a sub-type with a type mapping.- Specified by:
getMapping
in interfaceMappingDiscoverer
- Parameters:
type
- must not be null.method
- must not be null.- Returns:
- the method mapping including the type-level one or null if neither of them present.
-
getRequestMethod
- Specified by:
getRequestMethod
in interfaceMappingDiscoverer
- Parameters:
type
-method
-- Returns:
-
getConsumes
Description copied from interface:MappingDiscoverer
Returns theMediaType
s supported for consumption.- Specified by:
getConsumes
in interfaceMappingDiscoverer
- Parameters:
method
- must not be null.- Returns:
- can be null.
-
getParams
Description copied from interface:MappingDiscoverer
Returns the statically declared request parameters.- Specified by:
getParams
in interfaceMappingDiscoverer
- Parameters:
method
- must not be null.- Returns:
- the parameters of the mapped request, narrowing the primary mapping.
-