Class RestCallTemplate
java.lang.Object
edu.university.ecs.lab.common.models.enums.RestCallTemplate
Enum to represent Spring methodName and HttpMethod combinations and determine HttpMethod from
methodName.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final com.github.javaparser.ast.CompilationUnit
private final HttpMethod
private final com.github.javaparser.ast.expr.MethodCallExpr
private static final String
private final String
-
Constructor Summary
ConstructorDescriptionRestCallTemplate
(com.github.javaparser.ast.expr.MethodCallExpr mce, MethodCall mc, com.github.javaparser.ast.CompilationUnit cu) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
backupParseURL
(com.github.javaparser.ast.expr.Expression exp) Find the URL from the given expression.private static String
Shorten URLs to only endpoint querygetHttpFromName
(com.github.javaparser.ast.expr.MethodCallExpr mce) Find the RestTemplate by the method name.getHttpMethodForExchange
(String arguments) Get the HTTP method for the JSF exchange() method call.private String
parseFieldValue
(String fieldName) private String
parseURL
(com.github.javaparser.ast.expr.Expression exp) Find the URL from the given expression.private String
preParseURL
(com.github.javaparser.ast.expr.MethodCallExpr mce, MethodCall mc) static String
Simplifies all path arguments to {?}.
-
Field Details
-
REST_OBJECTS
-
REST_METHODS
-
UNKNOWN_VALUE
- See Also:
-
url
-
httpMethod
-
cu
private final com.github.javaparser.ast.CompilationUnit cu -
mce
private final com.github.javaparser.ast.expr.MethodCallExpr mce
-
-
Constructor Details
-
RestCallTemplate
public RestCallTemplate(com.github.javaparser.ast.expr.MethodCallExpr mce, MethodCall mc, com.github.javaparser.ast.CompilationUnit cu)
-
-
Method Details
-
getHttpFromName
Find the RestTemplate by the method name.- Parameters:
mce
- the method call- Returns:
- the RestTemplate found (null if not found)
-
getHttpMethodForExchange
Get the HTTP method for the JSF exchange() method call.- Parameters:
arguments
- the arguments of the exchange() method- Returns:
- the HTTP method extracted
-
parseURL
Find the URL from the given expression.- Parameters:
exp
- the expression to extract url from- Returns:
- the URL found
-
backupParseURL
Find the URL from the given expression.- Parameters:
exp
- the expression to extract url from- Returns:
- the URL found
-
cleanURL
Shorten URLs to only endpoint query- Parameters:
str
- full url- Returns:
- url query
-
parseFieldValue
-
preParseURL
-
simplifyEndpointURL
Simplifies all path arguments to {?}.- Parameters:
url
- the endpoint URL- Returns:
- the simplified endpoint URL
-