⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proxy.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 3 页
字号:
 instance inherited from <code>java.lang.Object</code> are not overridden by a proxy class, so invocations of those methods behave like they do for instances of <code>java.lang.Object</code>. </ul> <h3>Methods Duplicated in Multiple Proxy Interfaces</h3> <p>When two or more interfaces of a proxy class contain a method with the same name and parameter signature, the order of the proxy class's interfaces becomes significant.  When such a <i>duplicate method</i> is invoked on a proxy instance, the <code>Method</code> object passed to the invocation handler will not necessarily be the one whose declaring class is assignable from the reference type of the interface that the proxy's method was invoked through.  This limitation exists because the corresponding method implementation in the generated proxy class cannot determine which interface it was invoked through. Therefore, when a duplicate method is invoked on a proxy instance, the <code>Method</code> object for the method in the foremost interface that contains the method (either directly or inherited through a superinterface) in the proxy class's list of interfaces is passed to the invocation handler's <code>invoke</code> method, regardless of the reference type through which the method invocation occurred. <p>If a proxy interface contains a method with the same name and parameter signature as the <code>hashCode</code>, <code>equals</code>, or <code>toString</code> methods of <code>java.lang.Object</code>, when such a method is invoked on a proxy instance, the <code>Method</code> object passed to the invocation handler will have <code>java.lang.Object</code> as its declaring class.  In other words, the public, non-final methods of <code>java.lang.Object</code> logically precede all of the proxy interfaces for the determination of which <code>Method</code> object to pass to the invocation handler. <p>Note also that when a duplicate method is dispatched to an invocation handler, the <code>invoke</code> method may only throw checked exception types that are assignable to one of the exception types in the <code>throws</code> clause of the method in <i>all</i> of the proxy interfaces that it can be invoked through.  If the <code>invoke</code> method throws a checked exception that is not assignable to any of the exception types declared by the method in one of the the proxy interfaces that it can be invoked through, then an unchecked <code>UndeclaredThrowableException</code> will be thrown by the invocation on the proxy instance.  This restriction means that not all of the exception types returned by invoking <code>getExceptionTypes</code> on the <code>Method</code> object passed to the <code>invoke</code> method can necessarily be thrown successfully by the <code>invoke</code> method.<P><DL><DT><B>Since: </B><DD>JDK1.3</DD><DT><B>See Also: </B><DD><A HREF="../../../java/lang/reflect/InvocationHandler.html"><CODE>InvocationHandler</CODE></A>, <A HREF="../../../serialized-form.html#java.lang.reflect.Proxy">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../java/lang/reflect/InvocationHandler.html">InvocationHandler</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Proxy.html#h">h</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the invocation handler for this proxy instance.</TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected </CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Proxy.html#Proxy(java.lang.reflect.InvocationHandler)">Proxy</A></B>(<A HREF="../../../java/lang/reflect/InvocationHandler.html">InvocationHandler</A>&nbsp;h)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new <code>Proxy</code> instance from a subclass (typically, a dynamic proxy class) with the specified value for its invocation handler.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="../../../java/lang/reflect/InvocationHandler.html">InvocationHandler</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Proxy.html#getInvocationHandler(java.lang.Object)">getInvocationHandler</A></B>(<A HREF="../../../java/lang/Object.html">Object</A>&nbsp;proxy)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the invocation handler for the specified proxy instance.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="../../../java/lang/Class.html">Class</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Proxy.html#getProxyClass(java.lang.ClassLoader, java.lang.Class[])">getProxyClass</A></B>(<A HREF="../../../java/lang/ClassLoader.html">ClassLoader</A>&nbsp;loader,              <A HREF="../../../java/lang/Class.html">Class</A>[]&nbsp;interfaces)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the <code>java.lang.Class</code> object for a proxy class given a class loader and an array of interfaces.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Proxy.html#isProxyClass(java.lang.Class)">isProxyClass</A></B>(<A HREF="../../../java/lang/Class.html">Class</A>&nbsp;cl)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns true if and only if the specified class was dynamically generated to be a proxy class using the <code>getProxyClass</code> method or the <code>newProxyInstance</code> method.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="../../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../java/lang/reflect/Proxy.html#newProxyInstance(java.lang.ClassLoader, java.lang.Class[], java.lang.reflect.InvocationHandler)">newProxyInstance</A></B>(<A HREF="../../../java/lang/ClassLoader.html">ClassLoader</A>&nbsp;loader,                 <A HREF="../../../java/lang/Class.html">Class</A>[]&nbsp;interfaces,                 <A HREF="../../../java/lang/reflect/InvocationHandler.html">InvocationHandler</A>&nbsp;h)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an instance of a proxy class for the specified interfaces that dispatches method invocations to the specified invocation handler.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE>&nbsp;<P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="h"><!-- --></A><H3>h</H3><PRE>protected <A HREF="../../../java/lang/reflect/InvocationHandler.html">InvocationHandler</A> <B>h</B></PRE><DL><DD>the invocation handler for this proxy instance.</DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="Proxy(java.lang.reflect.InvocationHandler)"><!-- --></A><H3>Proxy</H3><PRE>protected <B>Proxy</B>(<A HREF="../../../java/lang/reflect/InvocationHandler.html">InvocationHandler</A>&nbsp;h)</PRE><DL><DD>Constructs a new <code>Proxy</code> instance from a subclass (typically, a dynamic proxy class) with the specified value for its invocation handler.<DD><DL><DT><B>Parameters:</B><DD><CODE>h</CODE> - the invocation handler for this proxy instance</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -