Mercurial > octave
changeset 26952:ca8c2696af62
include Java constructors in methods output (bug #55858)
* ClassHelper.java (ClassHelper.getMethods): Also include constructors
in the returned list.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Mar 2019 17:34:36 +0000 |
parents | 36dcbe7868ac |
children | 6e01e5be8de3 |
files | scripts/java/org/octave/ClassHelper.java |
diffstat | 1 files changed, 47 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/java/org/octave/ClassHelper.java Wed Mar 20 16:47:03 2019 +0000 +++ b/scripts/java/org/octave/ClassHelper.java Wed Mar 20 17:34:36 2019 +0000 @@ -143,11 +143,57 @@ public static String getMethods (Class klass) { StringBuilder sb = new StringBuilder(); + boolean first = true; + + Constructor theConstructor[] = klass.getConstructors (); + for (int i = 0; i < theConstructor.length; i++) + { + if (first) + { + first = false; + } + else + { + sb.append (";"); + } + + sb.append (theConstructor[i].getName ()); + sb.append ("("); + + Class theParameter[] = theConstructor[i].getParameterTypes (); + for (int j = 0; j < theParameter.length; j++) + { + if (j > 0) + { + sb.append (", "); + } + sb.append (theParameter[j].getCanonicalName ()); + } + sb.append (")"); + + Class theExceptions[] = theConstructor[i].getExceptionTypes (); + if (theExceptions.length > 0) + { + sb.append (" throws "); + for (int j = 0; j < theExceptions.length; j++) + { + if (j > 0) + { + sb.append (", "); + } + sb.append (theExceptions[j].getCanonicalName ()); + } + } + } Method theMethod[] = klass.getMethods (); for (int i = 0; i < theMethod.length; i++) { - if (i > 0) + if (first) + { + first = false; + } + else { sb.append (";"); }