org.springframework.jmx.support

## Class NotificationListenerHolder

- java.lang.Object
- - org.springframework.jmx.support.NotificationListenerHolder

Direct Known Subclasses:
  NotificationListenerBean, NotificationListenerRegistrar

    public class NotificationListenerHolder
    extends Object

Helper class that aggregates a `NotificationListener`, a `NotificationFilter`, and an arbitrary handback object, as well as the names of MBeans from which the listener wishes to receive `Notifications`.

Since:
  2.5.2
Author:
  Juergen Hoeller
See Also:
  `NotificationListenerBean`, `NotificationListenerRegistrar`

### Field Summary

Fields
`protected Set<Object>` `mappedObjectNames`

### Constructor Summary

Constructors
Constructor and Description
`NotificationListenerHolder()`

### Method Summary

Methods
`boolean` `equals(Object other)`
`Object` `getHandback()` Return the (arbitrary) object that will be 'handed back' as-is by an `NotificationBroadcaster` when notifying any `NotificationListener`.
`NotificationFilter` `getNotificationFilter()` Return the `NotificationFilter` associated with the encapsulated `NotificationFilter`.
`NotificationListener` `getNotificationListener()` Get the `NotificationListener`.
`ObjectName[]` `getResolvedObjectNames()` Return the list of `ObjectName` String representations for which the encapsulated `NotificationFilter` will be registered as a listener for `Notifications`.
`int` `hashCode()`
`void` `setHandback(Object handback)` Set the (arbitrary) object that will be 'handed back' as-is by an `NotificationBroadcaster` when notifying any `NotificationListener`.
`void` `setMappedObjectName(Object mappedObjectName)` Set the `ObjectName`-style name of the single MBean that the encapsulated `NotificationFilter` will be registered with to listen for `Notifications`.
`void` `setMappedObjectNames(Object[] mappedObjectNames)` Set an array of `ObjectName`-style names of the MBeans that the encapsulated `NotificationFilter` will be registered with to listen for `Notifications`.
`void` `setNotificationFilter(NotificationFilter notificationFilter)` Set the `NotificationFilter` associated with the encapsulated `NotificationFilter`.
`void` `setNotificationListener(NotificationListener notificationListener)` Set the `NotificationListener`.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### mappedObjectNames

    protected Set<Object> mappedObjectNames

### Constructor Detail

#### NotificationListenerHolder

    public NotificationListenerHolder()

### Method Detail

#### setNotificationListener

    public void setNotificationListener(NotificationListener notificationListener)

Set the `NotificationListener`.

#### getNotificationListener

    public NotificationListener getNotificationListener()

Get the `NotificationListener`.

#### setNotificationFilter

    public void setNotificationFilter(NotificationFilter notificationFilter)

Set the `NotificationFilter` associated with the encapsulated `NotificationFilter`.

May be `null`.

#### getNotificationFilter

    public NotificationFilter getNotificationFilter()

Return the `NotificationFilter` associated with the encapsulated `NotificationFilter`.

May be `null`.

#### setHandback

    public void setHandback(Object handback)

Set the (arbitrary) object that will be 'handed back' as-is by an `NotificationBroadcaster` when notifying any `NotificationListener`.

Parameters:
  `handback` - the handback object (can be `null`)
See Also:
  `NotificationListener.handleNotification(javax.management.Notification, Object)`

#### getHandback

    public Object getHandback()

Return the (arbitrary) object that will be 'handed back' as-is by an `NotificationBroadcaster` when notifying any `NotificationListener`.

Returns:
  the handback object (may be `null`)
See Also:
  `NotificationListener.handleNotification(javax.management.Notification, Object)`

#### setMappedObjectName

    public void setMappedObjectName(Object mappedObjectName)

Set the `ObjectName`-style name of the single MBean that the encapsulated `NotificationFilter` will be registered with to listen for `Notifications`. Can be specified as `ObjectName` instance or as `String`.

See Also:
  `setMappedObjectNames(java.lang.Object[])`

#### setMappedObjectNames

    public void setMappedObjectNames(Object[] mappedObjectNames)

Set an array of `ObjectName`-style names of the MBeans that the encapsulated `NotificationFilter` will be registered with to listen for `Notifications`. Can be specified as `ObjectName` instances or as `String`s.

See Also:
  `setMappedObjectName(java.lang.Object)`

#### getResolvedObjectNames

    public ObjectName[] getResolvedObjectNames()
                                        throws MalformedObjectNameException

Return the list of `ObjectName` String representations for which the encapsulated `NotificationFilter` will be registered as a listener for `Notifications`.

Throws:
  `MalformedObjectNameException` - if an `ObjectName` is malformed

#### equals

    public boolean equals(Object other)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`