jochen      2005/07/19 12:35:45

  Modified:    src/js/org/apache/ws/jaxme/js Tag: JAXME-28 JavaSource.java
               .        Tag: JAXME-28 status.xml
  Log:
  Added JavaSource.getConstructor(JavaQName[]).
  Submitted by: Frederic Ahring, [EMAIL PROTECTED]
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.10.2.1  +34 -14    ws-jaxme/src/js/org/apache/ws/jaxme/js/JavaSource.java
  
  Index: JavaSource.java
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/js/org/apache/ws/jaxme/js/JavaSource.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- JavaSource.java   18 May 2005 22:09:10 -0000      1.10
  +++ JavaSource.java   19 Jul 2005 19:35:44 -0000      1.10.2.1
  @@ -419,7 +419,20 @@
        }
        return (JavaMethod[]) result.toArray(new JavaMethod[result.size()]);
       }
  -    
  +
  +    private boolean isMatching(Parameter[] parameters, JavaQName[] pParams) {
  +             if (parameters.length == pParams.length) {
  +                     for (int i = 0;  i < parameters.length;  i++) {
  +                             if 
(!parameters[i].getType().equals(pParams[i])) {
  +                                     return false;
  +                             }
  +                     }
  +                     return true;
  +             } else {
  +                     return false;
  +             }
  +    }
  +
       /** Returns the method with the given signature or null, if there
        * is no such method.
        */
  @@ -429,25 +442,32 @@
                if (object instanceof JavaMethod) {
                        JavaMethod jm = (JavaMethod) object;
                        if (jm.getName().equals(pMethodName)) {
  -                             Parameter[] parameters = jm.getParams();
  -                             if (parameters.length == pParams.length) {
  -                                     boolean equals = true;
  -                                     for (int i = 0;  i < parameters.length; 
 i++) {
  -                                             if 
(!parameters[i].getType().equals(pParams[i])) {
  -                                                     equals = false;
  -                                                     break;
  -                                             }
  -                                     }
  -                                     if (equals) {
  -                                             return jm;
  -                                     }
  +                             if (isMatching(jm.getParams(), pParams)) {
  +                                     return jm;
                                }
                        }
                }
        }
        return null;
       }
  -    
  +
  +    /** Returns the constructor with the given signature or null, if there
  +     * is no such constructor.
  +     */
  +    public JavaConstructor getConstructor(JavaQName[] pParams) {
  +        for (Iterator iter = myObjects.iterator();  iter.hasNext();  ) {
  +            ConditionalIndentationJavaSourceObject object = 
  +             (ConditionalIndentationJavaSourceObject) iter.next();
  +            if (object instanceof JavaConstructor) {
  +                JavaConstructor jc = (JavaConstructor) object;
  +                if (isMatching(jc.getParams(), pParams)) {
  +                     return jc;
  +                }
  +            }
  +        }
  +        return null;
  +    }
  +
       private class MyObjectIterator implements Iterator {
        private final Class instanceClass;
        MyObjectIterator(Class pInstanceClass) {
  
  
  
  No                   revision
  No                   revision
  1.61.2.1  +5 -1      ws-jaxme/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/status.xml,v
  retrieving revision 1.61
  retrieving revision 1.61.2.1
  diff -u -r1.61 -r1.61.2.1
  --- status.xml        13 Jul 2005 19:23:20 -0000      1.61
  +++ status.xml        19 Jul 2005 19:35:44 -0000      1.61.2.1
  @@ -44,7 +44,7 @@
         </action>
         <action dev="JW" type="fix" context="js">
           The JavaParser didn't handle multidimensional arrays
  -        properly. (Frederic Ahring, [EMAIL PROTECTED])
  +        properly. (Frederic Ahring, fahring at de.ibm.com)
         </action>
         <action dev="JW" type="fix" context="generator">
           Fixed that the generator didn't detect top level groups with
  @@ -54,6 +54,10 @@
           Fixed a ClassCastException, which appeared for unknown
           reasons.
         </action>
  +      <action dev="JW" type="enhancement" context="js">
  +        Added JavaSource.getConstructor(JavaQName[]).
  +             (Frederic Ahring, fahring at de.ibm.com)
  +      </action>
        </release>
       <release version="0.4" date="2005-May-19">
         <action dev="JW" type="fix" context="xs">
  
  
  

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

Reply via email to