MBeanFeatureInfopublic class MBeanFeatureInfo extends Object implements Serializable, DescriptorReadProvides general information for an MBean descriptor object.
The feature described can be an attribute, an operation, a
parameter, or a notification. Instances of this class are
immutable. Subclasses may be mutable but this is not
recommended. |
Fields Summary |
---|
static final long | serialVersionUID | protected String | nameThe name of the feature. It is recommended that subclasses call
{@link #getName} rather than reading this field, and that they
not change it. | protected String | descriptionThe human-readable description of the feature. It is
recommended that subclasses call {@link #getDescription} rather
than reading this field, and that they not change it. | private transient Descriptor | descriptor |
Constructors Summary |
---|
public MBeanFeatureInfo(String name, String description)Constructs an MBeanFeatureInfo object. This
constructor is equivalent to {@code MBeanFeatureInfo(name,
description, (Descriptor) null}.
this(name, description, null);
| public MBeanFeatureInfo(String name, String description, Descriptor descriptor)Constructs an MBeanFeatureInfo object.
this.name = name;
this.description = description;
this.descriptor = descriptor;
|
Methods Summary |
---|
public boolean | equals(java.lang.Object o)Compare this MBeanFeatureInfo to another.
if (o == this)
return true;
if (!(o instanceof MBeanFeatureInfo))
return false;
MBeanFeatureInfo p = (MBeanFeatureInfo) o;
return (p.getName().equals(getName()) &&
p.getDescription().equals(getDescription()) &&
p.getDescriptor().equals(getDescriptor()));
| public java.lang.String | getDescription()Returns the human-readable description of the feature.
return description;
| public javax.management.Descriptor | getDescriptor()Returns the descriptor for the feature. Changing the returned value
will have no affect on the original descriptor.
return (Descriptor) ImmutableDescriptor.nonNullDescriptor(descriptor).clone();
| public java.lang.String | getName()Returns the name of the feature.
return name;
| public int | hashCode()
return getName().hashCode() ^ getDescription().hashCode() ^
getDescriptor().hashCode();
| private void | readObject(java.io.ObjectInputStream in)Deserializes an {@link MBeanFeatureInfo} from an {@link ObjectInputStream}.
in.defaultReadObject();
switch (in.read()) {
case 1:
final String[] names = (String[])in.readObject();
if (names.length == 0) {
descriptor = ImmutableDescriptor.EMPTY_DESCRIPTOR;
} else {
final Object[] values = (Object[])in.readObject();
descriptor = new ImmutableDescriptor(names, values);
}
break;
case 0:
descriptor = (Descriptor)in.readObject();
if (descriptor == null) {
descriptor = ImmutableDescriptor.EMPTY_DESCRIPTOR;
}
break;
case -1: // from an earlier version of the JMX API
descriptor = ImmutableDescriptor.EMPTY_DESCRIPTOR;
break;
default:
throw new StreamCorruptedException("Got unexpected byte.");
}
| private void | writeObject(java.io.ObjectOutputStream out)Serializes an {@link MBeanFeatureInfo} to an {@link ObjectOutputStream}.
out.defaultWriteObject();
if (descriptor != null &&
descriptor.getClass() == ImmutableDescriptor.class) {
out.write(1);
final String[] names = descriptor.getFieldNames();
out.writeObject(names);
out.writeObject(descriptor.getFieldValues(names));
} else {
out.write(0);
out.writeObject(descriptor);
}
|
|