public class BasicAttributes extends Object implements Attributes
基本的属性是大小写敏感的或不区分大小写(忽略大小写)。此属性时确定基本的属性构造函数被调用。在不区分大小写的基本的属性,其属性标识符的情况下被忽略时寻找一个属性,或添加属性。在一个敏感的基本的属性,案情重大。
当基本的属性类需要创建一个属性,它使用BasicAttribute。有没有其他的依赖BasicAttribute。
注意更新基本的属性(如添加或删除属性)不影响相应的目录中的表示。目录的更新只能在DirContext接口使用操作的影响。
一个基本的属性实例不同步对并发多线程访问。多个线程试图访问和修改一个基本属性的实例应该锁定对象。
DirContext.getAttributes(javax.naming.Name)
,
DirContext.modifyAttributes(javax.naming.Name, int, javax.naming.directory.Attributes)
,
DirContext.bind(javax.naming.Name, java.lang.Object, javax.naming.directory.Attributes)
,
DirContext.rebind(javax.naming.Name, java.lang.Object, javax.naming.directory.Attributes)
,
DirContext.createSubcontext(javax.naming.Name, javax.naming.directory.Attributes)
,
DirContext.search(javax.naming.Name, javax.naming.directory.Attributes, java.lang.String[])
,
Serialized Form
Constructor and Description |
---|
BasicAttributes()
构造属性的一个新实例。
|
BasicAttributes(boolean ignoreCase)
构造属性的一个新实例。
|
BasicAttributes(String attrID, Object val)
构造一个属性的属性的新实例。
|
BasicAttributes(String attrID, Object val, boolean ignoreCase)
构造一个属性的属性的新实例。
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
创建并返回此对象的副本。
|
boolean |
equals(Object obj)
决定这是否
BasicAttributes等于另一个
Attributes两
Attributes相等,如果他们是
Attributes两种情况下,治疗属性时ID相同,并包含相同的属性。
|
Attribute |
get(String attrID)
从属性集从给定的属性标识检索属性。
|
NamingEnumeration<Attribute> |
getAll()
检索属性集中的属性的枚举数。
|
NamingEnumeration<String> |
getIDs()
检索属性集中属性的入侵检测系统的枚举数。
|
int |
hashCode()
计算这个基本的属性的哈希代码。
|
boolean |
isCaseIgnored()
确定在检索或添加属性时,属性集是否忽略了属性标识符的情况。
|
Attribute |
put(Attribute attr)
在属性集上添加一个新属性。
|
Attribute |
put(String attrID, Object val)
在属性集上添加一个新属性。
|
Attribute |
remove(String attrID)
删除属性与属性ID的attrid从属性集。
|
int |
size()
检索属性集中的属性的数目。
|
String |
toString()
生成此属性集的字符串表示形式。
|
public BasicAttributes()
public BasicAttributes(boolean ignoreCase)
ignoreCase
属实,属性标识符的字符被忽略的情况下;否则是重要的。
ignoreCase
-真的意味着该属性集将忽略其属性标识符检索或添加属性时的情况;虚假手段是尊重。
public BasicAttributes(String attrID, Object val)
attrID
-非空的属性ID添加。
val
-该属性的值加。如果为空,则将一个空值添加到属性中。
public BasicAttributes(String attrID, Object val, boolean ignoreCase)
ignoreCase
属实,属性标识符的字符被忽略的情况下;否则是重要的。
attrID
-非空的属性ID添加。如果此属性设置无视其属性特征的入侵检测系统,attrid案件被忽略。
val
-该属性的值加。如果为空,则将一个空值添加到属性中。
ignoreCase
-真的意味着该属性集将忽略其属性标识符检索或添加属性时的情况;虚假手段是尊重。
public Object clone()
Object
x
,表达:
将是真实的,并表示:x.clone() != x
将x.clone().getClass() == x.getClass()
true
,但这些都不是绝对的要求。虽然这是通常的情况下,
将x.clone().equals(x)
true
,这不是一个绝对的要求。
按照惯例,返回的对象应该通过调用super.clone
获得。如果一个类和它的所有父类(除Object
)遵守本公约的情况下,这将是x.clone().getClass() == x.getClass()
。
根据惯例,这个方法返回的对象应该是独立于这个对象(正在被克隆)。为了实现这种独立性,需要修改的super.clone
返回对象的一个或多个字段然后返回。通常,这意味着复制任何可变对象,包括内部的“深层结构”被克隆对象的更换与该份对这些对象的引用的参考文献。如果一个类只包含原始字段或对不可变对象的引用,那么它是通常的情况下,通过super.clone
返回的对象中的任何字段需要修改。
类的方法Object
clone
执行特定的复制操作。首先,如果此对象的类不实现接口Cloneable
,然后CloneNotSupportedException
抛出。请注意,所有的数组都被实现的接口Cloneable
,数组类型的clone
T[]
方法的返回类型是T[]
其中T是任何参考或原始类型。否则,此方法创建此对象的类的新实例并初始化与正是这个对象的相应字段内容的各个领域,如分配;字段的内容不克隆自己。因此,该方法执行此对象的“浅副本”,而不是“深复制”操作。
这类Object
本身不实现接口Cloneable
,所以叫clone
方法对一个对象的类是Object
将导致在运行时抛出异常。
clone
接口
Attributes
clone
方法重写,继承类
Object
Cloneable
public boolean isCaseIgnored()
Attributes
isCaseIgnored
接口
Attributes
public int size()
Attributes
size
接口
Attributes
public Attribute get(String attrID)
Attributes
get
接口
Attributes
attrID
-非空的ID属性来检索。如果此属性设置无视其属性特征的入侵检测系统,attrid案件被忽略。
Attributes.put(java.lang.String, java.lang.Object)
,
Attributes.remove(java.lang.String)
public NamingEnumeration<Attribute> getAll()
Attributes
getAll
接口
Attributes
public NamingEnumeration<String> getIDs()
Attributes
getIDs
接口
Attributes
public Attribute put(String attrID, Object val)
Attributes
put
接口
Attributes
attrID
-非空的属性ID添加。如果属性集无视其属性特征的入侵检测系统的情况下,attrid案件被忽略。
val
-属性的可能值增加。如果为空,该属性不具有任何值。
Attributes.remove(java.lang.String)
public Attribute put(Attribute attr)
Attributes
put
接口
Attributes
attr
-非空属性添加。如果属性集无视其属性标识字符的情况下,以属性的标识符被忽视。
Attributes.remove(java.lang.String)
public Attribute remove(String attrID)
Attributes
remove
接口
Attributes
attrID
-非空的ID属性删除。如果属性集无视其属性特征的入侵检测系统的情况下,attrid案件被忽略。
public String toString()
public boolean equals(Object obj)
equals
方法重写,继承类
Object
obj
-比较可能的空对象。
hashCode()
public int hashCode()
通过添加此对象的属性的哈希代码来计算哈希代码。如果这个基本的属性无视其属性ID的情况下,一个是添加到哈希代码。如果子类重写hashCode(),它应该覆盖equals()这样两Attributes实例相等,具有相同的哈希代码。
hashCode
方法重写,继承类
Object
equals(java.lang.Object)
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.