|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.5.0
javax.management
|
Constructor Summary | |
---|---|
ObjectName(String name)
Construct an object name from the given string. |
|
ObjectName(String domain,
Hashtable table)
Construct an object name with several key properties from a Hashtable. |
|
ObjectName(String domain,
String key,
String value)
Construct an object name with exactly one key property. |
Method Summary | |
---|---|
boolean |
apply(ObjectName name)
Test whether this ObjectName, which may be a pattern, matches another ObjectName. |
boolean |
equals(Object object)
Compares the current object name with another object name. |
String |
getCanonicalKeyPropertyListString()
Returns a string representation of the list of key properties, in which the key properties are sorted in lexical order. |
String |
getCanonicalName()
Returns the canonical form of the name; that is, a string representation where the properties are sorted in lexical order. |
String |
getDomain()
Returns the domain part. |
static ObjectName |
getInstance(ObjectName name)
Return an instance of ObjectName that can be used anywhere the given object can be used. |
static ObjectName |
getInstance(String name)
Return an instance of ObjectName that can be used anywhere an object obtained with new
ObjectName(name) can be used. |
static ObjectName |
getInstance(String domain,
Hashtable table)
Return an instance of ObjectName that can be used anywhere an object obtained with new ObjectName(domain, table) can be used. |
static ObjectName |
getInstance(String domain,
String key,
String value)
Return an instance of ObjectName that can be used anywhere an object obtained with new ObjectName(domain, key, value) can be used. |
String |
getKeyProperty(String property)
Obtains the value associated with a key in a key property. |
Hashtable |
getKeyPropertyList()
Returns the key properties as a Hashtable. |
String |
getKeyPropertyListString()
Returns a string representation of the list of key properties specified at creation time. |
int |
hashCode()
Returns a hash code for this object name. |
boolean |
isDomainPattern()
Checks whether the object name is a pattern on the domain part. |
boolean |
isPattern()
Checks whether the object name is a pattern. |
boolean |
isPropertyPattern()
Checks whether the object name is a pattern on the key properties. |
static String |
quote(String s)
Returns a quoted form of the given String, suitable for inclusion in an ObjectName. |
void |
setMBeanServer(MBeanServer mbs)
Sets the MBean server on which the query is to be performed. |
String |
toString()
Returns a string representation of the object name. |
static String |
unquote(String q)
Returns an unquoted form of the given String. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ObjectName(String name) throws MalformedObjectNameException, NullPointerException
name
- A string representation of the object name.
MalformedObjectNameException
- The string passed as a
parameter does not have the right format.
NullPointerException
- The name
parameter
is null.public ObjectName(String domain, String key, String value) throws MalformedObjectNameException, NullPointerException
domain
- The domain part of the object name.key
- The attribute in the key property of the object name.value
- The value in the key property of the object name.
MalformedObjectNameException
- The
domain
, key
, or value
contains an illegal character, or value
does not
follow the rules for quoting.
NullPointerException
- One of the parameters is null.public ObjectName(String domain, Hashtable table) throws MalformedObjectNameException, NullPointerException
domain
- The domain part of the object name.table
- A hash table containing one or more key
properties. The key of each entry in the table is the key of a
key property in the object name. The associated value in the
table is the associated value in the object name.
MalformedObjectNameException
- The domain
contains an illegal character, or one of the keys or values in
table
contains an illegal character, or one of the
values in table
does not follow the rules for
quoting.
NullPointerException
- One of the parameters is null.Method Detail |
---|
public static ObjectName getInstance(String name) throws MalformedObjectNameException, NullPointerException
Return an instance of ObjectName that can be used anywhere
an object obtained with new
ObjectName(name)
can be used. The returned object may be of
a subclass of ObjectName. Calling this method twice with the
same parameters may return the same object or two equal but
not identical objects.
name
- A string representation of the object name.
MalformedObjectNameException
- The string passed as a
parameter does not have the right format.
NullPointerException
- The name
parameter
is null.public static ObjectName getInstance(String domain, String key, String value) throws MalformedObjectNameException, NullPointerException
Return an instance of ObjectName that can be used anywhere
an object obtained with new ObjectName(domain, key, value)
can be used. The
returned object may be of a subclass of ObjectName. Calling
this method twice with the same parameters may return the same
object or two equal but not identical objects.
domain
- The domain part of the object name.key
- The attribute in the key property of the object name.value
- The value in the key property of the object name.
MalformedObjectNameException
- The
domain
, key
, or value
contains an illegal character, or value
does not
follow the rules for quoting.
NullPointerException
- One of the parameters is null.public static ObjectName getInstance(String domain, Hashtable table) throws MalformedObjectNameException, NullPointerException
Return an instance of ObjectName that can be used anywhere
an object obtained with new ObjectName(domain, table)
can be used. The returned
object may be of a subclass of ObjectName. Calling this method
twice with the same parameters may return the same object or
two equal but not identical objects.
domain
- The domain part of the object name.table
- A hash table containing one or more key
properties. The key of each entry in the table is the key of a
key property in the object name. The associated value in the
table is the associated value in the object name.
MalformedObjectNameException
- The domain
contains an illegal character, or one of the keys or values in
table
contains an illegal character, or one of the
values in table
does not follow the rules for
quoting.
NullPointerException
- One of the parameters is null.public static ObjectName getInstance(ObjectName name) throws NullPointerException
Return an instance of ObjectName that can be used anywhere
the given object can be used. The returned object may be of a
subclass of ObjectName. If name
is of a subclass
of ObjectName, it is not guaranteed that the returned object
will be of the same class.
The returned value may or may not be identical to
name
. Calling this method twice with the same
parameters may return the same object or two equal but not
identical objects.
Since ObjectName is immutable, it is not usually useful to make a copy of an ObjectName. The principal use of this method is to guard against a malicious caller who might pass an instance of a subclass with surprising behavior to sensitive code. Such code can call this method to obtain an ObjectName that is known not to have surprising behavior.
name
- an instance of the ObjectName class or of a subclass
name
respects the
semantics of ObjectName, then the returned object is equal
(though not necessarily identical) to name
.
NullPointerException
- The name
is null.public boolean isPattern()
public boolean isDomainPattern()
public boolean isPropertyPattern()
public String getCanonicalName()
Returns the canonical form of the name; that is, a string representation where the properties are sorted in lexical order.
More precisely, the canonical form of the name is a String
consisting of the domain part, a colon
(:
), the canonical key property list, and
a pattern indication.
The canonical key property list is the same string
as described for getCanonicalKeyPropertyListString()
.
The pattern indication is:
,*
) for an ObjectName that is a property
pattern with at least one key.
public String getDomain()
public String getKeyProperty(String property) throws NullPointerException
property
- The property whose value is to be obtained.
NullPointerException
- If property
is null.public Hashtable getKeyPropertyList()
Returns the key properties as a Hashtable. The returned value is a Hashtable in which each key is a key in the ObjectName's key property list and each value is the associated value.
The returned value may be unmodifiable. If it is modifiable, changing it has no effect on this ObjectName.
public String getKeyPropertyListString()
Returns a string representation of the list of key
properties specified at creation time. If this ObjectName was
constructed with the constructor ObjectName(String)
,
the key properties in the returned String will be in the same
order as in the argument to the constructor.
public String getCanonicalKeyPropertyListString()
String.compareTo(String)
.
public String toString()
Returns a string representation of the object name. The format of this string is not specified, but users can expect that two ObjectNames return the same string if and only if they are equal.
public boolean equals(Object object)
getCanonicalName()
.
object
- The object name that the current object name is to be
compared with.
object
is an ObjectName whose
canonical form is equal to that of this ObjectName.Object.hashCode()
,
Hashtable
public int hashCode()
Object.equals(java.lang.Object)
,
Hashtable
public static String quote(String s) throws NullPointerException
Returns a quoted form of the given String, suitable for
inclusion in an ObjectName. The returned value can be used as
the value associated with a key in an ObjectName. The String
s
may contain any character. Appropriate quoting
ensures that the returned value is legal in an ObjectName.
The returned value consists of a quote ('"'), a sequence of
characters corresponding to the characters of s
,
and another quote. Characters in s
appear
unchanged within the returned value except:
s
- the String to be quoted.
NullPointerException
- if s
is null.public static String unquote(String q) throws IllegalArgumentException, NullPointerException
Returns an unquoted form of the given String. If
q
is a String returned by quote(s)
,
then unquote(q).equals(s)
. If there is no String
s
for which quote(s).equals(q)
, then
unquote(q) throws an IllegalArgumentException.
These rules imply that there is a one-to-one mapping between quoted and unquoted forms.
q
- the String to be unquoted.
IllegalArgumentException
- if q
could not
have been returned by the quote(java.lang.String)
method, for instance
if it does not begin and end with a quote (").
NullPointerException
- if q
is null.public boolean apply(ObjectName name) throws NullPointerException
Test whether this ObjectName, which may be a pattern,
matches another ObjectName. If name
is a pattern,
the result is false. If this ObjectName is a pattern, the
result is true if and only if name
matches the
pattern. If neither this ObjectName nor name
is
a pattern, the result is true if and only if the two
ObjectNames are equal as described for the equals(Object)
method.
name
- The name of the MBean to compare to.
name
matches this ObjectName.
NullPointerException
- if name
is null.public void setMBeanServer(MBeanServer mbs)
QueryExp
setMBeanServer
in interface QueryExp
mbs
- The MBean server on which the query is to be performed.