Package org.restlet.engine.resource
Class AnnotationUtils
java.lang.Object
org.restlet.engine.resource.AnnotationUtils
Utilities to manipulate Restlet annotations.
- Author:
- Jerome Louvel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the annotation descriptors cache.getAnnotations(Class<?> clazz) Returns the annotation descriptors for the given resource class.getAnnotations(Class<?> clazz, Method javaMethod) Returns the annotation descriptors for the given resource class.static AnnotationUtilsReturns the current instance of AnnotationUtils.getMethodAnnotation(List<AnnotationInfo> annotations, Method javaMethod) Returns the first annotation descriptor matching the given Java method.getMethodAnnotation(List<AnnotationInfo> annotations, Method restletMethod, Form query, Representation entity, MetadataService metadataService, ConverterService converterService) Returns the first annotation descriptor matching the given Restlet method.protected MethodgetRestletMethod(Annotation annotation, Annotation methodAnnotation) Returns an instance ofMethodaccording to the given annotations.getThrowableAnnotationInfo(Class<?> clazz) Returns the status annotation descriptor if present or null.getThrowableAnnotationInfo(Method javaMethod, int errorCode) Returns theThrowableclass matching the given error code if present or null.Class<?>getThrowableClass(Method javaMethod, int errorCode) Returns theThrowableclass matching the given error code if present or null.
-
Constructor Details
-
AnnotationUtils
protected AnnotationUtils()Protected constructor.
-
-
Method Details
-
getInstance
Returns the current instance of AnnotationUtils. -
clearCache
public void clearCache()Clears the annotation descriptors cache. -
getAnnotations
Returns the annotation descriptors for the given resource class.- Parameters:
clazz- The resource class to introspect.- Returns:
- The list of annotation descriptors.
-
getAnnotations
Returns the annotation descriptors for the given resource class.- Parameters:
javaMethod- The Java method.- Returns:
- The list of annotation descriptors.
-
getMethodAnnotation
public MethodAnnotationInfo getMethodAnnotation(List<AnnotationInfo> annotations, Method javaMethod) Returns the first annotation descriptor matching the given Java method.- Parameters:
annotations- The list of annotations.javaMethod- The method to match.- Returns:
- The annotation descriptor.
-
getMethodAnnotation
public MethodAnnotationInfo getMethodAnnotation(List<AnnotationInfo> annotations, Method restletMethod, Form query, Representation entity, MetadataService metadataService, ConverterService converterService) throws IOException Returns the first annotation descriptor matching the given Restlet method.- Parameters:
annotations- The list of annotations.restletMethod- The method to match.query- The query parameters.entity- The request entity to match or null if no entity is provided.metadataService- The metadata service to use.converterService- The converter service to use.- Returns:
- The annotation descriptor.
- Throws:
IOException
-
getRestletMethod
Returns an instance ofMethodaccording to the given annotations.- Parameters:
annotation- Java annotation.methodAnnotation- Annotation that corresponds to a Restlet method.- Returns:
- An instance of
Methodaccording to the given annotations.
-
getThrowableAnnotationInfo
Returns the status annotation descriptor if present or null.- Parameters:
clazz- The class with the status attached.- Returns:
- The status annotation descriptor if present or null.
-
getThrowableAnnotationInfo
Returns theThrowableclass matching the given error code if present or null. -
getThrowableClass
Returns theThrowableclass matching the given error code if present or null.
-