FIQL Parsers Beanspector, replaces "is", "set" and "get" in method names
------------------------------------------------------------------------

                 Key: CXF-4153
                 URL: https://issues.apache.org/jira/browse/CXF-4153
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.5.2
         Environment: Java6
            Reporter: Stefan Nawrath
            Priority: Critical
             Fix For: 2.5.3


I try to use FIQL for search. When I init a new Parser, it caches all getters 
and setters of the target resource type class via Beanspector. All method names 
are updated to lower case and a possible leading "is", "get" or "set" should be 
replaced.

-> The replacement effectes not only leading strings! "isPromissed" will be 
changed in "promsed"!
(see code, Beanspector:183)
private String setterName(Method m) {
   return m.getName().replace("is", "").replace("set", "").toLowerCase();
}

Please change this method in a implementation, like this:

    private String methodName(Method m) {
        String result = m.getName().toLowerCase();

        if (result.startsWith("is")) {
            result = result.substring(2, result.length());
        }
        else if (result.startsWith("set") || result.startsWith("get")) {
            result = result.substring(3, result.length());
        }

        return result;
    }

Thanks,
Stefan

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to