Class PropertiesMessage

  • All Implemented Interfaces:
    PlatformMessage, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>

    public class PropertiesMessage
    extends AbstractPlatformMessage
    implements java.lang.Iterable<java.lang.String>
    Properties messages contain a set of properties to be delivered to a component. These properties can be used to update configuration or kick off a process based on the settings in the message.
    See Also:
    Serialized Form
    • Constructor Detail

      • PropertiesMessage

        public PropertiesMessage​(java.util.UUID cid)
        Constructor. Creates a new properties message with the given client ID and no initial properties set. Properties can be added later on with the setProperty method.
        Parameters:
        cid - the client ID
      • PropertiesMessage

        public PropertiesMessage​(java.util.UUID cid,
                                 java.lang.Object... args)
        Constructor. Creates a new properties message with the given client ID and properties specified.

        Properties should be given as pairs of name,value arguments.

        For example:

         new PropertiesMessage("clientid", "myproperty", "thevalue", "anotherprop", "anotherval")
         
        Parameters:
        cid - the client ID
        args - the arguments
    • Method Detail

      • getProperty

        public java.lang.String getProperty​(java.lang.String key,
                                            java.lang.String defaultVal)
        Gets a String property from this message, or default if it doesn't exist or is null to begin with
        Overrides:
        getProperty in class AbstractPlatformMessage
        Parameters:
        key - the key
        defaultVal - the default value
        Returns:
        the property value or the default if not found
      • getProperty

        public boolean getProperty​(java.lang.String key,
                                   boolean defaultVal)
        Gets a boolean property from this message, or boolean default if it doesn't exist or is null to begin with. The value will be returned as a boolean
        Overrides:
        getProperty in class AbstractPlatformMessage
        Parameters:
        key - the key
        defaultVal - the default value
        Returns:
        the property value or the default if not found
      • getProperty

        public long getProperty​(java.lang.String key,
                                long defaultVal)
        Gets a long property from this message, or long default if it doesn't exist or is null to begin with. The value will be returned as a long.
        Overrides:
        getProperty in class AbstractPlatformMessage
        Parameters:
        key - the key
        defaultVal - the default value
        Returns:
        the property value or the default if not found
      • getProperty

        public int getProperty​(java.lang.String key,
                               int defaultVal)
        Get an integer property from this message, or int default if it doesn't exist or is null to begin with. The value will be returned as a int.
        Overrides:
        getProperty in class AbstractPlatformMessage
        Parameters:
        key - the key
        defaultVal - the default value
        Returns:
        the property value or the default if not found
      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Gets an iterator to iterate over property key names.
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
        Returns:
        the property key name iterator