Constructor: |
public MBeanOperationInfo(String description,
Method method) {
this(method.getName(),
description,
methodSignature(method),
method.getReturnType().getName(),
UNKNOWN,
Introspector.descriptorForElement(method));
}
Constructs an MBeanOperationInfo object. The
Descriptor of the constructed object will include
fields contributed by any annotations on the {@code Method}
object that contain the DescriptorKey meta-annotation. Parameters:
method - The java.lang.reflect.Method object
describing the MBean operation.
description - A human readable description of the operation.
|
public MBeanOperationInfo(String name,
String description,
MBeanParameterInfo[] signature,
String type,
int impact) {
this(name, description, signature, type, impact, (Descriptor) null);
}
Constructs an MBeanOperationInfo object. Parameters:
name - The name of the method.
description - A human readable description of the operation.
signature - MBeanParameterInfo objects
describing the parameters(arguments) of the method. This may be
null with the same effect as a zero-length array.
type - The type of the method's return value.
impact - The impact of the method, one of
#INFO , #ACTION , #ACTION_INFO ,
#UNKNOWN .
|
public MBeanOperationInfo(String name,
String description,
MBeanParameterInfo[] signature,
String type,
int impact,
Descriptor descriptor) {
super(name, description, descriptor);
if (signature == null || signature.length == 0)
signature = MBeanParameterInfo.NO_PARAMS;
else
signature = signature.clone();
this.signature = signature;
this.type = type;
this.impact = impact;
this.arrayGettersSafe =
MBeanInfo.arrayGettersSafe(this.getClass(),
MBeanOperationInfo.class);
}
Constructs an MBeanOperationInfo object. Parameters:
name - The name of the method.
description - A human readable description of the operation.
signature - MBeanParameterInfo objects
describing the parameters(arguments) of the method. This may be
null with the same effect as a zero-length array.
type - The type of the method's return value.
impact - The impact of the method, one of
#INFO , #ACTION , #ACTION_INFO ,
#UNKNOWN .
descriptor - The descriptor for the operation. This may be null
which is equivalent to an empty descriptor.
- since:
1.6 -
|
Method from javax.management.MBeanOperationInfo Detail: |
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, cloning is chiefly of interest
to subclasses.
|
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof MBeanOperationInfo))
return false;
MBeanOperationInfo p = (MBeanOperationInfo) o;
return (p.getName().equals(getName()) &&
p.getReturnType().equals(getReturnType()) &&
p.getDescription().equals(getDescription()) &&
p.getImpact() == getImpact() &&
Arrays.equals(p.fastGetSignature(), fastGetSignature()) &&
p.getDescriptor().equals(getDescriptor()));
}
Compare this MBeanOperationInfo to another. |
public int getImpact() {
return impact;
}
Returns the impact of the method, one of
INFO , ACTION , ACTION_INFO , UNKNOWN . |
public String getReturnType() {
return type;
}
Returns the type of the method's return value. |
public MBeanParameterInfo[] getSignature() {
// If MBeanOperationInfo was created in our implementation,
// signature cannot be null - because our constructors replace
// null with MBeanParameterInfo.NO_PARAMS;
//
// However, signature could be null if an MBeanOperationInfo is
// deserialized from a byte array produced by another implementation.
// This is not very likely but possible, since the serial form says
// nothing against it. (see 6373150)
//
if (signature == null)
// if signature is null simply return an empty array .
//
return MBeanParameterInfo.NO_PARAMS;
else if (signature.length == 0)
return signature;
else
return signature.clone();
}
Returns the list of parameters for this operation. Each
parameter is described by an MBeanParameterInfo
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 MBeanParameterInfo objects but
that each referenced MBeanParameterInfo object is
not copied.
|
public int hashCode() {
return getName().hashCode() ^ getReturnType().hashCode();
}
|
static MBeanParameterInfo[] parameters(Class<?>[] classes,
Annotation[][] annots) {
final MBeanParameterInfo[] params =
new MBeanParameterInfo[classes.length];
assert(classes.length == annots.length);
for (int i = 0; i < classes.length; i++) {
Descriptor d = Introspector.descriptorForAnnotations(annots[i]);
final String pn = "p" + (i + 1);
params[i] =
new MBeanParameterInfo(pn, classes[i].getName(), "", d);
}
return params;
}
|
public String toString() {
String impactString;
switch (getImpact()) {
case ACTION: impactString = "action"; break;
case ACTION_INFO: impactString = "action/info"; break;
case INFO: impactString = "info"; break;
case UNKNOWN: impactString = "unknown"; break;
default: impactString = "(" + getImpact() + ")";
}
return getClass().getName() + "[" +
"description=" + getDescription() + ", " +
"name=" + getName() + ", " +
"returnType=" + getReturnType() + ", " +
"signature=" + Arrays.asList(fastGetSignature()) + ", " +
"impact=" + impactString + ", " +
"descriptor=" + getDescriptor() +
"]";
}
|