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
ConstructorsConstructorDescriptionAnnotationMappingDiscoverer(Class<? extends Annotation> annotation) Creates anAnnotationMappingDiscovererfor the given annotation type.AnnotationMappingDiscoverer(Class<? extends Annotation> annotation, String mappingAttributeName) Creates anAnnotationMappingDiscovererfor the given annotation type and attribute name. -
Method Summary
Modifier and TypeMethodDescriptiongetConsumes(Method method) Returns theMediaTypes supported for consumption.getMapping(Class<?> type) Returns the mapping associated with the given type.getMapping(Class<?> type, Method method) Returns the mapping for the givenMethodinvoked 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, waitMethods inherited from interface org.springframework.hateoas.server.core.MappingDiscoverer
getUriMapping, getUriMapping, getUriMapping
-
Constructor Details
-
AnnotationMappingDiscoverer
Creates anAnnotationMappingDiscovererfor the given annotation type. Will lookup thevalueattribute by default.- Parameters:
annotation- must not be null.
-
AnnotationMappingDiscoverer
public AnnotationMappingDiscoverer(Class<? extends Annotation> annotation, @Nullable String mappingAttributeName) Creates anAnnotationMappingDiscovererfor 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:MappingDiscovererReturns the mapping associated with the given type.- Specified by:
getMappingin interfaceMappingDiscoverer- Parameters:
type- must not be null.- Returns:
- the type-level mapping or null in case none is present.
-
getMapping
Description copied from interface:MappingDiscovererReturns the mapping associated with the givenMethod. This will include the type-level mapping.- Specified by:
getMappingin 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:MappingDiscovererReturns the mapping for the givenMethodinvoked 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:
getMappingin 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:
getRequestMethodin interfaceMappingDiscoverer- Parameters:
type-method-- Returns:
-
getConsumes
Description copied from interface:MappingDiscovererReturns theMediaTypes supported for consumption.- Specified by:
getConsumesin interfaceMappingDiscoverer- Parameters:
method- must not be null.- Returns:
- can be null.
-
getParams
Description copied from interface:MappingDiscovererReturns the statically declared request parameters.- Specified by:
getParamsin interfaceMappingDiscoverer- Parameters:
method- must not be null.- Returns:
- the parameters of the mapped request, narrowing the primary mapping.
-