Package com.iizix.device
Class DeviceParameter
java.lang.Object
com.iizix.device.DeviceParameter
- Direct Known Subclasses:
DeviceAutoSignIn
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.
Valid parameter name
The valid name of a device parameter are the characters A-Z, a-z, 0-9 and any of the following characters !#$%&*+-^_`|~
. Please note that the single or double-quotes are not allowed. The name must start with a character A-Z, a-z or 0-9. The name must also have a length of 1 to 64 characters.
- Author:
- Christopher Mindus
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The states for this DeviceParameter instance.Constructor Summary
ConstructorDescriptionDeviceParameter
(String name) Constructs a normal (unsecured) parameter to retrieve, set or remove from the client depending on if thegetValue()
isnull
.DeviceParameter
(String name, boolean isSensitive) Constructs a secured (or sensitive) parameter to retrieve, set or remove from the client depending on if thegetValue()
isnull
.DeviceParameter
(String name, String value) Constructs a normal (unsecured) parameter to retrieve, set or remove from the client depending on if thevalue
isnull
.DeviceParameter
(String name, String value, boolean isSensitive) Constructs a secured (or sensitive) parameter to retrieve, set or remove from the client depending on if thevalue
isnull
.DeviceParameter
(String name, String value, boolean isSensitive, DeviceParameter.State state) Constructs a secured (or sensitive) parameter to retrieve, set or remove from the client depending on if thevalue
isnull
.Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Checks if two parameters are equal.getName()
Gets the name of the device parameter.final DeviceParameter.State
getState()
Gets the state of the device parameter.final String
getValue()
Gets the value.final int
hashCode()
Hash code.final boolean
Flag for sensitive value, i.e.final void
setState
(DeviceParameter.State state) Assigns the state.final void
setValue
(String value, DeviceParameter.State state) Assigns the value and the state.final String
toString()
Outputs a debug string.
Constructor Details
DeviceParameter
Constructs a normal (unsecured) parameter to retrieve, set or remove from the client depending on if thegetValue()
isnull
. Default value isnull
and is generally used when retrieving the parameter.- Parameters:
name
- The parameter name, see Valid parameter name.- Throws:
NullPointerException
- If the name is null.IllegalArgumentException
- If the name is not valid.
DeviceParameter
Constructs a secured (or sensitive) parameter to retrieve, set or remove from the client depending on if thegetValue()
isnull
. Default value isnull
and is generally used when retrieving the parameter.- Parameters:
name
- The parameter name, see Valid parameter name.isSensitive
- Flag indicating the value is a sensitive value, i.e. it must be encrypted and saved securely.- Throws:
NullPointerException
- If the name is null.IllegalArgumentException
- If the name is not valid.
DeviceParameter
Constructs a normal (unsecured) parameter to retrieve, set or remove from the client depending on if thevalue
isnull
.- Parameters:
name
- The parameter name, see Valid parameter name.value
- The value,null
if it the device parameter should be removed.- Throws:
NullPointerException
- If the name is null.IllegalArgumentException
- If the name is not valid.
DeviceParameter
Constructs a secured (or sensitive) parameter to retrieve, set or remove from the client depending on if thevalue
isnull
.- Parameters:
name
- The parameter name, see Valid parameter name.value
- The value,null
if it the device parameter should be removed.isSensitive
- Flag indicating the value is a sensitive value, i.e. it must be encrypted and saved securely.- Throws:
NullPointerException
- If the name is null.IllegalArgumentException
- If the name is not valid.
DeviceParameter
Constructs a secured (or sensitive) parameter to retrieve, set or remove from the client depending on if thevalue
isnull
.- 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:
IllegalArgumentException
- If the name is not valid.
Method Details
getName
Gets the name of the device parameter.- Returns:
- The name.
isSensitive
public final boolean isSensitive()Flag for sensitive value, i.e. it must be encrypted and saved securely.- Returns:
true
if the value is encrypted with device exchanges,false
otherwise.
setValue
Assigns the value and the state.- Parameters:
value
- The value,null
if it the device parameter should be removed.state
- The new state.
setState
Assigns the state.- Parameters:
state
- The new state.
getValue
Gets the value.- Returns:
- The value, null if removed.
getState
Gets the state of the device parameter.- Returns:
- The state.
equals
Checks if two parameters are equal. Thestate
is not used in the comparison.hashCode
public final int hashCode()Hash code.toString
Outputs a debug string.