org.apache.tamaya.events

## Class PropertySourceChange

- java.lang.Object
- - org.apache.tamaya.events.PropertySourceChange

- All Implemented Interfaces:
    Serializable, ConfigEvent<org.apache.tamaya.spi.PropertySource>

      public final class PropertySourceChange
      extends Object
      implements ConfigEvent<org.apache.tamaya.spi.PropertySource>, Serializable

  Event that contains a set current changes that were applied or could be applied. This class is immutable and thread-safe. To create instances use `PropertySourceChangeBuilder`. Created by Anatole on 22.10.2014.
  See Also:
    Serialized Form

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getAddedSize()` Access the number current added entries.
    `Collection<PropertyChangeEvent>` | `getChanges()` Get the changes recorded.
    `ChangeType` | `getChangeType()` Gets the type of change for this PropertySource.
    `int` | `getRemovedSize()` Access the number current removed entries.
    `org.apache.tamaya.spi.PropertySource` | `getResource()` Get the underlying property provider/configuration.
    `Class<org.apache.tamaya.spi.PropertySource>` | `getResourceType()` Access the type of resource.
    `long` | `getTimestamp()` Get the timestamp in millis from the current epoch. it is expected that the timestamp and the version are unique to identify a changeset.
    `int` | `getUpdatedSize()` Access the number current updated entries.
    `String` | `getVersion()` Get the base version, usable for optimistic locking.
    `boolean` | `isAdded(String key)` Checks if the given key was added.
    `boolean` | `isEmpty()` CHecks if the current change set does not contain any changes.
    `boolean` | `isKeyAffected(String key)` Checks if the given key is added, or updated AND NOT removed.
    `boolean` | `isRemoved(String key)` Checks if the given key was removed.
    `boolean` | `isUpdated(String key)` Checks if the given key was updated.
    `static PropertySourceChange` | `ofAdded(org.apache.tamaya.spi.PropertySource propertySource)` Create a change event for a new PropertySource that was added.
    `static PropertySourceChange` | `ofDeleted(org.apache.tamaya.spi.PropertySource propertySource)` Create a change event for a deleted PropertySource.
    `String` | `toString()`

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

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

- - ### Method Detail

    - #### getChangeType

          public ChangeType getChangeType()

      Gets the type of change for this PropertySource.
      Returns:
        the type of change for this PropertySource, never null.

    - #### getResourceType

          public Class<org.apache.tamaya.spi.PropertySource> getResourceType()

      Description copied from interface: `ConfigEvent`
      Access the type of resource. This allows to easily determine the resource an event wants to observe.
      Specified by:
        `getResourceType` in interface `ConfigEvent<org.apache.tamaya.spi.PropertySource>`
      Returns:
        the resource type.

    - #### getResource

          public org.apache.tamaya.spi.PropertySource getResource()

      Get the underlying property provider/configuration.
      Specified by:
        `getResource` in interface `ConfigEvent<org.apache.tamaya.spi.PropertySource>`
      Returns:
        the underlying property provider/configuration, or null, if the change instance was deserialized.

    - #### getVersion

          public String getVersion()

      Get the base version, usable for optimistic locking.
      Specified by:
        `getVersion` in interface `ConfigEvent<org.apache.tamaya.spi.PropertySource>`
      Returns:
        the base version.

    - #### getTimestamp

          public long getTimestamp()

      Get the timestamp in millis from the current epoch. it is expected that the timestamp and the version are unique to identify a changeset.
      Specified by:
        `getTimestamp` in interface `ConfigEvent<org.apache.tamaya.spi.PropertySource>`
      Returns:
        the timestamp, when this changeset was created.

    - #### getChanges

          public Collection<PropertyChangeEvent> getChanges()

      Get the changes recorded.
      Returns:
        the recorded changes, never null.

    - #### getRemovedSize

          public int getRemovedSize()

      Access the number current removed entries.
      Returns:
        the number current removed entries.

    - #### getAddedSize

          public int getAddedSize()

      Access the number current added entries.
      Returns:
        the number current added entries.

    - #### getUpdatedSize

          public int getUpdatedSize()

      Access the number current updated entries.
      Returns:
        the number current updated entries.

    - #### isRemoved

          public boolean isRemoved(String key)

      Checks if the given key was removed.
      Parameters:
        `key` - the target key, not null.
      Returns:
        true, if the given key was removed.

    - #### isAdded

          public boolean isAdded(String key)

      Checks if the given key was added.
      Parameters:
        `key` - the target key, not null.
      Returns:
        true, if the given key was added.

    - #### isUpdated

          public boolean isUpdated(String key)

      Checks if the given key was updated.
      Parameters:
        `key` - the target key, not null.
      Returns:
        true, if the given key was updated.

    - #### isKeyAffected

          public boolean isKeyAffected(String key)

      Checks if the given key is added, or updated AND NOT removed.
      Parameters:
        `key` - the target key, not null.
      Returns:
        true, if the given key was added, or updated BUT NOT removed.

    - #### isEmpty

          public boolean isEmpty()

      CHecks if the current change set does not contain any changes.
      Returns:
        tru, if the change set is empty.

    - #### ofAdded

          public static PropertySourceChange ofAdded(org.apache.tamaya.spi.PropertySource propertySource)

      Create a change event for a new PropertySource that was added.
      Parameters:
        `propertySource` - the new property source, not null.
      Returns:
        a new PropertySourceChange, representing a PropertySource that was added.

    - #### ofDeleted

          public static PropertySourceChange ofDeleted(org.apache.tamaya.spi.PropertySource propertySource)

      Create a change event for a deleted PropertySource.
      Parameters:
        `propertySource` - the deleted property source, not null.
      Returns:
        a new PropertySourceChange, representing a PropertySource that was deleted.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2014–2016 Apache Software Foundation. All rights reserved.