public MBeanAttributeInfo(String name,
String description,
Method getter,
Method setter) throws IntrospectionException {
this(name,
attributeType(getter, setter),
description,
(getter != null),
(setter != null),
isIs(getter),
ImmutableDescriptor.union(Introspector.descriptorForElement(getter),
Introspector.descriptorForElement(setter)));
}
This constructor takes the name of a simple attribute, and Method
objects for reading and writing the attribute. The Descriptor
of the constructed object will include fields contributed by any
annotations on the {@code Method} objects that contain the
DescriptorKey meta-annotation.
Parameters:
name - The programmatic name of the attribute.
description - A human readable description of the attribute.
getter - The method used for reading the attribute value.
May be null if the property is write-only.
setter - The method used for writing the attribute value.
May be null if the attribute is read-only.
Throws:
IntrospectionException - There is a consistency
problem in the definition of this attribute.
- exception:
IntrospectionException - There is a consistency
problem in the definition of this attribute.
|
public MBeanAttributeInfo(String name,
String type,
String description,
boolean isReadable,
boolean isWritable,
boolean isIs) {
this(name, type, description, isReadable, isWritable, isIs,
(Descriptor) null);
}
Constructs an MBeanAttributeInfo object. Parameters:
name - The name of the attribute.
type - The type or class name of the attribute.
description - A human readable description of the attribute.
isReadable - True if the attribute has a getter method, false otherwise.
isWritable - True if the attribute has a setter method, false otherwise.
isIs - True if this attribute has an "is" getter, false otherwise.
Throws:
IllegalArgumentException - if {@code isIs} is true but
{@code isReadable} is not, or if {@code isIs} is true and
{@code type} is not {@code boolean} or {@code java.lang.Boolean}.
(New code should always use {@code boolean} rather than
{@code java.lang.Boolean}.)
|
public MBeanAttributeInfo(String name,
String type,
String description,
boolean isReadable,
boolean isWritable,
boolean isIs,
Descriptor descriptor) {
super(name, description, descriptor);
this.attributeType = type;
this.isRead = isReadable;
this.isWrite = isWritable;
if (isIs && !isReadable) {
throw new IllegalArgumentException("Cannot have an \"is\" getter " +
"for a non-readable attribute");
}
if (isIs && !type.equals("java.lang.Boolean") &&
!type.equals("boolean")) {
throw new IllegalArgumentException("Cannot have an \"is\" getter " +
"for a non-boolean attribute");
}
this.is = isIs;
}
Constructs an MBeanAttributeInfo object. Parameters:
name - The name of the attribute.
type - The type or class name of the attribute.
description - A human readable description of the attribute.
isReadable - True if the attribute has a getter method, false otherwise.
isWritable - True if the attribute has a setter method, false otherwise.
isIs - True if this attribute has an "is" getter, false otherwise.
descriptor - The descriptor for the attribute. This may be null
which is equivalent to an empty descriptor.
Throws:
IllegalArgumentException - if {@code isIs} is true but
{@code isReadable} is not, or if {@code isIs} is true and
{@code type} is not {@code boolean} or {@code java.lang.Boolean}.
(New code should always use {@code boolean} rather than
{@code java.lang.Boolean}.)
- since:
1.6 -
|