| 1 | package org.jboss.resteasy.spi.touri; |
| 2 | |
| 3 | import java.lang.annotation.ElementType; |
| 4 | import java.lang.annotation.Retention; |
| 5 | import java.lang.annotation.RetentionPolicy; |
| 6 | import java.lang.annotation.Target; |
| 7 | |
| 8 | /** |
| 9 | * <p> |
| 10 | * This annotation can be added to any object to perform a Resource/method based |
| 11 | * lookup to create a URI template. From there, perform Java beans-based |
| 12 | * transformation between URI template and bean properties. For example, take |
| 13 | * the following bean: |
| 14 | * </p> |
| 15 | * <p/> |
| 16 | * <pre> |
| 17 | * MappedBy(Resource=FooResource.class, method="getFoo") |
| 18 | * public class Foo |
| 19 | * { |
| 20 | * private int id; |
| 21 | * // getters and setters |
| 22 | * } |
| 23 | * |
| 24 | * @author <a href="mailto:[email protected]">Solomon Duskis</a> |
| 25 | * @version $Revision: 1 $ |
| 26 | * @Path("/foo") public class FooResource { |
| 27 | * @GET |
| 28 | * @Path("{id}") |
| 29 | * @Produces(...) public Foo getFoo(@PathParam("id") Integer id){ |
| 30 | * ... |
| 31 | * } |
| 32 | * } |
| 33 | * </pre> |
| 34 | * <p/> |
| 35 | * <p> |
| 36 | * for a Foo f with id = 123, ObjectToURI.getInstance(f) = "/foo/123" |
| 37 | * </p> |
| 38 | */ |
| 39 | |
| 40 | @Target({ElementType.TYPE}) |
| 41 | @Retention(RetentionPolicy.RUNTIME) |
| 42 | public @interface MappedBy |
| 43 | { |
| 44 | Class<?> resource(); |
| 45 | |
| 46 | String method() default ""; |
| 47 | } |