2 Replies Latest reply on Jul 16, 2013 9:39 AM by gboro54

    Overriding methods with Rest

    gboro54

      I have an interface inwhich there are overriding methods i.e

       

      public boolean doSomething(String str);

       

      public boolean doSomething(String str, String str2);

       

       

      When I annotate the parameters with @QueryParam it seems to just invoke the first one. Is there a better way to do this or do I just have to expose one method with all parameters and do null checks?

        • 1. Re: Overriding methods with Rest
          meetoblivion

          Not sureif you ever found a solution, but you may want to throw questions like these into the resteasy forum.

           

          Anyways, you can use @DefaultValue for optional parameters.  I believe the spec is a first-match behavior (find the first method that can accept these arguments and continue).  As a result, especially for query params, you should define a larger method to accept all params and give them default values.

          • 2. Re: Overriding methods with Rest
            gboro54

            John,

             

            I figured this once I read the spec and did such. Thanks for the response.