| Constructor: |
public MBeanInfo(String className,
String description,
MBeanAttributeInfo[] attributes,
MBeanConstructorInfo[] constructors,
MBeanOperationInfo[] operations,
MBeanNotificationInfo[] notifications) throws IllegalArgumentException {
this(className, description, attributes, constructors, operations,
notifications, null);
}
Parameters:
className - The name of the Java class of the MBean described
by this MBeanInfo. This value may be any
syntactically legal Java class name. It does not have to be a
Java class known to the MBean server or to the MBean's
ClassLoader. If it is a Java class known to the MBean's
ClassLoader, it is recommended but not required that the
class's public methods include those that would appear in a
Standard MBean implementing the attributes and operations in
this MBeanInfo.
description - A human readable description of the MBean (optional).
attributes - The list of exposed attributes of the MBean.
This may be null with the same effect as a zero-length array.
constructors - The list of public constructors of the
MBean. This may be null with the same effect as a zero-length
array.
operations - The list of operations of the MBean. This
may be null with the same effect as a zero-length array.
notifications - The list of notifications emitted. This
may be null with the same effect as a zero-length array.
|
public MBeanInfo(String className,
String description,
MBeanAttributeInfo[] attributes,
MBeanConstructorInfo[] constructors,
MBeanOperationInfo[] operations,
MBeanNotificationInfo[] notifications,
Descriptor descriptor) throws IllegalArgumentException {
this.className = className;
this.description = description;
if (attributes == null)
attributes = MBeanAttributeInfo.NO_ATTRIBUTES;
this.attributes = attributes;
if (operations == null)
operations = MBeanOperationInfo.NO_OPERATIONS;
this.operations = operations;
if (constructors == null)
constructors = MBeanConstructorInfo.NO_CONSTRUCTORS;
this.constructors = constructors;
if (notifications == null)
notifications = MBeanNotificationInfo.NO_NOTIFICATIONS;
this.notifications = notifications;
if (descriptor == null)
descriptor = ImmutableDescriptor.EMPTY_DESCRIPTOR;
this.descriptor = descriptor;
this.arrayGettersSafe =
arrayGettersSafe(this.getClass(), MBeanInfo.class);
}
Parameters:
className - The name of the Java class of the MBean described
by this MBeanInfo. This value may be any
syntactically legal Java class name. It does not have to be a
Java class known to the MBean server or to the MBean's
ClassLoader. If it is a Java class known to the MBean's
ClassLoader, it is recommended but not required that the
class's public methods include those that would appear in a
Standard MBean implementing the attributes and operations in
this MBeanInfo.
description - A human readable description of the MBean (optional).
attributes - The list of exposed attributes of the MBean.
This may be null with the same effect as a zero-length array.
constructors - The list of public constructors of the
MBean. This may be null with the same effect as a zero-length
array.
operations - The list of operations of the MBean. This
may be null with the same effect as a zero-length array.
notifications - The list of notifications emitted. This
may be null with the same effect as a zero-length array.
descriptor - The descriptor for the MBean. This may be null
which is equivalent to an empty descriptor.
- since:
1.6 -
|
| Method from javax.management.MBeanInfo Detail: |
static boolean arrayGettersSafe(Class subclass,
Class immutableClass) {
if (subclass == immutableClass)
return true;
synchronized (arrayGettersSafeMap) {
Boolean safe = arrayGettersSafeMap.get(subclass);
if (safe == null) {
try {
ArrayGettersSafeAction action =
new ArrayGettersSafeAction(subclass, immutableClass);
safe = AccessController.doPrivileged(action);
} catch (Exception e) { // e.g. SecurityException
/* We don't know, so we assume it isn't. */
safe = false;
}
arrayGettersSafeMap.put(subclass, safe);
}
return safe;
}
}
Return true if subclass is known to preserve the
immutability of immutableClass. The class
immutableClass is a reference class that is known
to be immutable. The subclass subclass is
considered immutable if it does not override any public method
of immutableClass whose name begins with "get".
This is obviously not an infallible test for immutability,
but it works for the public interfaces of the MBean*Info classes. |
public Object clone() {
try {
return super.clone() ;
} catch (CloneNotSupportedException e) {
// should not happen as this class is cloneable
return null;
}
}
Returns a shallow clone of this instance.
The clone is obtained by simply calling super.clone(),
thus calling the default native shallow cloning mechanism
implemented by Object.clone().
No deeper cloning of any internal field is made.
Since this class is immutable, the clone method is chiefly of
interest to subclasses.
|
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof MBeanInfo))
return false;
MBeanInfo p = (MBeanInfo) o;
if (!isEqual(getClassName(), p.getClassName()) ||
!isEqual(getDescription(), p.getDescription()) ||
!getDescriptor().equals(p.getDescriptor())) {
return false;
}
return
(Arrays.equals(p.fastGetAttributes(), fastGetAttributes()) &&
Arrays.equals(p.fastGetOperations(), fastGetOperations()) &&
Arrays.equals(p.fastGetConstructors(), fastGetConstructors()) &&
Arrays.equals(p.fastGetNotifications(), fastGetNotifications()));
}
|
public MBeanAttributeInfo[] getAttributes() {
MBeanAttributeInfo[] as = nonNullAttributes();
if (as.length == 0)
return as;
else
return as.clone();
}
Returns the list of attributes exposed for management.
Each attribute is described by an MBeanAttributeInfo object.
The returned array is a shallow copy of the internal array,
which means that it is a copy of the internal array of
references to the MBeanAttributeInfo objects
but that each referenced MBeanAttributeInfo object is not copied. |
public String getClassName() {
return className;
}
Returns the name of the Java class of the MBean described by
this MBeanInfo. |
public MBeanConstructorInfo[] getConstructors() {
MBeanConstructorInfo[] cs = nonNullConstructors();
if (cs.length == 0)
return cs;
else
return cs.clone();
}
Returns the list of the public constructors of the MBean.
Each constructor is described by an
MBeanConstructorInfo object.
The returned array is a shallow copy of the internal array,
which means that it is a copy of the internal array of
references to the MBeanConstructorInfo objects but
that each referenced MBeanConstructorInfo object
is not copied.
The returned list is not necessarily exhaustive. That is,
the MBean may have a public constructor that is not in the
list. In this case, the MBean server can construct another
instance of this MBean's class using that constructor, even
though it is not listed here.
|
public String getDescription() {
return description;
}
Returns a human readable description of the MBean. |
public Descriptor getDescriptor() {
return (Descriptor) nonNullDescriptor(descriptor).clone();
}
Get the descriptor of this MBeanInfo. Changing the returned value
will have no affect on the original descriptor. |
public MBeanNotificationInfo[] getNotifications() {
MBeanNotificationInfo[] ns = nonNullNotifications();
if (ns.length == 0)
return ns;
else
return ns.clone();
}
Returns the list of the notifications emitted by the MBean.
Each notification is described by an MBeanNotificationInfo object.
The returned array is a shallow copy of the internal array,
which means that it is a copy of the internal array of
references to the MBeanNotificationInfo objects
but that each referenced MBeanNotificationInfo object is not copied. |
public MBeanOperationInfo[] getOperations() {
MBeanOperationInfo[] os = nonNullOperations();
if (os.length == 0)
return os;
else
return os.clone();
}
Returns the list of operations of the MBean.
Each operation is described by an MBeanOperationInfo object.
The returned array is a shallow copy of the internal array,
which means that it is a copy of the internal array of
references to the MBeanOperationInfo objects
but that each referenced MBeanOperationInfo object is not copied. |
public int hashCode() {
/* Since computing the hashCode is quite expensive, we cache it.
If by some terrible misfortune the computed value is 0, the
caching won't work and we will recompute it every time.
We don't bother synchronizing, because, at worst, n different
threads will compute the same hashCode at the same time. */
if (hashCode != 0)
return hashCode;
hashCode =
getClassName().hashCode() ^
getDescriptor().hashCode() ^
arrayHashCode(fastGetAttributes()) ^
arrayHashCode(fastGetOperations()) ^
arrayHashCode(fastGetConstructors()) ^
arrayHashCode(fastGetNotifications());
return hashCode;
}
|
public String toString() {
return
getClass().getName() + "[" +
"description=" + getDescription() + ", " +
"attributes=" + Arrays.asList(fastGetAttributes()) + ", " +
"constructors=" + Arrays.asList(fastGetConstructors()) + ", " +
"operations=" + Arrays.asList(fastGetOperations()) + ", " +
"notifications=" + Arrays.asList(fastGetNotifications()) + ", " +
"descriptor=" + getDescriptor() +
"]";
}
|