< prev index next >

src/java.base/share/classes/java/lang/reflect/Method.java

Print this page




 419         sb.append(getDeclaringClass().getTypeName()).append('.');
 420         sb.append(getName());
 421     }
 422 
 423     @Override
 424     String toShortString() {
 425         StringBuilder sb = new StringBuilder("method ");
 426         sb.append(getDeclaringClass().getTypeName()).append('.');
 427         sb.append(getName());
 428         sb.append('(');
 429         StringJoiner sj = new StringJoiner(",");
 430         for (Class<?> parameterType : getParameterTypes()) {
 431             sj.add(parameterType.getTypeName());
 432         }
 433         sb.append(sj);
 434         sb.append(')');
 435         return sb.toString();
 436     }
 437 
 438     /**
 439      * Returns a string describing this {@code Method}, including
 440      * type parameters.  The string is formatted as the method access
 441      * modifiers, if any, followed by an angle-bracketed
 442      * comma-separated list of the method's type parameters, if any,

 443      * followed by the method's generic return type, followed by a
 444      * space, followed by the class declaring the method, followed by
 445      * a period, followed by the method name, followed by a
 446      * parenthesized, comma-separated list of the method's generic
 447      * formal parameter types.
 448      *
 449      * If this method was declared to take a variable number of
 450      * arguments, instead of denoting the last parameter as
 451      * "<code><i>Type</i>[]</code>", it is denoted as
 452      * "<code><i>Type</i>...</code>".
 453      *
 454      * A space is used to separate access modifiers from one another
 455      * and from the type parameters or return type.  If there are no
 456      * type parameters, the type parameter list is elided; if the type
 457      * parameter list is present, a space separates the list from the
 458      * class name.  If the method is declared to throw exceptions, the
 459      * parameter list is followed by a space, followed by the word
 460      * "{@code throws}" followed by a comma-separated list of the generic
 461      * thrown exception types.
 462      *




 419         sb.append(getDeclaringClass().getTypeName()).append('.');
 420         sb.append(getName());
 421     }
 422 
 423     @Override
 424     String toShortString() {
 425         StringBuilder sb = new StringBuilder("method ");
 426         sb.append(getDeclaringClass().getTypeName()).append('.');
 427         sb.append(getName());
 428         sb.append('(');
 429         StringJoiner sj = new StringJoiner(",");
 430         for (Class<?> parameterType : getParameterTypes()) {
 431             sj.add(parameterType.getTypeName());
 432         }
 433         sb.append(sj);
 434         sb.append(')');
 435         return sb.toString();
 436     }
 437 
 438     /**
 439      * Returns a string describing this {@code Method}, including type
 440      * parameters.  The string is formatted as the method access
 441      * modifiers, if any, followed by an angle-bracketed
 442      * comma-separated list of the method's type parameters, if any,
 443      * including informative bounds of the type parameters, if any,
 444      * followed by the method's generic return type, followed by a
 445      * space, followed by the class declaring the method, followed by
 446      * a period, followed by the method name, followed by a
 447      * parenthesized, comma-separated list of the method's generic
 448      * formal parameter types.
 449      *
 450      * If this method was declared to take a variable number of
 451      * arguments, instead of denoting the last parameter as
 452      * "<code><i>Type</i>[]</code>", it is denoted as
 453      * "<code><i>Type</i>...</code>".
 454      *
 455      * A space is used to separate access modifiers from one another
 456      * and from the type parameters or return type.  If there are no
 457      * type parameters, the type parameter list is elided; if the type
 458      * parameter list is present, a space separates the list from the
 459      * class name.  If the method is declared to throw exceptions, the
 460      * parameter list is followed by a space, followed by the word
 461      * "{@code throws}" followed by a comma-separated list of the generic
 462      * thrown exception types.
 463      *


< prev index next >