descr1.setField("name", "Room");
descr1.setField("descriptorType", "attribute");
descr1.setField("displayName", "Room Number");
descr1.setField("default", "D325");
ModelMBeanAttributeInfo roomNameInfo =
new ModelMBeanAttributeInfo(
"Room", // attribute name
String.class.getName(), // attribute type
"Room name or number.", // description
READABLE, WRITABLE, !BOOLEAN, // read write
descr1 // descriptor
);
// build 'Active' read-only attribute
Descriptor descr2 = new DescriptorSupport();
descr2.setField("name", "Active");
descr2.setField("descriptorType", "attribute");
descr2.setField("getMethod", "isActive");
descr2.setField("currencyTimeLimit", "10");
ModelMBeanAttributeInfo activeInfo =
new ModelMBeanAttributeInfo(
"Active",
boolean.class.getName(),
"Printer state.",
READABLE, !WRITABLE, !BOOLEAN,
descr2