Path: blob/master/src/java.naming/share/classes/javax/naming/directory/Attributes.java
41159 views
/*1* Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526package javax.naming.directory;2728import java.util.Hashtable;29import java.util.Enumeration;3031import javax.naming.NamingException;32import javax.naming.NamingEnumeration;3334/**35* This interface represents a collection of attributes.36*<p>37* In a directory, named objects can have associated with them38* attributes. The Attributes interface represents a collection of attributes.39* For example, you can request from the directory the attributes40* associated with an object. Those attributes are returned in41* an object that implements the Attributes interface.42*<p>43* Attributes in an object that implements the Attributes interface are44* unordered. The object can have zero or more attributes.45* Attributes is either case-sensitive or case-insensitive (case-ignore).46* This property is determined at the time the Attributes object is47* created. (see BasicAttributes constructor for example).48* In a case-insensitive Attributes, the case of its attribute identifiers49* is ignored when searching for an attribute, or adding attributes.50* In a case-sensitive Attributes, the case is significant.51*<p>52* Note that updates to Attributes (such as adding or removing an attribute)53* do not affect the corresponding representation in the directory.54* Updates to the directory can only be effected55* using operations in the DirContext interface.56*57* @author Rosanna Lee58* @author Scott Seligman59*60* @see DirContext#getAttributes61* @see DirContext#modifyAttributes62* @see DirContext#bind63* @see DirContext#rebind64* @see DirContext#createSubcontext65* @see DirContext#search66* @see BasicAttributes67* @since 1.368*/6970public interface Attributes extends Cloneable, java.io.Serializable {71/**72* Determines whether the attribute set ignores the case of73* attribute identifiers when retrieving or adding attributes.74* @return true if case is ignored; false otherwise.75*/76boolean isCaseIgnored();7778/**79* Retrieves the number of attributes in the attribute set.80*81* @return The nonnegative number of attributes in this attribute set.82*/83int size();8485/**86* Retrieves the attribute with the given attribute id from the87* attribute set.88*89* @param attrID The non-null id of the attribute to retrieve.90* If this attribute set ignores the character91* case of its attribute ids, the case of attrID92* is ignored.93* @return The attribute identified by attrID; null if not found.94* @see #put95* @see #remove96*/97Attribute get(String attrID);9899/**100* Retrieves an enumeration of the attributes in the attribute set.101* The effects of updates to this attribute set on this enumeration102* are undefined.103*104* @return A non-null enumeration of the attributes in this attribute set.105* Each element of the enumeration is of class {@code Attribute}.106* If attribute set has zero attributes, an empty enumeration107* is returned.108*/109NamingEnumeration<? extends Attribute> getAll();110111/**112* Retrieves an enumeration of the ids of the attributes in the113* attribute set.114* The effects of updates to this attribute set on this enumeration115* are undefined.116*117* @return A non-null enumeration of the attributes' ids in118* this attribute set. Each element of the enumeration is119* of class String.120* If attribute set has zero attributes, an empty enumeration121* is returned.122*/123NamingEnumeration<String> getIDs();124125/**126* Adds a new attribute to the attribute set.127*128* @param attrID non-null The id of the attribute to add.129* If the attribute set ignores the character130* case of its attribute ids, the case of attrID131* is ignored.132* @param val The possibly null value of the attribute to add.133* If null, the attribute does not have any values.134* @return The Attribute with attrID that was previous in this attribute set;135* null if no such attribute existed.136* @see #remove137*/138Attribute put(String attrID, Object val);139140/**141* Adds a new attribute to the attribute set.142*143* @param attr The non-null attribute to add.144* If the attribute set ignores the character145* case of its attribute ids, the case of146* attr's identifier is ignored.147* @return The Attribute with the same ID as attr that was previous148* in this attribute set;149* null if no such attribute existed.150* @see #remove151*/152Attribute put(Attribute attr);153154/**155* Removes the attribute with the attribute id 'attrID' from156* the attribute set. If the attribute does not exist, ignore.157*158* @param attrID The non-null id of the attribute to remove.159* If the attribute set ignores the character160* case of its attribute ids, the case of161* attrID is ignored.162* @return The Attribute with the same ID as attrID that was previous163* in the attribute set;164* null if no such attribute existed.165*/166Attribute remove(String attrID);167168/**169* Makes a copy of the attribute set.170* The new set contains the same attributes as the original set:171* the attributes are not themselves cloned.172* Changes to the copy will not affect the original and vice versa.173*174* @return A non-null copy of this attribute set.175*/176Object clone();177178/**179* Use serialVersionUID from JNDI 1.1.1 for interoperability180*/181// static final long serialVersionUID = -7247874645443605347L;182}183184185