Class PropertyGroup

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,​java.lang.Object>

    public class PropertyGroup
    extends PropertyMap
    This is a helper class to access a group of properties with out having to refer to their full names.

    This class needs more work to be fully functional. It should suffice for adding property listeners and getting/setting property values, but other activies might not work out so well.

    Version:
    $Revision$
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Serial version uid
        See Also:
        Constant Field Values
      • basename

        protected final java.lang.String basename
        Base property name
    • Constructor Detail

      • PropertyGroup

        public PropertyGroup​(java.lang.String basename,
                             java.util.Properties container)
        Construct a PropertyGroup.
        Parameters:
        basename - Base property name.
        container - Property container.
        Throws:
        NullArgumentException - Basename is null.
    • Method Detail

      • getBaseName

        public final java.lang.String getBaseName()
        Get the base property name for this group.
        Returns:
        Base property name.
      • makePropertyName

        private java.lang.String makePropertyName​(java.lang.String suffix)
        Make a fully qualified property name.
        Parameters:
        suffix - Property name suffix.
      • makePropertyName

        private java.lang.String makePropertyName​(java.lang.Object suffix)
        Make a fully qualified property name.
        Parameters:
        suffix - Property name suffix.
      • containsKey

        public boolean containsKey​(java.lang.Object name)
        Check if this PropertyMap contains a given property name.
        Specified by:
        containsKey in interface java.util.Map<java.lang.Object,​java.lang.Object>
        Overrides:
        containsKey in class java.util.Properties
        Parameters:
        name - Property name.
        Returns:
        True if property map or defaults contains key.
      • put

        public java.lang.Object put​(java.lang.Object name,
                                    java.lang.Object value)
        Set a property.
        Specified by:
        put in interface java.util.Map<java.lang.Object,​java.lang.Object>
        Overrides:
        put in class PropertyMap
        Parameters:
        name - Property name.
        value - Property value.
        Returns:
        Previous property value or null.
      • get

        public java.lang.Object get​(java.lang.Object name)
        Get a property
        Specified by:
        get in interface java.util.Map<java.lang.Object,​java.lang.Object>
        Overrides:
        get in class java.util.Properties
        Parameters:
        name - Property name.
        Returns:
        Property value or null.
      • remove

        public java.lang.Object remove​(java.lang.Object name)
        Remove a property.
        Specified by:
        remove in interface java.util.Map<java.lang.Object,​java.lang.Object>
        Overrides:
        remove in class PropertyMap
        Parameters:
        name - Property name.
        Returns:
        Removed property value.
      • entrySet

        public java.util.Set entrySet()
        Returns an entry set for all properties in this group.

        This is currently ver inefficient, but should get the job done for now.

        Specified by:
        entrySet in interface java.util.Map<java.lang.Object,​java.lang.Object>
        Overrides:
        entrySet in class java.util.Properties
      • addPropertyListener

        protected void addPropertyListener​(BoundPropertyListener listener)
        Add a bound property listener.

        Generates a fully qualified property name and adds the listener under that name.

        Overrides:
        addPropertyListener in class PropertyMap
        Parameters:
        listener - Bound property listener to add.
      • removePropertyListener

        protected boolean removePropertyListener​(BoundPropertyListener listener)
        Remove a bound property listener.

        Generates a fully qualified property name and removes the listener under that name.

        Overrides:
        removePropertyListener in class PropertyMap
        Parameters:
        listener - Bound property listener to remove.
        Returns:
        True if listener was removed.