com.hazelcast.config

## Class ListenerConfig

- java.lang.Object
- - com.hazelcast.config.ListenerConfig

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable
  Direct Known Subclasses:
    CachePartitionLostListenerConfig, EntryListenerConfig, ItemListenerConfig, ListenerConfigReadOnly, MapPartitionLostListenerConfig, QuorumListenerConfig

      public class ListenerConfig
      extends Object
      implements IdentifiedDataSerializable

  Contains the configuration for an `EventListener`. The configuration contains either the classname of the EventListener implementation, or the actual EventListener instance.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `className`
    `protected EventListener` | `implementation`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ListenerConfig()` Creates a ListenerConfig without className/implementation.
    `ListenerConfig(EventListener implementation)` Creates a ListenerConfig with the given implementation.
    `ListenerConfig(ListenerConfig config)`
    `ListenerConfig(String className)` Creates a ListenerConfig with the given className.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `ListenerConfig` | `getAsReadOnly()` Deprecated. this method will be removed in 4.0; it is meant for internal usage only
    `String` | `getClassName()` Returns the name of the class of the EventListener.
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `EventListener` | `getImplementation()` Returns the EventListener implementation.
    `int` | `hashCode()`
    `boolean` | `isIncludeValue()`
    `boolean` | `isLocal()`
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `ListenerConfig` | `setClassName(String className)` Sets the class name of the EventListener.
    `ListenerConfig` | `setImplementation(EventListener implementation)` Sets the EventListener implementation.
    `String` | `toString()`
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

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

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

- - ### Field Detail

    - #### className

          protected String className

    - #### implementation

          protected EventListener implementation

  - ### Constructor Detail

    - #### ListenerConfig

          public ListenerConfig()

      Creates a ListenerConfig without className/implementation.

    - #### ListenerConfig

          public ListenerConfig(String className)

      Creates a ListenerConfig with the given className.
      Parameters:
        `className` - the name of the EventListener class
      Throws:
        `IllegalArgumentException` - if className is `null` or an empty String

    - #### ListenerConfig

          public ListenerConfig(ListenerConfig config)

    - #### ListenerConfig

          public ListenerConfig(EventListener implementation)

      Creates a ListenerConfig with the given implementation.
      Parameters:
        `implementation` - the implementation to use as EventListener
      Throws:
        `IllegalArgumentException` - if the implementation is `null`

  - ### Method Detail

    - #### getAsReadOnly

          public ListenerConfig getAsReadOnly()

      Deprecated. this method will be removed in 4.0; it is meant for internal usage only
      Gets immutable version of this configuration.
      Returns:
        immutable version of this configuration

    - #### getClassName

          public String getClassName()

      Returns the name of the class of the EventListener. If no class is specified, null is returned.
      Returns:
        the class name of the EventListener
      See Also:
        `setClassName(String)`

    - #### setClassName

          public ListenerConfig setClassName(String className)

      Sets the class name of the EventListener.

      If a implementation was set, it will be removed.

      Parameters:
        `className` - the name of the class of the EventListener
      Returns:
        the updated ListenerConfig
      Throws:
        `IllegalArgumentException` - if className is `null` or an empty String
      See Also:
        `setImplementation(java.util.EventListener)`, `getClassName()`

    - #### getImplementation

          public EventListener getImplementation()

      Returns the EventListener implementation. If none has been specified, null is returned.
      Returns:
        the EventListener implementation
      See Also:
        `setImplementation(java.util.EventListener)`

    - #### setImplementation

          public ListenerConfig setImplementation(EventListener implementation)

      Sets the EventListener implementation.

      If a className was set, it will be removed.

      Parameters:
        `implementation` - the EventListener implementation
      Returns:
        the updated ListenerConfig
      Throws:
        `IllegalArgumentException` - the implementation is `null`
      See Also:
        `setClassName(String)`, `getImplementation()`

    - #### isIncludeValue

          public boolean isIncludeValue()

    - #### isLocal

          public boolean isLocal()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

Copyright © 2018. All rights reserved.