Package mg.emberframework.core.data
Class VerbMethod
java.lang.Object
mg.emberframework.core.data.VerbMethod
Represents a method associated with an HTTP verb.
This class pairs a Method with its corresponding HTTP verb (e.g., GET, POST)
and provides utilities to validate requests and check for REST API status.
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- Sandratra NIAINA
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this object to another for equality based on the verb.Gets the method.getVerb()Gets the HTTP verb.inthashCode()Computes the hash code based on the verb.booleanisRequestValid(jakarta.servlet.http.HttpServletRequest request) Checks if the HTTP request matches the method's verb.booleanChecks if the method is annotated as a REST API endpoint.voidSets the method.voidSets the HTTP verb.
-
Constructor Details
-
VerbMethod
Constructs a verb-method pair.- Parameters:
method- the methodverb- the associated HTTP verb
-
-
Method Details
-
isRequestValid
public boolean isRequestValid(jakarta.servlet.http.HttpServletRequest request) Checks if the HTTP request matches the method's verb.- Parameters:
request- the HTTP request- Returns:
- true if the request method matches the verb, false otherwise
-
isRestAPI
public boolean isRestAPI()Checks if the method is annotated as a REST API endpoint.- Returns:
- true if annotated with
@RestApi, false otherwise
-
getMethod
Gets the method.- Returns:
- the method
-
setMethod
Sets the method.- Parameters:
method- the method to set
-
getVerb
Gets the HTTP verb.- Returns:
- the verb
-
setVerb
Sets the HTTP verb.- Parameters:
verb- the verb to set
-
equals
Compares this object to another for equality based on the verb. -
hashCode
public int hashCode()Computes the hash code based on the verb.
-