| 1 |
package org.jboss.resteasy.spi.touri; |
| 2 |
|
| 3 |
import org.jboss.resteasy.specimpl.ResteasyUriBuilder; |
| 4 |
|
| 5 |
import java.lang.annotation.Annotation; |
| 6 |
|
| 7 |
public class MappedByAnnotationResolver extends |
| 8 |
AbstractURITemplateAnnotationResolver |
| 9 |
{ |
| 10 |
protected Class<? extends Annotation> getAnnotationType() |
| 11 |
{ |
| 12 |
return MappedBy.class; |
| 13 |
} |
| 14 |
|
| 15 |
protected ResteasyUriBuilder getUriBuilder(Class<? extends Object> clazz) |
| 16 |
{ |
| 17 |
MappedBy mappedBy = clazz.getAnnotation(MappedBy.class); |
| 18 |
ResteasyUriBuilder uriBuilderImpl = new ResteasyUriBuilder(); |
| 19 |
Class<?> resourceType = mappedBy.resource(); |
| 20 |
uriBuilderImpl.path(resourceType); |
| 21 |
String method = mappedBy.method(); |
| 22 |
if (method != null && method.length() > 0) |
| 23 |
{ |
| 24 |
uriBuilderImpl.path(resourceType, method); |
| 25 |
} |
| 26 |
return uriBuilderImpl; |
| 27 |
} |
| 28 |
} |