Class Properties

  • All Implemented Interfaces:
    ECPProperties, ECPDisposable.DisposeListener, org.eclipse.net4j.util.event.INotifier, org.eclipse.net4j.util.event.INotifier.INotifier2, org.eclipse.net4j.util.lifecycle.IDeactivateable, org.eclipse.net4j.util.lifecycle.ILifecycle, org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation

    public class Properties
    extends Registry<java.util.Map.Entry<java.lang.String,​java.lang.String>,​ECPPropertiesObserver>
    implements ECPProperties
    Author:
    Eike Stepper
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Properties.Property  
      • Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

        org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation
      • Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

        org.eclipse.net4j.util.event.INotifier.INotifier2
    • Field Summary

      • Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

        USE_LABEL
    • Constructor Summary

      Constructors 
      Constructor Description
      Properties()
      Default constructor.
      Properties​(java.io.ObjectInput in)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addProperty​(java.lang.String key, java.lang.String value)
      Adds a key-value-pair.
      ECPProperties copy()
      Creates a copy of the current set of properties.
      protected java.lang.String getElementName​(java.util.Map.Entry<java.lang.String,​java.lang.String> element)  
      protected java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> getElementsToWrite()  
      java.util.Set<java.lang.String> getKeys()
      All stored keys.
      java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> getProperties()
      All Properties.
      java.lang.String getValue​(java.lang.String name)
      Get the value of a property identified by this key.
      boolean hasProperties()
      Whether any properties are stored.
      protected void notifyObservers​(java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> oldProperties, java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> newProperties)
      Notifies observers that the elements in the registry have changed.
      void removeProperty​(java.lang.String key)
      Removes a property.
      void write​(java.io.ObjectOutput out)  
      • Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

        activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString
      • Methods inherited from class org.eclipse.net4j.util.event.Notifier

        addListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.eclipse.net4j.util.event.INotifier

        addListener, getListeners, hasListeners, removeListener
    • Constructor Detail

      • Properties

        public Properties()
        Default constructor.
      • Properties

        public Properties​(java.io.ObjectInput in)
                   throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • write

        public void write​(java.io.ObjectOutput out)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • addProperty

        public void addProperty​(java.lang.String key,
                                java.lang.String value)
        Adds a key-value-pair.
        Specified by:
        addProperty in interface ECPProperties
        Parameters:
        key - the key of the property
        value - the value of the property
      • removeProperty

        public void removeProperty​(java.lang.String key)
        Removes a property.
        Specified by:
        removeProperty in interface ECPProperties
        Parameters:
        key - of the property to remove
      • getValue

        public java.lang.String getValue​(java.lang.String name)
        Get the value of a property identified by this key.
        Specified by:
        getValue in interface ECPProperties
        Parameters:
        name - the key of the property to find
        Returns:
        the value of the property identified by the key or null
      • getKeys

        public java.util.Set<java.lang.String> getKeys()
        All stored keys.
        Specified by:
        getKeys in interface ECPProperties
        Returns:
        an array of all keys
      • getProperties

        public java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> getProperties()
        All Properties.
        Specified by:
        getProperties in interface ECPProperties
        Returns:
        an array of Key-Value-Pairs
      • hasProperties

        public boolean hasProperties()
        Whether any properties are stored.
        Specified by:
        hasProperties in interface ECPProperties
        Returns:
        true if at least 1 property was added, false otherwise
      • copy

        public ECPProperties copy()
        Creates a copy of the current set of properties.
        Specified by:
        copy in interface ECPProperties
        Returns:
        the copy of the current properties
      • getElementName

        protected java.lang.String getElementName​(java.util.Map.Entry<java.lang.String,​java.lang.String> element)
        Specified by:
        getElementName in class Registry<java.util.Map.Entry<java.lang.String,​java.lang.String>,​ECPPropertiesObserver>
        Parameters:
        element - the element to retrieve a name for.
        Returns:
        the name of an element
      • getElementsToWrite

        protected java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> getElementsToWrite()
      • notifyObservers

        protected void notifyObservers​(java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> oldProperties,
                                       java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.String>> newProperties)
                                throws java.lang.Exception
        Description copied from class: Registry
        Notifies observers that the elements in the registry have changed.
        Specified by:
        notifyObservers in class Registry<java.util.Map.Entry<java.lang.String,​java.lang.String>,​ECPPropertiesObserver>
        Parameters:
        oldProperties - The old collection of elements
        newProperties - The new collection of elements
        Throws:
        java.lang.Exception