Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.geronimo.gbean
Class GBeanName  view GBeanName download GBeanName.java

java.lang.Object
  extended byorg.apache.geronimo.gbean.GBeanName
All Implemented Interfaces:
java.io.Serializable

public final class GBeanName
extends java.lang.Object
implements java.io.Serializable

Class that represents the name for a GBean. A name is comprised of a domain combined with one or more properties. The domain is a fixed base name, properties qualify that as necessary. Two names are equal if they have the same name and the same properties. The String representation of a name can be written as domain:key1=value1,key2=value2,... Values are case sensitive, spaces are significant and there is no escaping mechanism; this is intended to be fast rather than allow lax syntax.

Version:
$Rev$ $Date$

Field Summary
private  java.lang.String domain
           
private  int hashCode
           
private  java.lang.String name
          Original name preserved; used for toString and Serialized form
private  java.util.HashMap props
           
private static long serialVersionUID
           
 
Constructor Summary
GBeanName(javax.management.ObjectName name)
          Deprecated.  
GBeanName(java.lang.String name)
          Construct a GBeanName by parsing a string.
GBeanName(java.lang.String domain, java.util.Map props)
          Construct a GBeanName by combining a domain with explicit properties.
 
Method Summary
private static java.lang.String buildName(java.lang.String domain, java.util.Map props)
           
 boolean equals(java.lang.Object obj)
          Test for equality.
 javax.management.ObjectName getObjectName()
          Deprecated.  
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 boolean matches(java.lang.String domain, java.util.Map pattern)
          Determine if this name matches the supplied pattern.
private static java.util.HashMap parseName(java.lang.String name)
           
private  java.lang.Object readResolve()
           
 java.lang.String toString()
          Return a human readable version of this GBeanName.
 java.lang.String toString(java.util.Comparator keySorter)
          Return a String representation of ths GBeanName.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

name

private final java.lang.String name
Original name preserved; used for toString and Serialized form


domain

private final transient java.lang.String domain

props

private final transient java.util.HashMap props

hashCode

private final transient int hashCode
Constructor Detail

GBeanName

public GBeanName(java.lang.String domain,
                 java.util.Map props)
Construct a GBeanName by combining a domain with explicit properties. The string representation of this name is generated by combining the properties in iteration order.


GBeanName

public GBeanName(java.lang.String name)
Construct a GBeanName by parsing a string.


GBeanName

public GBeanName(javax.management.ObjectName name)
Deprecated.  

Method Detail

buildName

private static java.lang.String buildName(java.lang.String domain,
                                          java.util.Map props)

parseName

private static java.util.HashMap parseName(java.lang.String name)

matches

public boolean matches(java.lang.String domain,
                       java.util.Map pattern)
Determine if this name matches the supplied pattern. This performs a fast but simplistic pattern match which is true if:
  • The domains are equal
  • If this instance has all the supplied properties with equal values
    • A null domain and a null or empty properties object are considered wildcards and always match; in other words GBeanName.match(null, new Properties()) will always evaluate to true.


equals

public boolean equals(java.lang.Object obj)
Test for equality. This instance will be equal if the supplied object is a GBeanName with equal domain and properties.


hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


toString

public java.lang.String toString()
Return a human readable version of this GBeanName. If the instance was created by parsing a String, this will be the supplied value; it it was created by supplying properties, the name will contain properties in an unspecified order.


toString

public java.lang.String toString(java.util.Comparator keySorter)
Return a String representation of ths GBeanName. The format will be ':' '=' ( ',' '=' )* Keys are appended in the order determined by the supplied Comparator.


readResolve

private java.lang.Object readResolve()

getObjectName

public javax.management.ObjectName getObjectName()
                                          throws javax.management.MalformedObjectNameException
Deprecated.