Class DeviceParameter


  • public final class DeviceParameter
    extends java.lang.Object
    Class used to send parameters between the server and the client. Support for sensitive information by means of encryption is supported. Parameters that are sensitive are stored in a secure space on the client side.

    This class is not thread safe and gets the value and state updated in calls to the method to set to retrieve parameters.

    Author:
    Christopher Mindus
    • Nested Class Summary

      Nested Classes 
      Modifier and TypeClassDescription
      static class DeviceParameter.State
      The states for this DeviceParameter instance.
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      booleanisSensitive
      Flag for sensitive value, i.e.
      java.lang.Stringname
      The parameter name.
    • Constructor Summary

      Constructors 
      ConstructorDescription
      DeviceParameter​(java.lang.String name)
      Constructs a normal (unsecured) parameter to retrieve from the client.
      DeviceParameter​(java.lang.String name, boolean isSensitive)
      Constructs a secured (or sensitive) parameter to set or remove on the client side.
      DeviceParameter​(java.lang.String name, java.lang.String value)
      Constructs a normal (unsecured) parameter to set or remove on the client side.
      DeviceParameter​(java.lang.String name, java.lang.String value, boolean isSensitive)
      Constructs a secured (or sensitive) parameter to set or remove on the client side.
      DeviceParameter​(java.lang.String name, java.lang.String value, boolean isSensitive, DeviceParameter.State state)
      Constructs a secured (or sensitive) parameter to set or remove on the client side.
    • Field Detail

      • name

        public final java.lang.String name
        The parameter name.
      • isSensitive

        public final boolean isSensitive
        Flag for sensitive value, i.e. it must be encrypted and saved securely.
    • Constructor Detail

      • DeviceParameter

        public DeviceParameter​(java.lang.String name)
        Constructs a normal (unsecured) parameter to retrieve from the client.
        Parameters:
        name - The parameter name must be a valid Atom name without leading '$' or '-'.
        Throws:
        java.lang.IllegalArgumentException - If the name is not valid.
        java.lang.NullPointerException - If the name is null.
      • DeviceParameter

        public DeviceParameter​(java.lang.String name,
                               boolean isSensitive)
        Constructs a secured (or sensitive) parameter to set or remove on the client side.
        Parameters:
        name - The parameter name must be a valid Atom name without leading '$' or '-'.
        isSensitive - Flag indicating the value is a sensitive value, i.e. it must be encrypted and saved securely.
        Throws:
        java.lang.IllegalArgumentException - If the name is not valid.
        java.lang.NullPointerException - If the name is null.
      • DeviceParameter

        public DeviceParameter​(java.lang.String name,
                               java.lang.String value)
        Constructs a normal (unsecured) parameter to set or remove on the client side.
        Parameters:
        name - The parameter name must be a valid Atom name without leading '$' or '-'.
        value - The value, null to remove it.
        Throws:
        java.lang.IllegalArgumentException - If the name is not valid.
        java.lang.NullPointerException - If the name is null.
      • DeviceParameter

        public DeviceParameter​(java.lang.String name,
                               java.lang.String value,
                               boolean isSensitive)
        Constructs a secured (or sensitive) parameter to set or remove on the client side.
        Parameters:
        name - The parameter name must be a valid Atom name without leading '$' or '-'.
        value - The value, null to remove it.
        isSensitive - Flag indicating the value is a sensitive value, i.e. it must be encrypted and saved securely.
        Throws:
        java.lang.IllegalArgumentException - If the name is not valid.
        java.lang.NullPointerException - If the name is null.
      • DeviceParameter

        public DeviceParameter​(java.lang.String name,
                               java.lang.String value,
                               boolean isSensitive,
                               DeviceParameter.State state)
        Constructs a secured (or sensitive) parameter to set or remove on the client side.
        Parameters:
        name - The parameter name must be a valid Atom name without leading '$' or '-'.
        value - The value, null to remove it.
        isSensitive - Flag indicating the value is a sensitive value, i.e. it must be encrypted and saved securely.
        Throws:
        java.lang.IllegalArgumentException - If the name is not valid.
        java.lang.NullPointerException - If the name is null.
    • Method Detail

      • setValue

        public void setValue​(java.lang.String value,
                             DeviceParameter.State state)
        Assigns the value and the state.
        Parameters:
        value - The value, null if removed.
        state - The new state.
      • getValue

        public java.lang.String getValue()
        Gets the value.
        Returns:
        The value, null if removed.
      • getState

        public DeviceParameter.State getState()
        Gets the state of the device parameter.
        Returns:
        The state.
      • equals

        public boolean equals​(java.lang.Object o)
        Checks if two parameters are equal. The state is not used in the comparison.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - Object to compare with.
        Returns:
        true if equal, false otherwise.
      • hashCode

        public int hashCode()
        Hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        Returns the hash code.
      • toString

        public java.lang.String toString()
        Outputs a debug string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String as className[name=NN,value=VV[,sensitive],state=SS]