ManagedBean (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.tomcat.util.modeler, class: ManagedBean

# Class ManagedBean

java.lang.Object
org.apache.tomcat.util.modeler.ManagedBean

All Implemented Interfaces:
  `Serializable`

public class ManagedBean extends Object implements Serializable

Internal configuration information for a managed bean (MBean) descriptor.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected String`
  `className`
  The fully qualified name of the Java class of the MBean.
  `protected String`
  `description`
  The human-readable description of this MBean.
  `protected String`
  `domain`
  The ObjectName domain in which this MBean should be registered.
  `protected String`
  `group`
  The group to which this MBean belongs.
  `protected String`
  `name`
  The name of this managed bean.
  `protected String`
  `type`
  The fully qualified name of the Java class of the resource implementation class.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ManagedBean()`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAttribute(AttributeInfo attribute)`
  Add a new attribute to the set of attributes for this MBean.
  `void`
  `addNotification(NotificationInfo notification)`
  Add a new notification to the set of notifications for this MBean.
  `void`
  `addOperation(OperationInfo operation)`
  Add a new operation to the set of operations for this MBean.
  `DynamicMBean`
  `createMBean(Object instance)`
  Create and return a `ModelMBean` that has been preconfigured with the `ModelMBeanInfo` information for this managed bean, and is associated with the specified managed object instance.
  `AttributeInfo[]`
  `getAttributes()`
  Return the collection of attributes for this MBean.
  `String`
  `getClassName()`
  The fully qualified name of the Java class of the MBean described by this descriptor.
  `String`
  `getDescription()`
  Return the human-readable description of this MBean.
  `String`
  `getDomain()`
  Return the (optional) `ObjectName` domain in which this MBean should be registered in the MBeanServer.
  `String`
  `getGroup()`
  Return the (optional) group to which this MBean belongs.
  `Method`
  `getInvoke(String aname, Object[] params, String[] signature, BaseModelMBean bean, Object resource)`
  Get the method to invoke for the given operation.
  `String`
  `getName()`
  Return the name of this managed bean, which must be unique among all MBeans managed by a particular MBeans server.
  `NotificationInfo[]`
  `getNotifications()`
  Return the collection of notifications for this MBean.
  `OperationInfo[]`
  `getOperations()`
  Return the collection of operations for this MBean.
  `Method`
  `getSetter(String aname, BaseModelMBean bean, Object resource)`
  Get the setter method for the given attribute.
  `String`
  `getType()`
  Return the fully qualified name of the Java class of the resource implementation class described by the managed bean described by this descriptor.
  `void`
  `setClassName(String className)`
  Set the fully qualified name of the Java class of the MBean.
  `void`
  `setDescription(String description)`
  Set the human-readable description of this MBean.
  `void`
  `setDomain(String domain)`
  Set the (optional) `ObjectName` domain in which this MBean should be registered.
  `void`
  `setGroup(String group)`
  Set the (optional) group to which this MBean belongs.
  `void`
  `setName(String name)`
  Set the name of this managed bean.
  `void`
  `setType(String type)`
  Set the fully qualified name of the Java class of the resource implementation class.
  `String`
  `toString()`
  Return a string representation of this managed bean.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### className

    protected String className
    The fully qualified name of the Java class of the MBean.

  - ### description

    protected String description
    The human-readable description of this MBean.

  - ### domain

    protected String domain
    The ObjectName domain in which this MBean should be registered.

  - ### group

    protected String group
    The group to which this MBean belongs.

  - ### name

    protected String name
    The name of this managed bean.

  - ### type

    protected String type
    The fully qualified name of the Java class of the resource implementation class.

- ## Constructor Details

  - ### ManagedBean

    public ManagedBean()
    Constructor. Will add default attributes.

- ## Method Details

  - ### getAttributes

    public AttributeInfo[] getAttributes()
    Return the collection of attributes for this MBean.
    Returns:
      the collection of attributes for this MBean

  - ### getClassName

    public String getClassName()
    The fully qualified name of the Java class of the MBean described by this descriptor. If not specified, the standard JMX class (`javax.management.modelmbean.RequiredModeLMBean`) will be utilized.
    Returns:
      the class name

  - ### setClassName

    public void setClassName(String className)
    Set the fully qualified name of the Java class of the MBean.
    Parameters:
      `className` - the className to set

  - ### getDescription

    public String getDescription()
    Return the human-readable description of this MBean.
    Returns:
      the human-readable description of this MBean

  - ### setDescription

    public void setDescription(String description)
    Set the human-readable description of this MBean.
    Parameters:
      `description` - the description to set

  - ### getDomain

    public String getDomain()
    Return the (optional) `ObjectName` domain in which this MBean should be registered in the MBeanServer.
    Returns:
      the (optional) `ObjectName` domain in which this MBean should be registered

  - ### setDomain

    public void setDomain(String domain)
    Set the (optional) `ObjectName` domain in which this MBean should be registered.
    Parameters:
      `domain` - the domain to set

  - ### getGroup

    public String getGroup()
    Return the (optional) group to which this MBean belongs.
    Returns:
      the (optional) group to which this MBean belongs

  - ### setGroup

    public void setGroup(String group)
    Set the (optional) group to which this MBean belongs.
    Parameters:
      `group` - the group to set

  - ### getName

    public String getName()
    Return the name of this managed bean, which must be unique among all MBeans managed by a particular MBeans server.
    Returns:
      the name of this managed bean

  - ### setName

    public void setName(String name)
    Set the name of this managed bean.
    Parameters:
      `name` - the name to set

  - ### getNotifications

    public NotificationInfo[] getNotifications()
    Return the collection of notifications for this MBean.
    Returns:
      the collection of notifications for this MBean

  - ### getOperations

    public OperationInfo[] getOperations()
    Return the collection of operations for this MBean.
    Returns:
      the collection of operations for this MBean

  - ### getType

    public String getType()
    Return the fully qualified name of the Java class of the resource implementation class described by the managed bean described by this descriptor.
    Returns:
      the fully qualified name of the Java class of the resource implementation class

  - ### setType

    public void setType(String type)
    Set the fully qualified name of the Java class of the resource implementation class.
    Parameters:
      `type` - the type to set

  - ### addAttribute

    public void addAttribute(AttributeInfo attribute)
    Add a new attribute to the set of attributes for this MBean.
    Parameters:
      `attribute` - The new attribute descriptor

  - ### addNotification

    public void addNotification(NotificationInfo notification)
    Add a new notification to the set of notifications for this MBean.
    Parameters:
      `notification` - The new notification descriptor

  - ### addOperation

    public void addOperation(OperationInfo operation)
    Add a new operation to the set of operations for this MBean.
    Parameters:
      `operation` - The new operation descriptor

  - ### createMBean

    public DynamicMBean createMBean(Object instance) throws InstanceNotFoundException, MBeanException, RuntimeOperationsException
    Create and return a `ModelMBean` that has been preconfigured with the `ModelMBeanInfo` information for this managed bean, and is associated with the specified managed object instance. The returned `ModelMBean` will NOT have been registered with our `MBeanServer`.
    Parameters:
      `instance` - Instanced of the managed object, or `null` for no associated instance
    Returns:
      the MBean
    Throws:
      `InstanceNotFoundException` - if the managed resource object cannot be found
      `MBeanException` - if a problem occurs instantiating the `ModelMBean` instance
      `RuntimeOperationsException` - if a JMX runtime error occurs

  - ### toString

    public String toString()
    Return a string representation of this managed bean.
    Overrides:
      `toString` in class `Object`

  - ### getSetter

    public Method getSetter(String aname, BaseModelMBean bean, Object resource) throws AttributeNotFoundException, ReflectionException
    Get the setter method for the given attribute.
    Parameters:
      `aname` - The attribute name
      `bean` - The MBean
      `resource` - The resource
    Returns:
      the setter method
    Throws:
      `AttributeNotFoundException` - if the attribute is not found
      `ReflectionException` - if a reflection error occurs

  - ### getInvoke

    public Method getInvoke(String aname, Object[] params, String[] signature, BaseModelMBean bean, Object resource) throws MBeanException, ReflectionException
    Get the method to invoke for the given operation.
    Parameters:
      `aname` - The operation name
      `params` - The parameters
      `signature` - The parameter signature
      `bean` - The MBean
      `resource` - The resource
    Returns:
      the method to invoke
    Throws:
      `MBeanException` - if the operation is not found
      `ReflectionException` - if a reflection error occurs