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 TypeMethodDescriptionvoidaddVerbMethod(VerbMethod verbMethod) Adds aVerbMethodto the mapping.Class<?>getClazz()Gets the controller class associated with this mapping.getSpecificVerbMethod(String verb) Retrieves theVerbMethodfor a specific HTTP verb.Gets the set of verb-specific methods.voidSets the controller class associated with this mapping.voidsetVerbMethods(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 theVerbMethodfor 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 aVerbMethodto 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
VerbMethodinstances
-
setVerbMethods
Sets the set of verb-specific methods.- Parameters:
verbMethods- the set ofVerbMethodinstances to set
-