📄 name.html
字号:
based on lexicographical ordering of the name components. Specific attributes of the name, such as how it treats case, may affect the ordering. In general, two names of different classes may not be compared.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - the non-null object to compare against.<DT><B>Returns:</B><DD>a negative integer, zero, or a positive integer as this name is less than, equal to, or greater than the given name<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassCastException.html">ClassCastException</A></CODE> - if obj is not a <tt>Name</tt> of a type that may be compared with this name<DT><B>See Also: </B><DD><A HREF="../../java/lang/Comparable.html#compareTo(java.lang.Object)"><CODE>Comparable.compareTo(Object)</CODE></A></DL></DD></DL><HR><A NAME="size()"><!-- --></A><H3>size</H3><PRE>public int <B>size</B>()</PRE><DL><DD>Returns the number of components in this name.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of components in this name</DL></DD></DL><HR><A NAME="isEmpty()"><!-- --></A><H3>isEmpty</H3><PRE>public boolean <B>isEmpty</B>()</PRE><DL><DD>Determines whether this name is empty. An empty name is one with zero components.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>true if this name is empty, false otherwise</DL></DD></DL><HR><A NAME="getAll()"><!-- --></A><H3>getAll</H3><PRE>public <A HREF="../../java/util/Enumeration.html">Enumeration</A> <B>getAll</B>()</PRE><DL><DD>Retrieves the components of this name as an enumeration of strings. The effect on the enumeration of updates to this name is undefined. If the name has zero components, an empty (non-null) enumeration is returned.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>an enumeration of the components of this name, each a string</DL></DD></DL><HR><A NAME="get(int)"><!-- --></A><H3>get</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>get</B>(int posn)</PRE><DL><DD>Retrieves a component of this name.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>posn</CODE> - the 0-based index of the component to retrieve. Must be in the range [0,size()).<DT><B>Returns:</B><DD>the component at index posn<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if posn is outside the specified range</DL></DD></DL><HR><A NAME="getPrefix(int)"><!-- --></A><H3>getPrefix</H3><PRE>public <A HREF="../../javax/naming/Name.html">Name</A> <B>getPrefix</B>(int posn)</PRE><DL><DD>Creates a name whose components consist of a prefix of the components of this name. Subsequent changes to this name will not affect the name that is returned and vice versa.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>posn</CODE> - the 0-based index of the component at which to stop. Must be in the range [0,size()].<DT><B>Returns:</B><DD>a name consisting of the components at indexes in the range [0,posn).<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if posn is outside the specified range</DL></DD></DL><HR><A NAME="getSuffix(int)"><!-- --></A><H3>getSuffix</H3><PRE>public <A HREF="../../javax/naming/Name.html">Name</A> <B>getSuffix</B>(int posn)</PRE><DL><DD>Creates a name whose components consist of a suffix of the components in this name. Subsequent changes to this name do not affect the name that is returned and vice versa.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>posn</CODE> - the 0-based index of the component at which to start. Must be in the range [0,size()].<DT><B>Returns:</B><DD>a name consisting of the components at indexes in the range [posn,size()). If posn is equal to size(), an empty name is returned.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if posn is outside the specified range</DL></DD></DL><HR><A NAME="startsWith(javax.naming.Name)"><!-- --></A><H3>startsWith</H3><PRE>public boolean <B>startsWith</B>(<A HREF="../../javax/naming/Name.html">Name</A> n)</PRE><DL><DD>Determines whether this name starts with a specified prefix. A name <tt>n</tt> is a prefix if it is equal to <tt>getPrefix(n.size())</tt>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - the name to check<DT><B>Returns:</B><DD>true if <tt>n</tt> is a prefix of this name, false otherwise</DL></DD></DL><HR><A NAME="endsWith(javax.naming.Name)"><!-- --></A><H3>endsWith</H3><PRE>public boolean <B>endsWith</B>(<A HREF="../../javax/naming/Name.html">Name</A> n)</PRE><DL><DD>Determines whether this name ends with a specified suffix. A name <tt>n</tt> is a suffix if it is equal to <tt>getSuffix(size()-n.size())</tt>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - the name to check<DT><B>Returns:</B><DD>true if <tt>n</tt> is a suffix of this name, false otherwise</DL></DD></DL><HR><A NAME="addAll(javax.naming.Name)"><!-- --></A><H3>addAll</H3><PRE>public <A HREF="../../javax/naming/Name.html">Name</A> <B>addAll</B>(<A HREF="../../javax/naming/Name.html">Name</A> suffix) throws <A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></PRE><DL><DD>Adds the components of a name -- in order -- to the end of this name.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>suffix</CODE> - the components to add<DT><B>Returns:</B><DD>the updated name (not a new one)<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></CODE> - if <tt>suffix</tt> is not a valid name, or if the addition of the components would violate the syntax rules of this name</DL></DD></DL><HR><A NAME="addAll(int, javax.naming.Name)"><!-- --></A><H3>addAll</H3><PRE>public <A HREF="../../javax/naming/Name.html">Name</A> <B>addAll</B>(int posn, <A HREF="../../javax/naming/Name.html">Name</A> n) throws <A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></PRE><DL><DD>Adds the components of a name -- in order -- at a specified position within this name. Components of this name at or after the index of the first new component are shifted up (away from 0) to accommodate the new components.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>n</CODE> - the components to add<DD><CODE>posn</CODE> - the index in this name at which to add the new components. Must be in the range [0,size()].<DT><B>Returns:</B><DD>the updated name (not a new one)<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if posn is outside the specified range<DD><CODE><A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></CODE> - if <tt>n</tt> is not a valid name, or if the addition of the components would violate the syntax rules of this name</DL></DD></DL><HR><A NAME="add(java.lang.String)"><!-- --></A><H3>add</H3><PRE>public <A HREF="../../javax/naming/Name.html">Name</A> <B>add</B>(<A HREF="../../java/lang/String.html">String</A> comp) throws <A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></PRE><DL><DD>Adds a single component to the end of this name.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>comp</CODE> - the component to add<DT><B>Returns:</B><DD>the updated name (not a new one)<DT><B>Throws:</B><DD><CODE><A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></CODE> - if adding <tt>comp</tt> would violate the syntax rules of this name</DL></DD></DL><HR><A NAME="add(int, java.lang.String)"><!-- --></A><H3>add</H3><PRE>public <A HREF="../../javax/naming/Name.html">Name</A> <B>add</B>(int posn, <A HREF="../../java/lang/String.html">String</A> comp) throws <A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></PRE><DL><DD>Adds a single component at a specified position within this name. Components of this name at or after the index of the new component are shifted up by one (away from index 0) to accommodate the new component.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>comp</CODE> - the component to add<DD><CODE>posn</CODE> - the index at which to add the new component. Must be in the range [0,size()].<DT><B>Returns:</B><DD>the updated name (not a new one)<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if posn is outside the specified range<DD><CODE><A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></CODE> - if adding <tt>comp</tt> would violate the syntax rules of this name</DL></DD></DL><HR><A NAME="remove(int)"><!-- --></A><H3>remove</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>remove</B>(int posn) throws <A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></PRE><DL><DD>Removes a component from this name. The component of this name at the specified position is removed. Components with indexes greater than this position are shifted down (toward index 0) by one.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>posn</CODE> - the index of the component to remove. Must be in the range [0,size()).<DT><B>Returns:</B><DD>the component removed (a String)<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</A></CODE> - if posn is outside the specified range<DD><CODE><A HREF="../../javax/naming/InvalidNameException.html">InvalidNameException</A></CODE> - if deleting the component would violate the syntax rules of the name</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Name.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/naming/Context.html"><B>PREV CLASS</B></A> <A HREF="../../javax/naming/NameParser.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Name.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -