public interface Name extends Cloneable, Serializable, Comparable<Object>
可以有不同的实现Name;例如,复合材料的名称,网址,或指定命名空间的复合名字。
名称的组件被编号。n个组件的名称的索引范围从0到,但不包括,这个范围可以写为[ 0,n)。最重要的组成部分是指数0。一个空名称没有组件。
此接口中的方法没有接受为参数的有效值,该参数是一个名称或一个名称组件。同样,返回一个名称或名称组件的方法永远不会返回空。
一个Name实例可能不同步的并发多线程访问,访问如果不是只读的。
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID
设置为表示与类的前一个版本的序列化兼容性的类的指纹。
|
Modifier and Type | Method and Description |
---|---|
Name |
add(int posn, String comp)
在这个名称中在指定位置添加一个单一组件。
|
Name |
add(String comp)
在这个名称的结尾添加一个单一组件。
|
Name |
addAll(int posn, Name n)
在这个名称中添加一个名称的组件-在一个指定的位置。
|
Name |
addAll(Name suffix)
添加一个名称的组件-以-到这个名称的结尾。
|
Object |
clone()
生成此名称的新副本。
|
int |
compareTo(Object obj)
将此名称与另一个名称进行比较。
|
boolean |
endsWith(Name n)
确定这个名称是否以指定的后缀结束。
|
String |
get(int posn)
检索此名称的一个组件。
|
Enumeration<String> |
getAll()
检索此名称的组件作为字符串的枚举。
|
Name |
getPrefix(int posn)
创建一个由该名称的组件的前缀组成的名称。
|
Name |
getSuffix(int posn)
创建一个由该名称中的组件的后缀组成的名称。
|
boolean |
isEmpty()
确定此名称是否为空。
|
Object |
remove(int posn)
从这个名称中删除一个组件。
|
int |
size()
返回这个名称中的组件的数量。
|
boolean |
startsWith(Name n)
确定此名称是否以指定的前缀开始。
|
static final long serialVersionUID
Object clone()
Object.clone()
int compareTo(Object obj)
与Object.equals(),命令名称的概念取决于实现该接口的类。例如,排序可以根据名称组成的字典序。具体属性的名称,如它如何对待的情况下,可能会影响排序。在一般情况下,两个不同类别的名称可能无法进行比较。
compareTo
接口
Comparable<Object>
obj
-非null对象比较。
ClassCastException
如果obj是不
Name一型可能与这个名字比较
Comparable.compareTo(Object)
int size()
boolean isEmpty()
Enumeration<String> getAll()
String get(int posn)
posn
- 0的构件检索索引。必须在范围[ 0,size())。
ArrayIndexOutOfBoundsException
如果位置是在指定范围内
Name getPrefix(int posn)
posn
- 0指数的成分停止。必须在范围[ 0 ],size()。
ArrayIndexOutOfBoundsException
如果位置是在指定范围内
Name getSuffix(int posn)
posn
- 0开始索引处的组件开始。必须在范围[ 0 ],size()。
ArrayIndexOutOfBoundsException
如果位置是在指定范围内
boolean startsWith(Name n)
n
-名称检查
boolean endsWith(Name n)
n
-名称检查
Name addAll(Name suffix) throws InvalidNameException
suffix
-添加组件
InvalidNameException
-如果
suffix不是有效名称,或者如果组件的添加会违反这个名字的语法规则
Name addAll(int posn, Name n) throws InvalidNameException
n
-添加组件
posn
-这个名字的索引添加新组件。必须在范围[ 0 ],size()。
ArrayIndexOutOfBoundsException
如果位置是在指定范围内
InvalidNameException
-如果
n不是有效名称,或者如果组件的添加会违反这个名字的语法规则
Name add(String comp) throws InvalidNameException
comp
-添加组件
InvalidNameException
如果添加
comp会违反这个名字的语法规则
Name add(int posn, String comp) throws InvalidNameException
comp
-添加组件
posn
-的索引添加新组件。必须在范围[ 0 ],size()。
ArrayIndexOutOfBoundsException
如果位置是在指定范围内
InvalidNameException
如果添加
comp会违反这个名字的语法规则
Object remove(int posn) throws InvalidNameException
posn
-组件删除索引。必须在范围[ 0,size())。
ArrayIndexOutOfBoundsException
如果位置是在指定范围内
InvalidNameException
如果删除组件会违反语法规则的名称
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, 2014, Oracle and/or its affiliates. All rights reserved.