2

I'm using a rest service with AndroidAnnotations, configured like so:

@Rest(rootUrl = "http://192.168.1.48:8080/stuff/services/rest/StuffService/",
        converters = {MappingJacksonHttpMessageConverter.class})
public interface IStuff
{
    @Post("fetchAllStuff")
    public Response fetchAllStuff(Request req);
}

So what happens when I need to change the URL at runtime? If the URL is hard-coded in the annotation, what would I do to change it? Is there some way I could have it in a properties or XML file as well?

Rocky Pulley
  • 22,531
  • 20
  • 68
  • 106
  • I think it just expects a String, where you get that String is up to you, so you should be able to read it out of resources xml (although that doesn't help if you need to change it at runtime) or get it from any other source. – FoamyGuy May 23 '13 at 13:23

1 Answers1

4

As explained on the wiki, you can simply define a void setRootUrl(String rootUrl) method and it will be generated as a setter on the final class

DayS
  • 1,561
  • 11
  • 15