src/java.naming/share/classes/javax/naming/directory/Attribute.java
author darcy
Fri, 17 Aug 2018 13:37:01 -0700
changeset 51437 6221a199ec20
parent 51317 e122220d7d7e
permissions -rw-r--r--
8209304: Deprecate serialVersionUID fields in interfaces Reviewed-by: lancea, mullan, rriggs, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
51317
e122220d7d7e 8209024: Use SuppressWarnings on serialVersionUID fields in interfaces
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.naming.directory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.NoSuchElementException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.naming.NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.naming.NamingEnumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.naming.OperationNotSupportedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  * This interface represents an attribute associated with a named object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  * In a directory, named objects can have associated with them
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    40
  * attributes.  The {@code Attribute} interface represents an attribute associated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  * with a named object.  An attribute contains 0 or more, possibly null, values.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    42
  * The attribute values can be ordered or unordered (see {@code isOrdered()}).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
  * If the values are unordered, no duplicates are allowed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
  * If the values are ordered, duplicates are allowed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
  *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  * The content and representation of an attribute and its values is defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  * the attribute's <em>schema</em>. The schema contains information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  * about the attribute's syntax and other properties about the attribute.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    49
  * See {@code getAttributeDefinition()} and
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    50
  * {@code getAttributeSyntaxDefinition()}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
  * for details regarding how to get schema information about an attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
  * if the underlying directory service supports schemas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
  *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
  * Equality of two attributes is determined by the implementation class.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    55
  * A simple implementation can use {@code Object.equals()} to determine equality
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
  * of attribute values, while a more sophisticated implementation might
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  * make use of schema information to determine equality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  * Similarly, one implementation might provide a static storage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  * structure which simply returns the values passed to its
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    60
  * constructor, while another implementation might define {@code get()} and
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    61
  * {@code getAll()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
  * to get the values dynamically from the directory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
  *<p>
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    64
  * Note that updates to {@code Attribute} (such as adding or removing a
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
  * value) do not affect the corresponding representation of the attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  * in the directory.  Updates to the directory can only be effected
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
    67
  * using operations in the {@code DirContext} interface.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  * @see BasicAttribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
  * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
public interface Attribute extends Cloneable, java.io.Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
      * Retrieves an enumeration of the attribute's values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
      * The behaviour of this enumeration is unspecified
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
      * if the attribute's values are added, changed,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
      * or removed while the enumeration is in progress.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
      * If the attribute values are ordered, the enumeration's items
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
      * will be ordered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
      * @return A non-null enumeration of the attribute's values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
      * Each element of the enumeration is a possibly null Object. The object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
      * class is the class of the attribute value. The element is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
      * if the attribute's value is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
      * If the attribute has zero values, an empty enumeration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
      * is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
      * @exception NamingException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
      *         If a naming exception was encountered while retrieving
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
      *         the values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
      * @see #isOrdered
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    NamingEnumeration<?> getAll() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
      * Retrieves one of this attribute's values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
      * If the attribute has more than one value and is unordered, any one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
      * the values is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
      * If the attribute has more than one value and is ordered, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
      * first value is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
      * @return A possibly null object representing one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
      *        the attribute's value. It is null if the attribute's value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      *        is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
      * @exception NamingException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
      *         If a naming exception was encountered while retrieving
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
      *         the value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
      * @exception java.util.NoSuchElementException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
      *         If this attribute has no values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    Object get() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
      * Retrieves the number of values in this attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
      * @return The nonnegative number of values in this attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    int size();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
      * Retrieves the id of this attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
      * @return The id of this attribute. It cannot be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    String getID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
      * Determines whether a value is in the attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
      * Equality is determined by the implementation, which may use
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   132
      * {@code Object.equals()} or schema information to determine equality.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
      * @param attrVal The possibly null value to check. If null, check
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
      *  whether the attribute has an attribute value whose value is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
      * @return true if attrVal is one of this attribute's values; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
      * @see java.lang.Object#equals
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
      * @see BasicAttribute#equals
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    boolean contains(Object attrVal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
      * Adds a new value to the attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
      * If the attribute values are unordered and
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   144
      * {@code attrVal} is already in the attribute, this method does nothing.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   145
      * If the attribute values are ordered, {@code attrVal} is added to the end of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
      * the list of attribute values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
      *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
      * Equality is determined by the implementation, which may use
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   149
      * {@code Object.equals()} or schema information to determine equality.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
      * @param attrVal The new possibly null value to add. If null, null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
      *  is added as an attribute value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
      * @return true if a value was added; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    boolean add(Object attrVal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
      * Removes a specified value from the attribute.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   159
      * If {@code attrval} is not in the attribute, this method does nothing.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
      * If the attribute values are ordered, the first occurrence of
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   161
      * {@code attrVal} is removed and attribute values at indices greater
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
      * than the removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
      * value are shifted up towards the head of the list (and their indices
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
      * decremented by one).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
      *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
      * Equality is determined by the implementation, which may use
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   167
      * {@code Object.equals()} or schema information to determine equality.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
      * @param attrval The possibly null value to remove from this attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
      * If null, remove the attribute value that is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      * @return true if the value was removed; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    boolean remove(Object attrval);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
      * Removes all values from this attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    void clear();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
      * Retrieves the syntax definition associated with the attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
      * An attribute's syntax definition specifies the format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
      * of the attribute's value(s). Note that this is different from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
      * the attribute value's representation as a Java object. Syntax
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
      * definition refers to the directory's notion of <em>syntax</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
      *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
      * For example, even though a value might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
      * a Java String object, its directory syntax might be "Printable String"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
      * or "Telephone Number". Or a value might be a byte array, and its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
      * directory syntax is "JPEG" or "Certificate".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
      * For example, if this attribute's syntax is "JPEG",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
      * this method would return the syntax definition for "JPEG".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
      * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
      * The information that you can retrieve from a syntax definition
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
      * is directory-dependent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
      *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
      * If an implementation does not support schemas, it should throw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
      * OperationNotSupportedException. If an implementation does support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
      * schemas, it should define this method to return the appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
      * information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
      * @return The attribute's syntax definition. Null if the implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
      *    supports schemas but this particular attribute does not have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
      *    any schema information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
      * @exception OperationNotSupportedException If getting the schema
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
      *         is not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
      * @exception NamingException If a naming exception occurs while getting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
      *         the schema.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    DirContext getAttributeSyntaxDefinition() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
      * Retrieves the attribute's schema definition.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
      * An attribute's schema definition contains information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
      * such as whether the attribute is multivalued or single-valued,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
      * the matching rules to use when comparing the attribute's values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
      * The information that you can retrieve from an attribute definition
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
      * is directory-dependent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
      *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
      * If an implementation does not support schemas, it should throw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
      * OperationNotSupportedException. If an implementation does support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
      * schemas, it should define this method to return the appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
      * information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
      * @return This attribute's schema definition. Null if the implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
      *     supports schemas but this particular attribute does not have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
      *     any schema information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
      * @exception OperationNotSupportedException If getting the schema
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
      *         is not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
      * @exception NamingException If a naming exception occurs while getting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
      *         the schema.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    DirContext getAttributeDefinition() throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
      * Makes a copy of the attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
      * The copy contains the same attribute values as the original attribute:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
      * the attribute values are not themselves cloned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
      * Changes to the copy will not affect the original and vice versa.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
      * @return A non-null copy of the attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    Object clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    //----------- Methods to support ordered multivalued attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
      * Determines whether this attribute's values are ordered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
      * If an attribute's values are ordered, duplicate values are allowed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      * If an attribute's values are unordered, they are presented
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
      * in any order and there are no duplicate values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
      * @return true if this attribute's values are ordered; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
      * @see #get(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
      * @see #remove(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
      * @see #add(int, java.lang.Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
      * @see #set(int, java.lang.Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    boolean isOrdered();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * Retrieves the attribute value from the ordered list of attribute values.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   263
     * This method returns the value at the {@code ix} index of the list of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * attribute values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * If the attribute values are unordered,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * this method returns the value that happens to be at that index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * @param ix The index of the value in the ordered list of attribute values.
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
   268
     * {@code 0 <= ix < size()}.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   269
     * @return The possibly null attribute value at index {@code ix};
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *   null if the attribute value is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * @exception NamingException If a naming exception was encountered while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * retrieving the value.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   273
     * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    Object get(int ix) throws NamingException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * Removes an attribute value from the ordered list of attribute values.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   279
     * This method removes the value at the {@code ix} index of the list of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * attribute values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * If the attribute values are unordered,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * this method removes the value that happens to be at that index.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   283
     * Values located at indices greater than {@code ix} are shifted up towards
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * the front of the list (and their indices decremented by one).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * @param ix The index of the value to remove.
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
   287
     * {@code 0 <= ix < size()}.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   288
     * @return The possibly null attribute value at index {@code ix} that was removed;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     *   null if the attribute value is null.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   290
     * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    Object remove(int ix);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * Adds an attribute value to the ordered list of attribute values.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   296
     * This method adds {@code attrVal} to the list of attribute values at
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   297
     * index {@code ix}.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   298
     * Values located at indices at or greater than {@code ix} are
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * shifted down towards the end of the list (and their indices incremented
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * by one).
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   301
     * If the attribute values are unordered and already have {@code attrVal},
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   302
     * {@code IllegalStateException} is thrown.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @param ix The index in the ordered list of attribute values to add the new value.
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
   305
     * {@code 0 <= ix <= size()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @param attrVal The possibly null attribute value to add; if null, null is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * the value added.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   308
     * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @exception IllegalStateException If the attribute values are unordered and
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   310
     * {@code attrVal} is one of those values.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    void add(int ix, Object attrVal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * Sets an attribute value in the ordered list of attribute values.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   317
     * This method sets the value at the {@code ix} index of the list of
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   318
     * attribute values to be {@code attrVal}. The old value is removed.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * If the attribute values are unordered,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * this method sets the value that happens to be at that index
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   321
     * to {@code attrVal}, unless {@code attrVal} is already one of the values.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   322
     * In that case, {@code IllegalStateException} is thrown.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @param ix The index of the value in the ordered list of attribute values.
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 5506
diff changeset
   325
     * {@code 0 <= ix < size()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * @param attrVal The possibly null attribute value to use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * If null, 'null' replaces the old value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * @return The possibly null attribute value at index ix that was replaced.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *   Null if the attribute value was null.
32029
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   330
     * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
a5538163e144 8132877: docs: replace <tt> tags (obsolete in html5) for javax.naming
avstepan
parents: 25859
diff changeset
   331
     * @exception IllegalStateException If {@code attrVal} already exists and the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     *    attribute values are unordered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    Object set(int ix, Object attrVal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * Use serialVersionUID from JNDI 1.1.1 for interoperability.
51437
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
   338
     *
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
   339
     * @deprecated A {@code serialVersionUID} field in an interface is
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
   340
     * ineffectual. Do not use; no replacement.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     */
51437
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
   342
    @Deprecated
6221a199ec20 8209304: Deprecate serialVersionUID fields in interfaces
darcy
parents: 51317
diff changeset
   343
    @SuppressWarnings("serial")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    static final long serialVersionUID = 8707690322213556804L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
}