binding: renaming different parameters

Hi All!

For example I have class:

class A { ... static void b (String errorClass); static void b (Throwable exception); ... }

After binding I get:

class A { ... static void a (String p0); static void a (Throwable p0); ... }

After using
<attr path="/api/package[@name='packageName']/class[@name='a']/method[@name='b']/parameter[@name='p0']" name="name">paramName</attr>

I get the same parameter name for both methods.

How can I correctly rename this methods using metadata.xml?

Thanks in advance!

Posts

  • semasemasemasema USMember

    Sorry for misprint.
    How can I correctly rename this PARAMETERS using metadata.xml?

  • BradleyBradley USMember ✭✭✭

    Include the type to differentiate between the 2 methods.

    <attr path="/api/package[@name='packageName']/class[@name='a']/method[@name='b']/parameter[@name='p0' and @type='String']" name="name">errorClass</attr>
    
    <attr path="/api/package[@name='packageName']/class[@name='a']/method[@name='b']/parameter[@name='p0' and @type='Throwable']" name="name">exception</attr>
    

    If that doesn't work you may have to fully qualify the type names java.lang.String & java.lang.Throwable.

  • semasemasemasema USMember

    Thank you Bradley! Full type names did the job.

Sign In or Register to comment.