Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
PathAnnotationRoutesParser that uses an interface if the controller has one
import java.util.List;
import br.com.caelum.vraptor.http.route.PathAnnotationRoutesParser;
import br.com.caelum.vraptor.http.route.Route;
import br.com.caelum.vraptor.http.route.Router;
import br.com.caelum.vraptor.ioc.ApplicationScoped;
import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.resource.ResourceClass;
@Component
@ApplicationScoped
public class InterfaceBasedPathAnnotationRoutesParser extends PathAnnotationRoutesParser {
public InterfaceBasedPathAnnotationRoutesParser(Router router) {
super(router);
}
@Override
public List<Route> rulesFor(ResourceClass resource) {
final Class<?>[] superClass = resource.getType().getInterfaces();
return super.rulesFor(superClass.length == 0 ? resource : interfaceResourceClass(superClass));
}
private ResourceClass interfaceResourceClass(final Class<?>[] superClass) {
return new ResourceClass() {
@Override
public Class<?> getType() {
return superClass[0];
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.