Java Doc for BasicAttribute.java in  » 6.0-JDK-Core » naming » javax » naming » directory » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » naming » javax.naming.directory 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.naming.directory.BasicAttribute

BasicAttribute
public class BasicAttribute implements Attribute(Code)
This class provides a basic implementation of the Attribute interface.

This implementation does not support the schema methods getAttributeDefinition() and getAttributeSyntaxDefinition(). They simply throw OperationNotSupportedException. Subclasses of BasicAttribute should override these methods if they support them.

The BasicAttribute class by default uses Object.equals() to determine equality of attribute values when testing for equality or when searching for values, except when the value is an array. For an array, each element of the array is checked using Object.equals(). Subclasses of BasicAttribute can make use of schema information when doing similar equality checks by overriding methods in which such use of schema is meaningful. Similarly, the BasicAttribute class by default returns the values passed to its constructor and/or manipulated using the add/remove methods. Subclasses of BasicAttribute can override get() and getAll() to get the values dynamically from the directory (or implement the Attribute interface directly instead of subclassing BasicAttribute).

Note that updates to BasicAttribute (such as adding or removing a value) does not affect the corresponding representation of the attribute in the directory. Updates to the directory can only be effected using operations in the DirContext interface.

A BasicAttribute instance is not synchronized against concurrent multithreaded access. Multiple threads trying to access and modify a BasicAttribute should lock the object.
author:
   Rosanna Lee
author:
   Scott Seligman
version:
   1.20 07/05/05
since:
   1.3


Inner Class :class ValuesEnumImpl implements NamingEnumeration<Object>

Field Summary
protected  StringattrID
     Holds the attribute's id.
protected  booleanordered
     A flag for recording whether this attribute's values are ordered.
protected transient  Vector<Object>values
     Holds the attribute's values.

Constructor Summary
public  BasicAttribute(String id)
     Constructs a new instance of an unordered attribute with no value.
Parameters:
  id - The attribute's id.
public  BasicAttribute(String id, Object value)
     Constructs a new instance of an unordered attribute with a single value.
Parameters:
  id - The attribute's id.
public  BasicAttribute(String id, boolean ordered)
     Constructs a new instance of a possibly ordered attribute with no value.
Parameters:
  id - The attribute's id.
public  BasicAttribute(String id, Object value, boolean ordered)
     Constructs a new instance of a possibly ordered attribute with a single value.
Parameters:
  id - The attribute's id.

Method Summary
public  booleanadd(Object attrVal)
     Adds a new value to this attribute.
public  voidadd(int ix, Object attrVal)
    
public  voidclear()
    
public  Objectclone()
    
public  booleancontains(Object attrVal)
     Determines whether a value is in this attribute.
public  booleanequals(Object obj)
     Determines whether obj is equal to this attribute. Two attributes are equal if their attribute-ids, syntaxes and values are equal.
public  Objectget()
     Retrieves one of this attribute's values.
public  Objectget(int ix)
    
public  NamingEnumerationgetAll()
     Retrieves an enumeration of this attribute's values.
public  DirContextgetAttributeDefinition()
     Retrieves this attribute's schema definition.

This method by default throws OperationNotSupportedException.

public  DirContextgetAttributeSyntaxDefinition()
     Retrieves the syntax definition associated with this attribute.

This method by default throws OperationNotSupportedException.

public  StringgetID()
    
public  inthashCode()
     Calculates the hash code of this attribute.
public  booleanisOrdered()
    
public  booleanremove(Object attrval)
     Removes a specified value from this attribute.

By default, Object.equals() is used when comparing attrVal with this attribute's values except when attrVal is an array. For an array, each element of the array is checked using Object.equals().

public  Objectremove(int ix)
    
public  Objectset(int ix, Object attrVal)
    
public  intsize()
    
public  StringtoString()
     Generates the string representation of this attribute.

Field Detail
attrID
protected String attrID(Code)
Holds the attribute's id. It is initialized by the public constructor and cannot be null unless methods in BasicAttribute that use attrID have been overridden.



ordered
protected boolean ordered(Code)
A flag for recording whether this attribute's values are ordered.



values
protected transient Vector<Object> values(Code)
Holds the attribute's values. Initialized by public constructors. Cannot be null unless methods in BasicAttribute that use values have been overridden.




Constructor Detail
BasicAttribute
public BasicAttribute(String id)(Code)
Constructs a new instance of an unordered attribute with no value.
Parameters:
  id - The attribute's id. It cannot be null.



