Java Doc for CompositeName.java in  » Apache-Harmony-Java-SE » javax-package » javax » naming » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » javax package » javax.naming 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.naming.CompositeName

CompositeName
public class CompositeName implements Name(Code)
A CompositeName represents a name in a naming service which spans multiple namespaces. For example the name "www.eclipse.org/index.html" spans the DNS and file system namespaces.

A CompositeName is a series of string elements. A composite name has a sequence of zero or more elements delimited by the '/' char. Each element can be accessed using its position. The first element is at position 0.

A CompositeName may be empty. An empty composite name has no elements. Elements may also be empty.

CompositeNames are read from left to right unlike CompoundNames which may have their direction of ordering specified by properties.

Special characters are as follows:

  • The separator is /
  • The escape character is \
  • Quotes can be used - both single quotes and double quotes are allowed. This allows you to quote strings which contain chars such as / which are part of a CompositeName element to avoid them being read as a separator.

See the examples for further clarification.

Some Examples:
==============

The composite name "www.eclipse.org/index.html" has 2 elements. "www.eclipse.org" is a name from the DNS namespace. "index.html" is a name from the file system namespace.

Another example of a composite name is: "www.eclipse.org/org/index.html". This name has 3 elements "www.eclipse.org", "org" and "index.html". www.eclipse.org is a name from the DNS namespace. The last 2 elements are each from the file system namespace.

Some more examples to clarify empty names and elements:

An empty CompositeName is the name "" and has no elements.

A CompositeName with just one empty element is the name "/".

The name "/org/" has 3 elements. The first and last are empty.

The name "/a" has 2 elements. The first element is empty and the second element is "a".

The name "a//a" has 3 elements. The middle element is empty and the first & third elements are both "a".

The name "a/'b/a" is invalid as there is no closing quote for the ' character.

The name "a/'a/b/b" is invalid as there is no closing quote for the ' character.

The name "a/\"b/a" is interpreted as a/"b/a and is invalid as there is no closing quote for the embedded escaped " character.

The name "a/'b/c'/a" has 3 elements. The middle element is b/c.

The name "a/a'a/b'/b" has 4 elements: Element 0 is "a". Element 1 is "a'a". Element 2 is "b'". Element 3 is "b".

Interestingly the name "a/a'a/b/b" is valid and has 4 elements. This is because the single quote char ' is not a leading quote and is embedded in an element so is treated as a character. Element 0 is "a". Element 1 is "a'a". Element 2 is "b". Element 3 is "b".

The name "\"abcd" gives an InvalidNameException as there is no closing quote.

The name "'\"abcd'" gives one element of value "abcd.

The name "\\abcd" gives one element of value \abcd.

"" is empty. It has no elements. "/" has one empty element. "//" has 2 empty elements. "/a/" has 3 elements the middle one is set to a. "///" has 3 empty elements. "//a/" has 4 elements, the last but one is set to a.




Constructor Summary
protected  CompositeName(Enumeration<String> elements)
     Construct a composite name with given elements.
public  CompositeName()
     Default constructor, creates an empty name with zero elements.
public  CompositeName(String name)
     This constructor takes the supplied name and breaks it down into its elements.

Method Summary
public  Nameadd(String element)
    
public  Nameadd(int index, String element)
    
public  NameaddAll(Name name)
    
public  NameaddAll(int index, Name name)
    
public  Objectclone()
     Create a copy of this composite name, a complete (deep) copy of the object.
public  intcompareTo(Object o)
     Compare this Name with the one supplied as a parameter.
public  booleanendsWith(Name name)
    
public  booleanequals(Object o)
     Check if this CompositeName is equal to the supplied object.
Parameters:
  o - the CompositeName to compare - can be null butthen returns false.
public  Stringget(int index)
    
public  Enumeration<String>getAll()
    
public  NamegetPrefix(int index)
    
public  NamegetSuffix(int index)
    
public  inthashCode()
     Calculate the hashcode of this CompositeName by summing the hash codes of all of its elements.
public  booleanisEmpty()
    
public  Objectremove(int index)
    
public  intsize()
    
public  booleanstartsWith(Name name)
    
public  StringtoString()
     Returns the string representation of this CompositeName. This is generated by concatenating the elements together with the '/' char added as the separator between each of them.


Constructor Detail
CompositeName
protected CompositeName(Enumeration<String> elements)(Code)
Construct a composite name with given elements.
Parameters:
  elements - an enumeration of name elements



CompositeName
public CompositeName()(Code)
Default constructor, creates an empty name with zero elements.



CompositeName
public CompositeName(String name) throws InvalidNameException(Code)
This constructor takes the supplied name and breaks it down into its elements.
Parameters:
  name - a string containing the full composite name
throws:
  InvalidNameException - if the supplied name is invalid




Method Detail
add
public Name add(String element) throws InvalidNameException(Code)



add
public Name add(int index, String element) throws InvalidNameException(Code)



addAll
public Name addAll(Name name) throws InvalidNameException(Code)



addAll
public Name addAll(int index, Name name) throws InvalidNameException(Code)



clone
public Object clone()(Code)
Create a copy of this composite name, a complete (deep) copy of the object. a complete (deep) copy of the object.



compareTo
public int compareTo(Object o)(Code)
Compare this Name with the one supplied as a parameter. The elements of the names are compared in the same way as strings are compared to determine whether this CompositeName is less than, greater than or equal to the supplied object o.
Parameters:
  o - the object to compare, cannot be null a negative number means this is less than the supplied object; apositive number means this is greater than the supplied object;zero means this CompositeName equals the object as specified inthe description for the equals method ofCompositeName.
throws:
  ClassCastException - when o is not a CompositeName.



endsWith
public boolean endsWith(Name name)(Code)



equals
public boolean equals(Object o)(Code)
Check if this CompositeName is equal to the supplied object.
Parameters:
  o - the CompositeName to compare - can be null butthen returns false. true if they have the same number of elements all of which areequal. false if they are not equal.



get
public String get(int index)(Code)



getAll
public Enumeration<String> getAll()(Code)



getPrefix
public Name getPrefix(int index)(Code)



getSuffix
public Name getSuffix(int index)(Code)



hashCode
public int hashCode()(Code)
Calculate the hashcode of this CompositeName by summing the hash codes of all of its elements. the hashcode of this object.



isEmpty
public boolean isEmpty()(Code)



remove
public Object remove(int index) throws InvalidNameException(Code)



size
public int size()(Code)



startsWith
public boolean startsWith(Name name)(Code)



toString
public String toString()(Code)
Returns the string representation of this CompositeName. This is generated by concatenating the elements together with the '/' char added as the separator between each of them. It may be necessary to add quotes and escape chars to preserve the meaning. The resulting string should produce an equivalent CompositeName when used to create a new instance. the string representation of this composite name.



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.