You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Frederic Ahring <FA...@de.ibm.com> on 2005/07/18 14:12:50 UTC

Source Reflection: getConstructor

Derived from JavaSource.getMethod(String pMethodName, JavaQName[] pParams)

    /** 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;
                Parameter[] parameters = jc.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 jc;
                    }
                }
            }
        }
        return null;
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: Source Reflection: getConstructor

Posted by Jochen Wiedmann <jo...@gmail.com>.
Hi, Frederic,

applied to production branch (0.4 branch), HEAD (0.5 branch), and 
JAXME-28 (upcoming 0.6 branch).

Btw, a few more words the next time, which indicate what you are 
telling, would help. I really wondered whether you are posting a bug 
report, a proposed patch, or whatever else. :-)


Jochen


---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org