Class ResourceDescriptorValidator
java.lang.Object
org.exoplatform.services.rest.impl.resource.ResourceDescriptorValidator
- All Implemented Interfaces:
ResourceDescriptorVisitor
Validate ResourceDescriptors. @see
ResourceDescriptor.accept(ResourceDescriptorVisitor).
Validation Goals:
- check number of method parameters without annotation, should be not more then one at resource method or sub-resource method and no one at sub-resource locator
- if one of parameters at resource method or sub-resource method has
FormParamannotation then entity type can be only MultivalueMap<String, String> and nothing other -
PathValue.getPath()can't return empty string, it minds for root resource classes, sub-resource methods and sub-resource locators can't have annotation @Path("") - Resource class must contains at least one resource method, sub-resource method or sub-resource locator
Non-Goals:
- Check does any two resource methods has the same consume and produce media type. This will be done later in binding cycle
- Check does any two sub-resource methods has the same consume and produce media type and HTTP request method designation. This will be done later in binding cycle
- Check does two sub-resource locators has the same UriPattern
- Version:
- $Id: $
- Author:
- Andrey Parfonov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckObjectModel(ObjectModel model) static ResourceDescriptorValidatorvoidValidate AbstractResourceDescriptor.voidvoidvoidvoidvoidValidate ResourceMethodDescriptor.voidValidate SubResourceLocatorDescriptor.voidValidate SubResourceMethodDescriptor.
-
Constructor Details
-
ResourceDescriptorValidator
public ResourceDescriptorValidator()
-
-
Method Details
-
getInstance
- Returns:
- singleton instance of ResourceDescriptorVisitor
-
visitAbstractResourceDescriptor
Validate AbstractResourceDescriptor. AbstractResourceDescriptor is a class which annotated with path annotation then it is root resource, or not annotated with path then it is sub-resource. Can have also consumes and produces annotation. Path annotation is required for root resource.- Specified by:
visitAbstractResourceDescriptorin interfaceResourceDescriptorVisitor- Parameters:
ard- SeeAbstractResourceDescriptor
-
visitResourceMethodDescriptor
Validate ResourceMethodDescriptor. ResourceMethodDescriptor is method in Resource class which has not path annotation. This method MUST have at least one annotation (HTTP method, e.g. GET).- Specified by:
visitResourceMethodDescriptorin interfaceResourceDescriptorVisitor- Parameters:
rmd- SeeResourceMethodDescriptor
-
visitSubResourceLocatorDescriptor
Validate SubResourceLocatorDescriptor. SubResourceLocatorDescriptor is a method which annotated with path annotation and has not HTTP method annotation. This method can not directly process the request but it can produces object that will handle the request.- Specified by:
visitSubResourceLocatorDescriptorin interfaceResourceDescriptorVisitor- Parameters:
srld- SeeSubResourceLocatorDescriptor
-
visitSubResourceMethodDescriptor
Validate SubResourceMethodDescriptor. SubResourceMethodDescriptor is a method which annotated with path annotation and has HTTP method annotation. This method can process the request directly.- Specified by:
visitSubResourceMethodDescriptorin interfaceResourceDescriptorVisitor- Parameters:
srmd- SeeSubResourceMethodDescriptor
-
visitConstructorInjector
- Specified by:
visitConstructorInjectorin interfaceResourceDescriptorVisitor- Parameters:
ci- ConstructorInjector
-
visitFieldInjector
- Specified by:
visitFieldInjectorin interfaceResourceDescriptorVisitor- Parameters:
fi- FieldInjector
-
visitFilterDescriptor
- Specified by:
visitFilterDescriptorin interfaceResourceDescriptorVisitor- Parameters:
fd- FilterDescriptor
-
visitProviderDescriptor
- Specified by:
visitProviderDescriptorin interfaceResourceDescriptorVisitor- Parameters:
pd- ProviderDescriptor
-
checkObjectModel
-