constructor.html

来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 760 行 · 第 1/3 页

HTML
760
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_03) on Wed Nov 02 09:50:19 CST 2005 --><META http-equiv="Content-Type" content="text/html; charset=gb2312"><TITLE>Constructor (Java 2 Platform SE 5.0)</TITLE><META NAME="keywords" CONTENT="java.lang.reflect.Constructor class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="Constructor (Java 2 Platform SE 5.0)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="跳过导航链接"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>类</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Constructor.html"><FONT CLASS="NavBarFont1"><B>使用</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Standard&nbsp;Ed. 5.0</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="Array.html" title="java.lang.reflect 中的类"><B>上一个类</B></A>&nbsp;&nbsp;<A HREF="Field.html" title="java.lang.reflect 中的类"><B>下一个类</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html@java_2Flang_2Freflect_2FConstructor.html" target="_top"><B>框架</B></A>  &nbsp;&nbsp;<A HREF="Constructor.html" target="_top"><B>无框架</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>所有类</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../allclasses-noframe.html"><B>所有类</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  摘要:&nbsp;嵌套&nbsp;|&nbsp;字段&nbsp;|&nbsp;构造方法&nbsp;|&nbsp;<A HREF="#method_summary">方法</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">详细信息:&nbsp;字段&nbsp;|&nbsp;构造方法&nbsp;|&nbsp;<A HREF="#method_detail">方法</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.lang.reflect</FONT><BR>类 Constructor&lt;T&gt;</H2><PRE><A HREF="../Object.html" title="java.lang 中的类">java.lang.Object</A>  <IMG SRC="../../../resources/inherit.gif" ALT="继承者 "><A HREF="AccessibleObject.html" title="java.lang.reflect 中的类">java.lang.reflect.AccessibleObject</A>      <IMG SRC="../../../resources/inherit.gif" ALT="继承者 "><B>java.lang.reflect.Constructor&lt;T&gt;</B></PRE><DL><DT><B>所有已实现的接口:</B> <DD><A HREF="AnnotatedElement.html" title="java.lang.reflect 中的接口">AnnotatedElement</A>, <A HREF="GenericDeclaration.html" title="java.lang.reflect 中的接口">GenericDeclaration</A>, <A HREF="Member.html" title="java.lang.reflect 中的接口">Member</A></DD></DL><HR><DL><DT><PRE>public final class <B>Constructor&lt;T&gt;</B><DT>extends <A HREF="AccessibleObject.html" title="java.lang.reflect 中的类">AccessibleObject</A><DT>implements <A HREF="GenericDeclaration.html" title="java.lang.reflect 中的接口">GenericDeclaration</A>, <A HREF="Member.html" title="java.lang.reflect 中的接口">Member</A></DL></PRE><P><code>Constructor</code> 提供关于类的单个构造方法的信息以及对它的访问权限。<p><code>Constructor</code> 允许在将实参与带有基础构造方法的形参的 newInstance() 匹配时进行扩展转换,但是如果发生收缩转换,则抛出 <code>IllegalArgumentException</code>。<P><P><DL><DT><B>另请参见:</B><DD><A HREF="Member.html" title="java.lang.reflect 中的接口"><CODE>Member</CODE></A>, <A HREF="../Class.html" title="java.lang 中的类"><CODE>Class</CODE></A>, <A HREF="../Class.html#getConstructors()"><CODE>Class.getConstructors()</CODE></A>, <A HREF="../Class.html#getConstructor(java.lang.Class...)"><CODE>Class.getConstructor(Class[])</CODE></A>, <A HREF="../Class.html#getDeclaredConstructors()"><CODE>Class.getDeclaredConstructors()</CODE></A></DL><HR><P><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>字段摘要</B></FONT></TH></TR></TABLE>&nbsp;<A NAME="fields_inherited_from_class_java.lang.reflect.Member"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从接口 java.lang.reflect.<A HREF="Member.html" title="java.lang.reflect 中的接口">Member</A> 继承的字段</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="Member.html#DECLARED">DECLARED</A>, <A HREF="Member.html#PUBLIC">PUBLIC</A></CODE></TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>方法摘要</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#equals(java.lang.Object)">equals</A></B>(<A HREF="../Object.html" title="java.lang 中的类">Object</A>&nbsp;obj)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;将此 <code>Constructor</code> 对象与指定的对象进行比较。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""><TR ALIGN="right" VALIGN=""><TD NOWRAP><FONT SIZE="-1"><CODE>&lt;T extends <A HREF="../annotation/Annotation.html" title="java.lang.annotation 中的接口">Annotation</A>&gt; <BR>T</CODE></FONT></TD></TR></TABLE></CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getAnnotation(java.lang.Class)">getAnnotation</A></B>(<A HREF="../Class.html" title="java.lang 中的类">Class</A>&lt;T&gt;&nbsp;annotationClass)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果存在该元素的指定类型的注释,则返回这些注释,否则返回 null。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../annotation/Annotation.html" title="java.lang.annotation 中的接口">Annotation</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getDeclaredAnnotations()">getDeclaredAnnotations</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回直接存在于此元素上的所有注释。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../Class.html" title="java.lang 中的类">Class</A>&lt;<A HREF="Constructor.html" title="Constructor 中的类型参数">T</A>&gt;</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getDeclaringClass()">getDeclaringClass</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回 <code>Class</code> 对象,该对象表示声明由此 <code>Constructor</code> 对象表示的构造方法的类。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../Class.html" title="java.lang 中的类">Class</A>&lt;?&gt;[]</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getExceptionTypes()">getExceptionTypes</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回一组表示声明要抛出的异常类型的 <code>Class</code> 对象,这些异常是由此 <code>Constructor</code> 对象表示的基础构造方法抛出的。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="Type.html" title="java.lang.reflect 中的接口">Type</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getGenericExceptionTypes()">getGenericExceptionTypes</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回一组 <tt>Type</tt> 对象,这些对象表示声明要由此 <tt>Constructor</tt> 对象抛出的异常。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="Type.html" title="java.lang.reflect 中的接口">Type</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getGenericParameterTypes()">getGenericParameterTypes</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;按照声明顺序返回一组 <tt>Type</tt> 对象,这些对象表示此 <tt>Constructor</tt> 对象所表示的方法的形参类型。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getModifiers()">getModifiers</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以整数形式返回此 <code>Constructor</code> 对象所表示构造方法的 Java 语言修饰符。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getName()">getName</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以字符串形式返回此构造方法的名称。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../annotation/Annotation.html" title="java.lang.annotation 中的接口">Annotation</A>[][]</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getParameterAnnotations()">getParameterAnnotations</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;按照声明顺序返回一组数组,这些数组表示通过此 <tt>Method</tt> 对象表示的方法的形参上的注释。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../Class.html" title="java.lang 中的类">Class</A>&lt;?&gt;[]</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getParameterTypes()">getParameterTypes</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;按照声明顺序返回一组 <code>Class</code> 对象,这些对象表示此 <code>Constructor</code> 对象所表示构造方法的形参类型。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="TypeVariable.html" title="java.lang.reflect 中的接口">TypeVariable</A>&lt;<A HREF="Constructor.html" title="java.lang.reflect 中的类">Constructor</A>&lt;<A HREF="Constructor.html" title="Constructor 中的类型参数">T</A>&gt;&gt;[]</CODE></FONT></TD><TD><CODE><B><A HREF="Constructor.html#getTypeParameters()">getTypeParameters</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;按照声明顺序返回一组 <tt>TypeVariable</tt> 对象,这些对象表示通过此 <tt>GenericDeclaration</tt> 对象所表示的一般声明来声明的类型变量。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

⌨️ 快捷键说明

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