-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3345bf4
commit 6de4502
Showing
4 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
24 changes: 23 additions & 1 deletion
24
mvc/src/main/java/web/org/springframework/web/bind/annotation/RequestMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,27 @@ | ||
package web.org.springframework.web.bind.annotation; | ||
|
||
import java.util.Arrays; | ||
|
||
public enum RequestMethod { | ||
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE | ||
GET("GET"), | ||
HEAD("HEAD"), | ||
POST("POST"), | ||
PUT("PUT"), | ||
PATCH("PATCH"), | ||
DELETE("DELETE"), | ||
OPTIONS("OPTIONS"), | ||
TRACE("TRACE"); | ||
|
||
private final String methodName; | ||
|
||
RequestMethod(String methodName) { | ||
this.methodName = methodName; | ||
} | ||
|
||
public static RequestMethod from(String methodName) { | ||
return Arrays.stream(values()) | ||
.filter(method -> method.methodName.equals(methodName)) | ||
.findFirst() | ||
.orElseThrow(() -> new IllegalArgumentException("존재하지 않는 메소드입니다")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters