< prev index next >

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

Print this page




 365 
 366     @Override
 367     String toShortString() {
 368         StringBuilder sb = new StringBuilder("constructor ");
 369         sb.append(getDeclaringClass().getTypeName());
 370         sb.append('(');
 371         StringJoiner sj = new StringJoiner(",");
 372         for (Class<?> parameterType : getParameterTypes()) {
 373             sj.add(parameterType.getTypeName());
 374         }
 375         sb.append(sj);
 376         sb.append(')');
 377         return sb.toString();
 378     }
 379 
 380     /**
 381      * Returns a string describing this {@code Constructor},
 382      * including type parameters.  The string is formatted as the
 383      * constructor access modifiers, if any, followed by an
 384      * angle-bracketed comma separated list of the constructor's type
 385      * parameters, if any, followed by the fully-qualified name of the

 386      * declaring class, followed by a parenthesized, comma-separated
 387      * list of the constructor's generic formal parameter types.
 388      *
 389      * If this constructor was declared to take a variable number of
 390      * arguments, instead of denoting the last parameter as
 391      * "<code><i>Type</i>[]</code>", it is denoted as
 392      * "<code><i>Type</i>...</code>".
 393      *
 394      * A space is used to separate access modifiers from one another
 395      * and from the type parameters or class name.  If there are no
 396      * type parameters, the type parameter list is elided; if the type
 397      * parameter list is present, a space separates the list from the
 398      * class name.  If the constructor is declared to throw
 399      * exceptions, the parameter list is followed by a space, followed
 400      * by the word "{@code throws}" followed by a
 401      * comma-separated list of the generic thrown exception types.
 402      *
 403      * <p>The only possible modifiers for constructors are the access
 404      * modifiers {@code public}, {@code protected} or
 405      * {@code private}.  Only one of these may appear, or none if the




 365 
 366     @Override
 367     String toShortString() {
 368         StringBuilder sb = new StringBuilder("constructor ");
 369         sb.append(getDeclaringClass().getTypeName());
 370         sb.append('(');
 371         StringJoiner sj = new StringJoiner(",");
 372         for (Class<?> parameterType : getParameterTypes()) {
 373             sj.add(parameterType.getTypeName());
 374         }
 375         sb.append(sj);
 376         sb.append(')');
 377         return sb.toString();
 378     }
 379 
 380     /**
 381      * Returns a string describing this {@code Constructor},
 382      * including type parameters.  The string is formatted as the
 383      * constructor access modifiers, if any, followed by an
 384      * angle-bracketed comma separated list of the constructor's type
 385      * parameters, if any, including  informative bounds of the
 386      * type parameters, if any, followed by the fully-qualified name of the
 387      * declaring class, followed by a parenthesized, comma-separated
 388      * list of the constructor's generic formal parameter types.
 389      *
 390      * If this constructor was declared to take a variable number of
 391      * arguments, instead of denoting the last parameter as
 392      * "<code><i>Type</i>[]</code>", it is denoted as
 393      * "<code><i>Type</i>...</code>".
 394      *
 395      * A space is used to separate access modifiers from one another
 396      * and from the type parameters or class name.  If there are no
 397      * type parameters, the type parameter list is elided; if the type
 398      * parameter list is present, a space separates the list from the
 399      * class name.  If the constructor is declared to throw
 400      * exceptions, the parameter list is followed by a space, followed
 401      * by the word "{@code throws}" followed by a
 402      * comma-separated list of the generic thrown exception types.
 403      *
 404      * <p>The only possible modifiers for constructors are the access
 405      * modifiers {@code public}, {@code protected} or
 406      * {@code private}.  Only one of these may appear, or none if the


< prev index next >