FileDocCategorySizeDatePackage
MBeanConstructorInfo.javaAPI DocJava SE 6 API7001Tue Jun 10 00:26:12 BST 2008javax.management

MBeanConstructorInfo

public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable
Describes a constructor exposed by an MBean. Instances of this class are immutable. Subclasses may be mutable but this is not recommended.
since
1.5

Fields Summary
static final long
serialVersionUID
static final MBeanConstructorInfo[]
NO_CONSTRUCTORS
private final transient boolean
arrayGettersSafe
private final MBeanParameterInfo[]
signature
Constructors Summary
public MBeanConstructorInfo(String description, Constructor constructor)
Constructs an MBeanConstructorInfo object. The {@link Descriptor} of the constructed object will include fields contributed by any annotations on the {@code Constructor} object that contain the {@link DescriptorKey} meta-annotation.

param
description A human readable description of the operation.
param
constructor The java.lang.reflect.Constructor object describing the MBean constructor.


                                                         
         
	this(constructor.getName(), description,
	     constructorSignature(constructor),
             Introspector.descriptorForElement(constructor));
    
public MBeanConstructorInfo(String name, String description, MBeanParameterInfo[] signature)
Constructs an MBeanConstructorInfo object.

param
name The name of the constructor.
param
signature MBeanParameterInfo objects describing the parameters(arguments) of the constructor. This may be null with the same effect as a zero-length array.
param
description A human readable description of the constructor.

        this(name, description, signature, null);
    
public MBeanConstructorInfo(String name, String description, MBeanParameterInfo[] signature, Descriptor descriptor)
Constructs an MBeanConstructorInfo object.

param
name The name of the constructor.
param
signature MBeanParameterInfo objects describing the parameters(arguments) of the constructor. This may be null with the same effect as a zero-length array.
param
description A human readable description of the constructor.
param
descriptor The descriptor for the constructor. This may be null which is equivalent to an empty descriptor.
since
1.6

	super(name, description, descriptor);

	if (signature == null || signature.length == 0)
	    signature = MBeanParameterInfo.NO_PARAMS;
	else
	    signature = (MBeanParameterInfo[]) signature.clone();
	this.signature = signature;
	this.arrayGettersSafe =
	    MBeanInfo.arrayGettersSafe(this.getClass(),
				       MBeanConstructorInfo.class);
    
Methods Summary
public java.lang.Objectclone()

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.

	 try {
	     return super.clone() ;
	 } catch (CloneNotSupportedException e) {
	     // should not happen as this class is cloneable
	     return null;
	 }
     
private static javax.management.MBeanParameterInfo[]constructorSignature(java.lang.reflect.Constructor cn)

	final Class[] classes = cn.getParameterTypes();
        final Annotation[][] annots = cn.getParameterAnnotations();
        return MBeanOperationInfo.parameters(classes, annots);
    
public booleanequals(java.lang.Object o)
Compare this MBeanConstructorInfo to another.

param
o the object to compare to.
return
true if and only if o is an MBeanConstructorInfo such that its {@link #getName()}, {@link #getDescription()}, {@link #getSignature()}, and {@link #getDescriptor()} values are equal (not necessarily identical) to those of this MBeanConstructorInfo. Two signature arrays are equal if their elements are pairwise equal.

	if (o == this)
	    return true;
	if (!(o instanceof MBeanConstructorInfo))
	    return false;
	MBeanConstructorInfo p = (MBeanConstructorInfo) o;
	return (p.getName().equals(getName()) &&
		p.getDescription().equals(getDescription()) &&
		Arrays.equals(p.fastGetSignature(), fastGetSignature()) &&
                p.getDescriptor().equals(getDescriptor()));
    
private javax.management.MBeanParameterInfo[]fastGetSignature()

	if (arrayGettersSafe)
	    return signature;
	else
	    return getSignature();
    
public javax.management.MBeanParameterInfo[]getSignature()

Returns the list of parameters for this constructor. 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.

return
An array of MBeanParameterInfo objects.

	if (signature.length == 0)
            return signature;
	else
	    return (MBeanParameterInfo[]) signature.clone();
    
public inthashCode()

	int hash = getName().hashCode();
	MBeanParameterInfo[] sig = fastGetSignature();
	for (int i = 0; i < sig.length; i++)
	    hash ^= sig[i].hashCode();
	return hash;
    
public java.lang.StringtoString()

        return
            getClass().getName() + "[" +
            "description=" + getDescription() + ", " +
            "name=" + getName() + ", " +
            "signature=" + Arrays.asList(fastGetSignature()) + ", " +
            "descriptor=" + getDescriptor() +
            "]";