src/share/classes/java/lang/reflect/Executable.java

Print this page




 261      * @throws TypeNotPresentException if any of the parameter
 262      *     types of the underlying executable refers to a non-existent type
 263      *     declaration
 264      * @throws MalformedParameterizedTypeException if any of
 265      *     the underlying executable's parameter types refer to a parameterized
 266      *     type that cannot be instantiated for any reason
 267      */
 268     public Type[] getGenericParameterTypes() {
 269         if (hasGenericInformation())
 270             return getGenericInfo().getParameterTypes();
 271         else
 272             return getParameterTypes();
 273     }
 274 
 275     /**
 276      * Returns an array of {@code Parameter} objects that represent
 277      * all the parameters to the underlying executable represented by
 278      * this object.  Returns an array of length 0 if the executable
 279      * has no parameters.
 280      *




 281      * @return an array of {@code Parameter} objects representing all
 282      * the parameters to the executable this object represents
 283      */
 284     public Parameter[] getParameters() {
 285         // TODO: This may eventually need to be guarded by security
 286         // mechanisms similar to those in Field, Method, etc.
 287         //
 288         // Need to copy the cached array to prevent users from messing
 289         // with it.  Since parameters are immutable, we can
 290         // shallow-copy.
 291         return privateGetParameters().clone();
 292     }
 293 
 294     private Parameter[] synthesizeAllParams() {
 295         final int realparams = getParameterCount();
 296         final Parameter[] out = new Parameter[realparams];
 297         for (int i = 0; i < realparams; i++)
 298             // TODO: is there a way to synthetically derive the
 299             // modifiers?  Probably not in the general case, since
 300             // we'd have no way of knowing about them, but there




 261      * @throws TypeNotPresentException if any of the parameter
 262      *     types of the underlying executable refers to a non-existent type
 263      *     declaration
 264      * @throws MalformedParameterizedTypeException if any of
 265      *     the underlying executable's parameter types refer to a parameterized
 266      *     type that cannot be instantiated for any reason
 267      */
 268     public Type[] getGenericParameterTypes() {
 269         if (hasGenericInformation())
 270             return getGenericInfo().getParameterTypes();
 271         else
 272             return getParameterTypes();
 273     }
 274 
 275     /**
 276      * Returns an array of {@code Parameter} objects that represent
 277      * all the parameters to the underlying executable represented by
 278      * this object.  Returns an array of length 0 if the executable
 279      * has no parameters.
 280      *
 281      * The parameters of the underlying executable do not necessarily
 282      * have unique names, or names that are legal identifiers in the
 283      * Java programming language (JLS 3.8).
 284      *
 285      * @return an array of {@code Parameter} objects representing all
 286      * the parameters to the executable this object represents
 287      */
 288     public Parameter[] getParameters() {
 289         // TODO: This may eventually need to be guarded by security
 290         // mechanisms similar to those in Field, Method, etc.
 291         //
 292         // Need to copy the cached array to prevent users from messing
 293         // with it.  Since parameters are immutable, we can
 294         // shallow-copy.
 295         return privateGetParameters().clone();
 296     }
 297 
 298     private Parameter[] synthesizeAllParams() {
 299         final int realparams = getParameterCount();
 300         final Parameter[] out = new Parameter[realparams];
 301         for (int i = 0; i < realparams; i++)
 302             // TODO: is there a way to synthetically derive the
 303             // modifiers?  Probably not in the general case, since
 304             // we'd have no way of knowing about them, but there