CARVIEW |
Select Language
HTTP/1.1 302 Moved Temporarily
Server: AkamaiGHost
Content-Length: 0
Location: https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/InvocationHandler.html
Date: Mon, 28 Jul 2025 07:20:10 GMT
Connection: keep-alive
Akamai-Request-BC: [a=184.26.162.136,b=711828136,c=g,n=IN_KA_BANGALORE,o=9498]
HTTP/1.1 200 OK
Server: AkamaiNetStorage
Content-Type: text/html
ETag: "a69467ffc2c446031cfa500bb46e977f:1595391209.408254"
Vary: Accept-Encoding
Content-Encoding: gzip
Cache-Control: max-age=21600
Date: Mon, 28 Jul 2025 07:20:11 GMT
Content-Length: 3469
Connection: keep-alive
InvocationHandler (Java Platform SE 7 )
java.lang.reflect
Interface InvocationHandler
-
- All Known Implementing Classes:
- CompositeDataInvocationHandler, EventHandler, MBeanServerInvocationHandler, RemoteObjectInvocationHandler
public interface InvocationHandler
InvocationHandler
is the interface implemented by the invocation handler of a proxy instance.Each proxy instance has an associated invocation handler. When a method is invoked on a proxy instance, the method invocation is encoded and dispatched to the
invoke
method of its invocation handler.- Since:
- 1.3
- See Also:
Proxy
-
-
Method Detail
-
invoke
Object invoke(Object proxy, Method method, Object[] args) throws Throwable
Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.- Parameters:
proxy
- the proxy instance that the method was invoked onmethod
- theMethod
instance corresponding to the interface method invoked on the proxy instance. The declaring class of theMethod
object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.args
- an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, ornull
if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such asjava.lang.Integer
orjava.lang.Boolean
.- Returns:
- the value to return from the method invocation on the
proxy instance. If the declared return type of the interface
method is a primitive type, then the value returned by
this method must be an instance of the corresponding primitive
wrapper class; otherwise, it must be a type assignable to the
declared return type. If the value returned by this method is
null
and the interface method's return type is primitive, then aNullPointerException
will be thrown by the method invocation on the proxy instance. If the value returned by this method is otherwise not compatible with the interface method's declared return type as described above, aClassCastException
will be thrown by the method invocation on the proxy instance. - Throws:
Throwable
- the exception to throw from the method invocation on the proxy instance. The exception's type must be assignable either to any of the exception types declared in thethrows
clause of the interface method or to the unchecked exception typesjava.lang.RuntimeException
orjava.lang.Error
. If a checked exception is thrown by this method that is not assignable to any of the exception types declared in thethrows
clause of the interface method, then anUndeclaredThrowableException
containing the exception that was thrown by this method will be thrown by the method invocation on the proxy instance.- See Also:
UndeclaredThrowableException
-
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.