Package 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
Modifier and Type
Field
Description
`protected Set<Object>`
`mappedObjectNames`

## Constructor Summary

Constructors
Constructor
Description
`NotificationListenerHolder()`

## Method Summary

Modifier and Type
Method
Description
`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 `NotificationListener`.
`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 Details

### mappedObjectNames

@Nullable protected Set<Object> mappedObjectNames

## Constructor Details

### NotificationListenerHolder

public NotificationListenerHolder()

## Method Details

### setNotificationListener

public void setNotificationListener(@Nullable NotificationListener notificationListener)
Set the `NotificationListener`.

### getNotificationListener

@Nullable public NotificationListener getNotificationListener()
Get the `NotificationListener`.

### setNotificationFilter

public void setNotificationFilter(@Nullable NotificationFilter notificationFilter)
Set the `NotificationFilter` associated with the encapsulated `NotificationFilter`.

May be `null`.

### getNotificationFilter

@Nullable public NotificationFilter getNotificationFilter()
Return the `NotificationFilter` associated with the encapsulated `NotificationListener`.

May be `null`.

### setHandback

public void setHandback(@Nullable 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

@Nullable 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(@Nullable 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

@Nullable 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(@Nullable Object other)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`