com.dlsc.flexgantt.policy

## Class PolicyProvider

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.HashMap<Class<? extends IPolicy>,IPolicy>
    - - com.dlsc.flexgantt.policy.PolicyProvider

- All Implemented Interfaces:
    IPolicyProvider, Serializable, Cloneable, Map<Class<? extends IPolicy>,IPolicy>

      public class PolicyProvider
      extends HashMap<Class<? extends IPolicy>,IPolicy>
      implements IPolicyProvider

  For a detailed description refer to `IPolicyProvider`.
  Since:
    1.0
  Version:
    $Revision: 1.9 $
  Author:
    Dirk Lemmermann
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PolicyProvider()` Constructs a new policy provider.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPolicyProviderListener(IPolicyProviderListener l)` Adds a listener to the policy provider that will be informed about changes to the provider.
    `protected void` | `firePolicyProviderEvent(PolicyProviderEvent evt)` Sends the given event object to all listeners that are currently observing the policy provider.
    `<T extends IPolicy> T` | `getPolicy(Class<T> policyType)` Returns a policy implementation for the given policy type (policy interface).
    `void` | `removePolicyProviderListener(IPolicyProviderListener l)` Removes a listener from the policy provider.
    `<T extends IPolicy> void` | `setPolicy(Class<T> policyType, T policy)` Registers a policy implementation for the given policy type (policy interface).

    - ### Methods inherited from class java.util.HashMap

      `clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

    - ### Methods inherited from class java.util.AbstractMap

      `equals, hashCode, toString`

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

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

    - ### Methods inherited from interface java.util.Map

      `equals, hashCode`

- - ### Constructor Detail

    - #### PolicyProvider

          public PolicyProvider()

      Constructs a new policy provider.
      Since:
        1.0

  - ### Method Detail

    - #### setPolicy

          public <T extends IPolicy> void setPolicy(Class<T> policyType,
                                                    T policy)

      Description copied from interface: `IPolicyProvider`
      Registers a policy implementation for the given policy type (policy interface).
      Specified by:
        `setPolicy` in interface `IPolicyProvider`
      Type Parameters:
        `T` - the policy type
      Parameters:
        `policyType` - the policy interface class (e.g. `INodeEditPolicy`)
        `policy` - the policy implementation (e.g. `DefaultNodeEditPolicy`)
      See Also:
        `IPolicyProvider.getPolicy(Class)`

    - #### getPolicy

          public <T extends IPolicy> T getPolicy(Class<T> policyType)

      Description copied from interface: `IPolicyProvider`
      Returns a policy implementation for the given policy type (policy interface).
      Specified by:
        `getPolicy` in interface `IPolicyProvider`
      Type Parameters:
        `T` - the policy type
      Parameters:
        `policyType` - the policy interface class (e.g. `INodeEditPolicy`)
      Returns:
        a policy implementation (e.g. `DefaultNodeEditPolicy`)
      See Also:
        `IPolicyProvider.setPolicy(Class, IPolicy)`

    - #### addPolicyProviderListener

          public void addPolicyProviderListener(IPolicyProviderListener l)

      Description copied from interface: `IPolicyProvider`
      Adds a listener to the policy provider that will be informed about changes to the provider.
      Specified by:
        `addPolicyProviderListener` in interface `IPolicyProvider`
      Parameters:
        `l` - the added policy provider listener

    - #### removePolicyProviderListener

          public void removePolicyProviderListener(IPolicyProviderListener l)

      Description copied from interface: `IPolicyProvider`
      Removes a listener from the policy provider.
      Specified by:
        `removePolicyProviderListener` in interface `IPolicyProvider`
      Parameters:
        `l` - the removed policy provider listener

    - #### firePolicyProviderEvent

          protected void firePolicyProviderEvent(PolicyProviderEvent evt)

      Sends the given event object to all listeners that are currently observing the policy provider.
      Parameters:
        `evt` - the event sent to the listeners
      Since:
        1.0
      See Also:
        `addPolicyProviderListener(IPolicyProviderListener)`

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.