C# Class Novell.Directory.Ldap.LdapAttributeSet

A set of {@link LdapAttribute} objects. An LdapAttributeSet is a collection of LdapAttribute classes as returned from an LdapEntry on a search or read operation. LdapAttributeSet may be also used to contruct an entry to be added to a directory. If the add() or addAll() methods are called and one or more of the objects to be added is not an LdapAttribute, ClassCastException is thrown (as discussed in the documentation for java.util.Collection).
Inheritance: SupportClass.AbstractSetSupport, System.ICloneable
显示文件 Open project: EventStore/csharp-ldap Class Usage Examples

Public Methods

Method Description
Add ( object attr ) : bool

Adds the specified attribute to this set if it is not already present. If an attribute with the same name already exists in the set then the specified attribute will not be added.

AddAll ( System c ) : bool

Adds all LdapAttribute objects in the specified collection to this collection.

Clear ( ) : void

Removes all of the elements from this set.

Clone ( ) : Object

Returns a deep copy of this attribute set.

Contains ( object attr ) : bool

Returns true if this set contains an attribute of the same name as the specified attribute.

GetEnumerator ( ) : System.Collections.IEnumerator

Returns an iterator over the attributes in this set. The attributes returned from this iterator are not in any particular order.

IsEmpty ( ) : bool

Returns true if this set contains no elements

LdapAttributeSet ( ) : System

Constructs an empty set of attributes.

Remove ( object object_Renamed ) : bool

Removes the specified object from this set if it is present. If the specified object is of type LdapAttribute, the specified attribute will be removed. If the specified object is of type String, the attribute with a name that matches the string will be removed.

ToString ( ) : System.String

Returns a string representation of this LdapAttributeSet

getAttribute ( System attrName ) : LdapAttribute

Returns the attribute matching the specified attrName. For example:

  • getAttribute("cn") returns only the "cn" attribute
  • getAttribute("cn;lang-en") returns only the "cn;lang-en" attribute.
In both cases, null is returned if there is no exact match to the specified attrName. Note: Novell eDirectory does not currently support language subtypes. It does support the "binary" subtype.

getAttribute ( System attrName, System lang ) : LdapAttribute

Returns a single best-match attribute, or null if no match is available in the entry. Ldap version 3 allows adding a subtype specification to an attribute name. For example, "cn;lang-ja" indicates a Japanese language subtype of the "cn" attribute and "cn;lang-ja-JP-kanji" may be a subtype of "cn;lang-ja". This feature may be used to provide multiple localizations in the same directory. For attributes which do not vary among localizations, only the base attribute may be stored, whereas for others there may be varying degrees of specialization. For example, getAttribute(attrName,lang) returns the LdapAttribute that exactly matches attrName and that best matches lang. If there are subtypes other than "lang" subtypes included in attrName, for example, "cn;binary", only attributes with all of those subtypes are returned. If lang is null or empty, the method behaves as getAttribute(attrName). If there are no matching attributes, null is returned. Assume the entry contains only the following attributes:

  • cn;lang-en
  • cn;lang-ja-JP-kanji
  • sn
Examples:
  • getAttribute( "cn" ) returns null.
  • getAttribute( "sn" ) returns the "sn" attribute.
  • getAttribute( "cn", "lang-en-us" ) returns the "cn;lang-en" attribute.
  • getAttribute( "cn", "lang-en" ) returns the "cn;lang-en" attribute.
  • getAttribute( "cn", "lang-ja" ) returns null.
  • getAttribute( "sn", "lang-en" ) returns the "sn" attribute.
Note: Novell eDirectory does not currently support language subtypes. It does support the "binary" subtype.

getSubset ( System subtype ) : LdapAttributeSet

Creates a new attribute set containing only the attributes that have the specified subtypes. For example, suppose an attribute set contains the following attributes:

  • cn
  • cn;lang-ja
  • sn;phonetic;lang-ja
  • sn;lang-us
Calling the getSubset method and passing lang-ja as the argument, the method returns an attribute set containing the following attributes:
  • cn;lang-ja
  • sn;phonetic;lang-ja

Method Details

Add() public method

Adds the specified attribute to this set if it is not already present. If an attribute with the same name already exists in the set then the specified attribute will not be added.
public Add ( object attr ) : bool
attr object Object of type LdapAttribute /// ///
return bool

AddAll() public method

Adds all LdapAttribute objects in the specified collection to this collection.
public AddAll ( System c ) : bool
c System Collection of LdapAttribute objects. /// /// @throws ClassCastException occurs when an element in the /// collection is not of type LdapAttribute. /// ///
return bool

Clear() public method

