Class EndpointTemplate
java.lang.Object
edu.university.ecs.lab.common.models.enums.EndpointTemplate
Factory class for generating an endpoint template from annotations
-
Field Summary
Modifier and TypeFieldDescriptionprivate final HttpMethod
private final String
private final String
-
Constructor Summary
ConstructorDescriptionEndpointTemplate
(com.github.javaparser.ast.expr.AnnotationExpr requestMapping, com.github.javaparser.ast.expr.AnnotationExpr endpointMapping) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getPathFromAnnotation
(com.github.javaparser.ast.expr.AnnotationExpr ae, String url) Method to get endpoint path from annotationsprivate static HttpMethod
httpFromMapping
(String mapping) Method to get http method from mappingstatic String
Simplifies all path arguments to {?}.
-
Field Details
-
ENDPOINT_ANNOTATIONS
-
httpMethod
-
name
-
url
-
-
Constructor Details
-
EndpointTemplate
public EndpointTemplate(com.github.javaparser.ast.expr.AnnotationExpr requestMapping, com.github.javaparser.ast.expr.AnnotationExpr endpointMapping)
-
-
Method Details
-
httpFromMapping
Method to get http method from mapping- Parameters:
mapping
- mapping string for a given method- Returns:
- HttpMethod object of same method type
-
getPathFromAnnotation
public static String getPathFromAnnotation(com.github.javaparser.ast.expr.AnnotationExpr ae, String url) Method to get endpoint path from annotations- Parameters:
ae
- annotation expression from methodurl
- string formatted as a url- Returns:
- endpoint path/url from annotation expression
-
simplifyEndpointURL
Simplifies all path arguments to {?}.- Parameters:
url
- the endpoint URL- Returns:
- the simplified endpoint URL
-