Package mg.emberframework.core.url
Class Mapping
java.lang.Object
mg.emberframework.core.url.Mapping
Represents a mapping of a URL to a set of HTTP verb-specific methods.
This class associates a controller class with a collection of VerbMethod
instances, each corresponding to an HTTP verb (e.g., GET, POST), and ensures no
duplicate verb mappings are added for the same URL.
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- Sandratra NIAINA
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addVerbMethod
(VerbMethod verbMethod) Adds aVerbMethod
to the mapping.Class<?>
getClazz()
Gets the controller class associated with this mapping.getSpecificVerbMethod
(String verb) Retrieves theVerbMethod
for a specific HTTP verb.Gets the set of verb-specific methods.void
Sets the controller class associated with this mapping.void
setVerbMethods
(Set<VerbMethod> verbMethods) Sets the set of verb-specific methods.
-
Constructor Details
-
Mapping
public Mapping()Default constructor. -
Mapping
Constructs a mapping with a specified controller class.- Parameters:
clazz
- the controller class
-
-
Method Details
-
getSpecificVerbMethod
Retrieves theVerbMethod
for a specific HTTP verb.- Parameters:
verb
- the HTTP verb (e.g., "GET", "POST")- Returns:
- the corresponding
VerbMethod
- Throws:
InvalidRequestException
- if no method is found for the specified verb
-
addVerbMethod
Adds aVerbMethod
to the mapping.- Parameters:
verbMethod
- the verb-specific method to add- Throws:
DuplicateUrlException
- if a method for the same verb already exists
-
getClazz
Gets the controller class associated with this mapping.- Returns:
- the controller class
-
setClazz
Sets the controller class associated with this mapping.- Parameters:
clazz
- the controller class to set
-
getVerbMethods
Gets the set of verb-specific methods.- Returns:
- the set of
VerbMethod
instances
-
setVerbMethods
Sets the set of verb-specific methods.- Parameters:
verbMethods
- the set ofVerbMethod
instances to set
-