Package org.restlet.engine.resource
Class MethodAnnotationInfo
- java.lang.Object
-
- org.restlet.engine.resource.AnnotationInfo
-
- org.restlet.engine.resource.MethodAnnotationInfo
-
public class MethodAnnotationInfo extends AnnotationInfo
Descriptor for method annotations.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringinputThe input part of the annotation value.private java.lang.StringoutputThe output part of the annotation value.private java.lang.StringqueryThe optional query part of the annotation value.private MethodrestletMethodThe matching Restlet method.-
Fields inherited from class org.restlet.engine.resource.AnnotationInfo
annotationValue, javaClass, javaMethod, javaMethodImpl
-
-
Constructor Summary
Constructors Constructor Description MethodAnnotationInfo(java.lang.Class<?> javaClass, Method restletMethod, java.lang.reflect.Method javaMethod, java.lang.String annotationValue)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)Indicates if the current object is equal to the given object.java.lang.StringgetInput()Returns the input part of the annotation value.private java.lang.Class<?>getJavaInputType(int index)Returns the generic type for the given input parameter.java.lang.Class<?>[]getJavaInputTypes()Returns the input types of the Java method.java.lang.Class<?>getJavaOutputType()Returns the output type of the Java method.java.lang.StringgetOutput()Returns the output part of the annotation value.java.lang.StringgetQuery()Returns the optional query part of the annotation value.java.util.List<Variant>getRequestVariants(MetadataService metadataService, ConverterService converterService)Returns a list of request variants based on the annotation value.java.util.List<Variant>getResponseVariants(MetadataService metadataService, ConverterService converterService)Returns a list of response variants based on the annotation value.MethodgetRestletMethod()Returns the matching Restlet method.private java.util.List<Variant>getVariants(MetadataService metadataService, java.lang.String annotationValue)Returns the list of representation variants associated to a given annotation value, corresponding to either an input or output entity.inthashCode()booleanisCompatible(Method restletMethod, Form queryParams, Representation requestEntity, MetadataService metadataService, ConverterService converterService)Indicates if the annotated method described is compatible with the given parameters.booleanisCompatibleRequestEntity(Representation requestEntity, MetadataService metadataService, ConverterService converterService)Indicates if the given request entity is compatible with the annotated method described.java.lang.StringtoString()-
Methods inherited from class org.restlet.engine.resource.AnnotationInfo
getAnnotationValue, getJavaActualType, getJavaActualType, getJavaActualType, getJavaClass, getJavaMethod, getTypeClass
-
-
-
-
Field Detail
-
input
private final java.lang.String input
The input part of the annotation value.
-
output
private final java.lang.String output
The output part of the annotation value.
-
query
private final java.lang.String query
The optional query part of the annotation value.
-
restletMethod
private final Method restletMethod
The matching Restlet method.
-
-
Constructor Detail
-
MethodAnnotationInfo
public MethodAnnotationInfo(java.lang.Class<?> javaClass, Method restletMethod, java.lang.reflect.Method javaMethod, java.lang.String annotationValue)Constructor.- Parameters:
javaClass- The class or interface that hosts the annotated Java method.restletMethod- The matching Restlet method.javaMethod- The annotated Java method.annotationValue- The annotation value.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object other)
Indicates if the current object is equal to the given object.- Overrides:
equalsin classAnnotationInfo- Parameters:
other- The other object.- Returns:
- True if the current object includes the other.
-
getInput
public java.lang.String getInput()
Returns the input part of the annotation value.- Returns:
- The input part of the annotation value.
-
getJavaInputType
private java.lang.Class<?> getJavaInputType(int index)
Returns the generic type for the given input parameter.- Parameters:
index- The input parameter index.- Returns:
- The generic type.
-
getJavaInputTypes
public java.lang.Class<?>[] getJavaInputTypes()
Returns the input types of the Java method.- Returns:
- The input types of the Java method.
-
getJavaOutputType
public java.lang.Class<?> getJavaOutputType()
Returns the output type of the Java method.- Returns:
- The output type of the Java method.
-
getOutput
public java.lang.String getOutput()
Returns the output part of the annotation value.- Returns:
- The output part of the annotation value.
-
getQuery
public java.lang.String getQuery()
Returns the optional query part of the annotation value.- Returns:
- The optional query part of the annotation value.
-
getRequestVariants
public java.util.List<Variant> getRequestVariants(MetadataService metadataService, ConverterService converterService) throws java.io.IOException
Returns a list of request variants based on the annotation value.- Parameters:
metadataService- The metadata service to use.- Returns:
- A list of request variants.
- Throws:
java.io.IOException
-
getResponseVariants
public java.util.List<Variant> getResponseVariants(MetadataService metadataService, ConverterService converterService) throws java.io.IOException
Returns a list of response variants based on the annotation value.- Parameters:
metadataService- The metadata service to use.converterService- The converter service to use.- Returns:
- A list of response variants.
- Throws:
java.io.IOException
-
getRestletMethod
public Method getRestletMethod()
Returns the matching Restlet method.- Returns:
- The matching Restlet method.
-
getVariants
private java.util.List<Variant> getVariants(MetadataService metadataService, java.lang.String annotationValue)
Returns the list of representation variants associated to a given annotation value, corresponding to either an input or output entity.- Parameters:
metadataService- The metadata service to use.annotationValue- The entity annotation value.- Returns:
- A list of variants.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAnnotationInfo
-
isCompatible
public boolean isCompatible(Method restletMethod, Form queryParams, Representation requestEntity, MetadataService metadataService, ConverterService converterService) throws java.io.IOException
Indicates if the annotated method described is compatible with the given parameters.- Parameters:
restletMethod- The Restlet method to match.requestEntity- Optional request entity.metadataService- The metadata service to use.converterService- The converter service to use.- Returns:
- True if the annotated method is compatible.
- Throws:
java.io.IOException
-
isCompatibleRequestEntity
public boolean isCompatibleRequestEntity(Representation requestEntity, MetadataService metadataService, ConverterService converterService) throws java.io.IOException
Indicates if the given request entity is compatible with the annotated method described.- Parameters:
requestEntity- Optional request entity.metadataService- The metadata service to use.converterService- The converter service to use.- Returns:
- True if the given request entity is compatible with the annotated method described.
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAnnotationInfo
-
-