Beat you to it!

http://nagoya.apache.org/jira/browse/HIVEMIND-52


On Wed, 8 Sep 2004 12:34:49 -0400, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
> Thanks for the bug and the fix (which needs to be applied in a couple
> of different places). If you could add a JIRA bug, that would be
> great!
> 
> 
> 
> 
> On Wed, 08 Sep 2004 17:31:15 +0200, Strutynski, Oliver
> <[EMAIL PROTECTED]> wrote:
> > For now I have worked around this by adding  some code to
> > ProxyBuilder.addServiceMethods that avoids that methods are being added
> > twice. Not sure if this is a good patch, as addServiceMethods should
> > probably check, if these methods are really defined in different
> > interfaces. But works for now. Code below.
> >
> > This issue is related to issue 39
> > (http://issues.apache.org/jira/browse/HIVEMIND-39). Here combining two
> > interfaces into one was suggested as a way to write a service that has
> > multiple interfaces, but the fact that two interfaces ARE ALLOWED to
> > have similar methods was not taken into account.
> >
> > My new ProxyBuilder.addServiceMethods():
> >
> >     public void addServiceMethods(String indirection)
> >     {
> >         // use a local map to remember all method signatures
> >         java.util.Map methodMap = new java.util.HashMap();
> >         BodyBuilder builder = new BodyBuilder();
> >         boolean toString = false;
> >
> >         Method[] methods = _serviceInterface.getMethods();
> >         for (int i = 0; i < methods.length; i++)
> >         {
> >             Method m = methods[i];
> >
> >             builder.clear();
> >             builder.begin();
> >             builder.add("return ($r) ");
> >             builder.add(indirection);
> >             builder.add(".");
> >             builder.add(m.getName());
> >             builder.addln("($$);");
> >             builder.end();
> >             // only add new methods, ignore ones with signatures that
> > have already been added to proxy.
> >             if (!methodMap.containsKey(new MethodSignature(m))) {
> >               methodMap.put(new MethodSignature(m), null);
> >               _classFab.addMethod(Modifier.PUBLIC, new
> > MethodSignature(m), builder.toString());
> >             }
> >             toString |= ClassFabUtils.isToString(m);
> >         }
> >
> >         if (!toString)
> >             ClassFabUtils.addToStringMethod(
> >                 _classFab,
> >                 "<"
> >                     + _type
> >                     + " for "
> >                     + _point.getExtensionPointId()
> >                     + "("
> >                     + _serviceInterface.getName()
> >                     + ")>");
> >
> >
> >     }
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
> http://howardlewisship.com
> 



-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to