BasicAttribute
public BasicAttribute(String id, Object value)(Code)
Constructs a new instance of an unordered attribute with a single value.
Parameters:
  id - The attribute's id. It cannot be null.
Parameters:
  value - The attribute's value. If null, a nullvalue is added to the attribute.



BasicAttribute
public BasicAttribute(String id, boolean ordered)(Code)
Constructs a new instance of a possibly ordered attribute with no value.
Parameters:
  id - The attribute's id. It cannot be null.
Parameters:
  ordered - true means the attribute's values will be ordered; false otherwise.



BasicAttribute
public BasicAttribute(String id, Object value, boolean ordered)(Code)
Constructs a new instance of a possibly ordered attribute with a single value.
Parameters:
  id - The attribute's id. It cannot be null.
Parameters:
  value - The attribute's value. If null, a nullvalue is added to the attribute.
Parameters:
  ordered - true means the attribute's values will be ordered; false otherwise.




Method Detail
add
public boolean add(Object attrVal)(Code)
Adds a new value to this attribute.

By default, Object.equals() is used when comparing attrVal with this attribute's values except when attrVal is an array. For an array, each element of the array is checked using Object.equals(). A subclass may use schema information to determine equality.




add
public void add(int ix, Object attrVal)(Code)



clear
public void clear()(Code)



clone
public Object clone()(Code)



contains
public boolean contains(Object attrVal)(Code)
Determines whether a value is in this attribute.

By default, Object.equals() is used when comparing attrVal with this attribute's values except when attrVal is an array. For an array, each element of the array is checked using Object.equals(). A subclass may use schema information to determine equality.




equals
public boolean equals(Object obj)(Code)
Determines whether obj is equal to this attribute. Two attributes are equal if their attribute-ids, syntaxes and values are equal. If the attribute values are unordered, the order that the values were added are irrelevant. If the attribute values are ordered, then the order the values must match. If obj is null or not an Attribute, false is returned.

By default Object.equals() is used when comparing the attribute id and its values except when a value is an array. For an array, each element of the array is checked using Object.equals(). A subclass may override this to make use of schema syntax information and matching rules, which define what it means for two attributes to be equal. How and whether a subclass makes use of the schema information is determined by the subclass. If a subclass overrides equals(), it should also override hashCode() such that two attributes that are equal have the same hash code.
Parameters:
  obj - The possibly null object to check. true if obj is equal to this attribute; false otherwise.
See Also:   BasicAttribute.hashCode
See Also:   BasicAttribute.contains




get
public Object get() throws NamingException(Code)
Retrieves one of this attribute's values.

By default, the value returned is one of those passed to the constructor and/or manipulated using the add/replace/remove methods. A subclass may override this to retrieve the value dynamically from the directory.




get
public Object get(int ix) throws NamingException(Code)



getAll
public NamingEnumeration getAll() throws NamingException(Code)
Retrieves an enumeration of this attribute's values.

By default, the values returned are those passed to the constructor and/or manipulated using the add/replace/remove methods. A subclass may override this to retrieve the values dynamically from the directory.




getAttributeDefinition
public DirContext getAttributeDefinition() throws NamingException(Code)
Retrieves this attribute's schema definition.

This method by default throws OperationNotSupportedException. A subclass should override this method if it supports schema.




getAttributeSyntaxDefinition
public DirContext getAttributeSyntaxDefinition() throws NamingException(Code)
Retrieves the syntax definition associated with this attribute.

This method by default throws OperationNotSupportedException. A subclass should override this method if it supports schema.




getID
public String getID()(Code)



hashCode
public int hashCode()(Code)
Calculates the hash code of this attribute.

The hash code is computed by adding the hash code of the attribute's id and that of all of its values except for values that are arrays. For an array, the hash code of each element of the array is summed. If a subclass overrides hashCode(), it should override equals() as well so that two attributes that are equal have the same hash code. an int representing the hash code of this attribute.
See Also:   BasicAttribute.equals




isOrdered
public boolean isOrdered()(Code)



remove
public boolean remove(Object attrval)(Code)
Removes a specified value from this attribute.

By default, Object.equals() is used when comparing attrVal with this attribute's values except when attrVal is an array. For an array, each element of the array is checked using Object.equals(). A subclass may use schema information to determine equality.




remove
public Object remove(int ix)(Code)



set
public Object set(int ix, Object attrVal)(Code)



size
public int size()(Code)



toString
public String toString()(Code)
Generates the string representation of this attribute. The string consists of the attribute's id and its values. This string is meant for debugging and not meant to be interpreted programmatically. The non-null string representation of this attribute.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.