diff --git a/src/main/java/com/amigoscode/framework/annotations/Component.java b/src/main/java/com/amigoscode/framework/annotations/Component.java new file mode 100644 index 0000000..17dd682 --- /dev/null +++ b/src/main/java/com/amigoscode/framework/annotations/Component.java @@ -0,0 +1,15 @@ +package com.amigoscode.framework.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +// Marks a class as a managed component — equivalent to Spring's @Component. +// This is a generic stereotype annotation for any managed component that doesn't fit into more specific categories. +// The framework will automatically create an instance of this class and manage its lifecycle. +// Other classes can then have this component injected via @Autowired. +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Component { +} diff --git a/src/main/java/com/amigoscode/framework/annotations/GetMapping.java b/src/main/java/com/amigoscode/framework/annotations/GetMapping.java new file mode 100644 index 0000000..23b2dde --- /dev/null +++ b/src/main/java/com/amigoscode/framework/annotations/GetMapping.java @@ -0,0 +1,17 @@ +package com.amigoscode.framework.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +// Maps a method to an HTTP GET request — equivalent to Spring's @GetMapping. +// @Target(ElementType.METHOD) means this annotation can only be placed on methods. +// value() holds the URL path pattern, e.g. @GetMapping("/api/users"). +// It defaults to "" so a method can just say @GetMapping and inherit the whole path +// from the controller's @RequestMapping. +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface GetMapping { + String value() default ""; // The URL path this method handles, appended to the controller's base path +} diff --git a/src/main/java/com/amigoscode/framework/annotations/PostMapping.java b/src/main/java/com/amigoscode/framework/annotations/PostMapping.java new file mode 100644 index 0000000..13a7c8e --- /dev/null +++ b/src/main/java/com/amigoscode/framework/annotations/PostMapping.java @@ -0,0 +1,17 @@ +package com.amigoscode.framework.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +// Maps a method to an HTTP POST request — equivalent to Spring's @PostMapping. +// @Target(ElementType.METHOD) means this annotation can only be placed on methods. +// value() holds the URL path pattern, e.g. @PostMapping("/api/users"). +// It defaults to "" so a method can just say @PostMapping and inherit the whole path +// from the controller's @RequestMapping. +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface PostMapping { + String value() default ""; // The URL path this method handles, appended to the controller's base path +} diff --git a/src/main/java/com/amigoscode/framework/annotations/Repository.java b/src/main/java/com/amigoscode/framework/annotations/Repository.java new file mode 100644 index 0000000..ef3b4c2 --- /dev/null +++ b/src/main/java/com/amigoscode/framework/annotations/Repository.java @@ -0,0 +1,14 @@ +package com.amigoscode.framework.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +// Marks a class as a repository — equivalent to Spring's @Repository. +// Repositories handle data access operations and are typically used for database interactions. +// The framework will automatically create an instance of this class and manage its lifecycle. +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Repository { +}