-
Notifications
You must be signed in to change notification settings - Fork 302
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
da85750
commit 8334363
Showing
4 changed files
with
68 additions
and
61 deletions.
There are no files selected for viewing
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
14 changes: 14 additions & 0 deletions
14
mvc/src/main/java/web/org/springframework/web/bind/annotation/HandlerInstances.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package web.org.springframework.web.bind.annotation; | ||
|
||
import org.reflections.Reflections; | ||
|
||
public class HandlerInstances { | ||
|
||
private final Reflections reflections; | ||
|
||
public HandlerInstances(Object... basePackage) { | ||
this.reflections = new Reflections(basePackage); | ||
} | ||
|
||
|
||
} |
18 changes: 18 additions & 0 deletions
18
mvc/src/main/java/webmvc/org/springframework/web/servlet/mvc/tobe/AnnotationExtractor.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package webmvc.org.springframework.web.servlet.mvc.tobe; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Method; | ||
|
||
public class AnnotationExtractor { | ||
|
||
public static Object extractByMethodName(Annotation annotation, String methodName) { | ||
Class<? extends Annotation> annotationType = annotation.annotationType(); | ||
try { | ||
Method method = annotationType.getDeclaredMethod(methodName); | ||
return method.invoke(annotation); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
throw new RequestMappingPathNotProvidedException(); | ||
} | ||
} |
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