< prev index next >

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

Print this page




 486         sb.append(getDeclaringClass().getTypeName()).append('.');
 487         sb.append(getName());
 488     }
 489 
 490     /**
 491      * Invokes the underlying method represented by this {@code Method}
 492      * object, on the specified object with the specified parameters.
 493      * Individual parameters are automatically unwrapped to match
 494      * primitive formal parameters, and both primitive and reference
 495      * parameters are subject to method invocation conversions as
 496      * necessary.
 497      *
 498      * <p>If the underlying method is static, then the specified {@code obj}
 499      * argument is ignored. It may be null.
 500      *
 501      * <p>If the number of formal parameters required by the underlying method is
 502      * 0, the supplied {@code args} array may be of length 0 or null.
 503      *
 504      * <p>If the underlying method is an instance method, it is invoked
 505      * using dynamic method lookup as documented in The Java Language
 506      * Specification, section 15.12.4.4; in particular,
 507      * overriding based on the runtime type of the target object may occur.
 508      *
 509      * <p>If the underlying method is static, the class that declared
 510      * the method is initialized if it has not already been initialized.
 511      *
 512      * <p>If the method completes normally, the value it returns is
 513      * returned to the caller of invoke; if the value has a primitive
 514      * type, it is first appropriately wrapped in an object. However,
 515      * if the value has the type of an array of a primitive type, the
 516      * elements of the array are <i>not</i> wrapped in objects; in
 517      * other words, an array of primitive type is returned.  If the
 518      * underlying method return type is void, the invocation returns
 519      * null.
 520      *
 521      * @param obj  the object the underlying method is invoked from
 522      * @param args the arguments used for the method call
 523      * @return the result of dispatching the method represented by
 524      * this object on {@code obj} with parameters
 525      * {@code args}
 526      *




 486         sb.append(getDeclaringClass().getTypeName()).append('.');
 487         sb.append(getName());
 488     }
 489 
 490     /**
 491      * Invokes the underlying method represented by this {@code Method}
 492      * object, on the specified object with the specified parameters.
 493      * Individual parameters are automatically unwrapped to match
 494      * primitive formal parameters, and both primitive and reference
 495      * parameters are subject to method invocation conversions as
 496      * necessary.
 497      *
 498      * <p>If the underlying method is static, then the specified {@code obj}
 499      * argument is ignored. It may be null.
 500      *
 501      * <p>If the number of formal parameters required by the underlying method is
 502      * 0, the supplied {@code args} array may be of length 0 or null.
 503      *
 504      * <p>If the underlying method is an instance method, it is invoked
 505      * using dynamic method lookup as documented in The Java Language
 506      * Specification, &sect;{@jls 15.12.4.4}; in particular,
 507      * overriding based on the runtime type of the target object may occur.
 508      *
 509      * <p>If the underlying method is static, the class that declared
 510      * the method is initialized if it has not already been initialized.
 511      *
 512      * <p>If the method completes normally, the value it returns is
 513      * returned to the caller of invoke; if the value has a primitive
 514      * type, it is first appropriately wrapped in an object. However,
 515      * if the value has the type of an array of a primitive type, the
 516      * elements of the array are <i>not</i> wrapped in objects; in
 517      * other words, an array of primitive type is returned.  If the
 518      * underlying method return type is void, the invocation returns
 519      * null.
 520      *
 521      * @param obj  the object the underlying method is invoked from
 522      * @param args the arguments used for the method call
 523      * @return the result of dispatching the method represented by
 524      * this object on {@code obj} with parameters
 525      * {@code args}
 526      *


< prev index next >