Removes all of the elements from this set.
public Clear ( ) : void
return void

Clone() public method

Returns a deep copy of this attribute set.
public Clone ( ) : Object
return System.Object

Contains() public method

Returns true if this set contains an attribute of the same name as the specified attribute.
public Contains ( object attr ) : bool
attr object Object of type LdapAttribute /// ///
return bool

GetEnumerator() public method

Returns an iterator over the attributes in this set. The attributes returned from this iterator are not in any particular order.
public GetEnumerator ( ) : System.Collections.IEnumerator
return System.Collections.IEnumerator

IsEmpty() public method

Returns true if this set contains no elements
public IsEmpty ( ) : bool
return bool

LdapAttributeSet() public method

Constructs an empty set of attributes.
public LdapAttributeSet ( ) : System
return System

Remove() public method

Removes the specified object from this set if it is present. If the specified object is of type LdapAttribute, the specified attribute will be removed. If the specified object is of type String, the attribute with a name that matches the string will be removed.
public Remove ( object object_Renamed ) : bool
object_Renamed object
return bool

ToString() public method

Returns a string representation of this LdapAttributeSet
public ToString ( ) : System.String
return System.String

getAttribute() public method

Returns the attribute matching the specified attrName. For example:
  • getAttribute("cn") returns only the "cn" attribute
  • getAttribute("cn;lang-en") returns only the "cn;lang-en" attribute.
In both cases, null is returned if there is no exact match to the specified attrName. Note: Novell eDirectory does not currently support language subtypes. It does support the "binary" subtype.
public getAttribute ( System attrName ) : LdapAttribute
attrName System The name of an attribute to retrieve, with or without /// subtype specifications. For example, "cn", "cn;phonetic", and /// "cn;binary" are valid attribute names. /// ///
return LdapAttribute

getAttribute() public method

Returns a single best-match attribute, or null if no match is available in the entry. Ldap version 3 allows adding a subtype specification to an attribute name. For example, "cn;lang-ja" indicates a Japanese language subtype of the "cn" attribute and "cn;lang-ja-JP-kanji" may be a subtype of "cn;lang-ja". This feature may be used to provide multiple localizations in the same directory. For attributes which do not vary among localizations, only the base attribute may be stored, whereas for others there may be varying degrees of specialization. For example, getAttribute(attrName,lang) returns the LdapAttribute that exactly matches attrName and that best matches lang. If there are subtypes other than "lang" subtypes included in attrName, for example, "cn;binary", only attributes with all of those subtypes are returned. If lang is null or empty, the method behaves as getAttribute(attrName). If there are no matching attributes, null is returned. Assume the entry contains only the following attributes:
  • cn;lang-en
  • cn;lang-ja-JP-kanji
  • sn
Examples:
  • getAttribute( "cn" ) returns null.
  • getAttribute( "sn" ) returns the "sn" attribute.
  • getAttribute( "cn", "lang-en-us" ) returns the "cn;lang-en" attribute.
  • getAttribute( "cn", "lang-en" ) returns the "cn;lang-en" attribute.
  • getAttribute( "cn", "lang-ja" ) returns null.
  • getAttribute( "sn", "lang-en" ) returns the "sn" attribute.
Note: Novell eDirectory does not currently support language subtypes. It does support the "binary" subtype.
public getAttribute ( System attrName, System lang ) : LdapAttribute
attrName System The name of an attribute to retrieve, with or without /// subtype specifications. For example, "cn", "cn;phonetic", and /// cn;binary" are valid attribute names. /// ///
lang System A language specification with optional subtypes /// appended using "-" as separator. For example, "lang-en", "lang-en-us", /// "lang-ja", and "lang-ja-JP-kanji" are valid language specification. /// ///
return LdapAttribute

getSubset() public method

Creates a new attribute set containing only the attributes that have the specified subtypes. For example, suppose an attribute set contains the following attributes:
  • cn
  • cn;lang-ja
  • sn;phonetic;lang-ja
  • sn;lang-us
Calling the getSubset method and passing lang-ja as the argument, the method returns an attribute set containing the following attributes:
  • cn;lang-ja
  • sn;phonetic;lang-ja
public getSubset ( System subtype ) : LdapAttributeSet
subtype System Semi-colon delimited list of subtypes to include. For /// example: ///
    ///
  • "lang-ja" specifies only Japanese language subtypes
  • ///
  • "binary" specifies only binary subtypes
  • ///
  • "binary;lang-ja" specifies only Japanese language subtypes /// which also are binary
  • ///
/// /// Note: Novell eDirectory does not currently support language subtypes. /// It does support the "binary" subtype. /// ///
return LdapAttributeSet