< prev index next >

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

Print this page




 403      * @jls 8.4.3 Method Modifiers
 404      * @jls 9.4 Method Declarations
 405      * @jls 9.6.1 Annotation Type Elements
 406      */
 407     public String toString() {
 408         return sharedToString(Modifier.methodModifiers(),
 409                               isDefault(),
 410                               parameterTypes,
 411                               exceptionTypes);
 412     }
 413 
 414     @Override
 415     void specificToStringHeader(StringBuilder sb) {
 416         sb.append(getReturnType().getTypeName()).append(' ');
 417         sb.append(getDeclaringClass().getTypeName()).append('.');
 418         sb.append(getName());
 419     }
 420 
 421     @Override
 422     String toShortString() {
 423         StringBuilder sb = new StringBuilder("method ");
 424         sb.append(getDeclaringClass().getTypeName()).append('.');
 425         sb.append(getName());
 426         sb.append('(');
 427         StringJoiner sj = new StringJoiner(",");

 428         for (Class<?> parameterType : getParameterTypes()) {
 429             sj.add(parameterType.getTypeName());
 430         }
 431         sb.append(sj);
 432         sb.append(')');
 433         return sb.toString();
 434     }
 435 
 436     /**
 437      * Returns a string describing this {@code Method}, including type
 438      * parameters.  The string is formatted as the method access
 439      * modifiers, if any, followed by an angle-bracketed
 440      * comma-separated list of the method's type parameters, if any,
 441      * including informative bounds of the type parameters, if any,
 442      * followed by the method's generic return type, followed by a
 443      * space, followed by the class declaring the method, followed by
 444      * a period, followed by the method name, followed by a
 445      * parenthesized, comma-separated list of the method's generic
 446      * formal parameter types.
 447      *
 448      * If this method was declared to take a variable number of
 449      * arguments, instead of denoting the last parameter as
 450      * "<code><i>Type</i>[]</code>", it is denoted as
 451      * "<code><i>Type</i>...</code>".
 452      *
 453      * A space is used to separate access modifiers from one another




 403      * @jls 8.4.3 Method Modifiers
 404      * @jls 9.4 Method Declarations
 405      * @jls 9.6.1 Annotation Type Elements
 406      */
 407     public String toString() {
 408         return sharedToString(Modifier.methodModifiers(),
 409                               isDefault(),
 410                               parameterTypes,
 411                               exceptionTypes);
 412     }
 413 
 414     @Override
 415     void specificToStringHeader(StringBuilder sb) {
 416         sb.append(getReturnType().getTypeName()).append(' ');
 417         sb.append(getDeclaringClass().getTypeName()).append('.');
 418         sb.append(getName());
 419     }
 420 
 421     @Override
 422     String toShortString() {
 423         return "method " + getDeclaringClass().getTypeName() +
 424                 '.' + toShortSignature();
 425     }
 426 
 427     String toShortSignature() {
 428         StringJoiner sj = new StringJoiner(",", getName() + "(", ")");
 429         for (Class<?> parameterType : getParameterTypes()) {
 430             sj.add(parameterType.getTypeName());
 431         }
 432         return sj.toString();


 433     }
 434 
 435     /**
 436      * Returns a string describing this {@code Method}, including type
 437      * parameters.  The string is formatted as the method access
 438      * modifiers, if any, followed by an angle-bracketed
 439      * comma-separated list of the method's type parameters, if any,
 440      * including informative bounds of the type parameters, if any,
 441      * followed by the method's generic return type, followed by a
 442      * space, followed by the class declaring the method, followed by
 443      * a period, followed by the method name, followed by a
 444      * parenthesized, comma-separated list of the method's generic
 445      * formal parameter types.
 446      *
 447      * If this method was declared to take a variable number of
 448      * arguments, instead of denoting the last parameter as
 449      * "<code><i>Type</i>[]</code>", it is denoted as
 450      * "<code><i>Type</i>...</code>".
 451      *
 452      * A space is used to separate access modifiers from one another


< prev index next >