Package com.iizix.gyro
Class DeviceParameter
- java.lang.Object
- com.iizix.gyro.DeviceParameter
public final class DeviceParameter extends java.lang.ObjectClass 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 Type Class Description static classDeviceParameter.StateThe states for this DeviceParameter instance.
Field Summary
Fields Modifier and Type Field Description booleanisSensitiveFlag for sensitive value, i.e.java.lang.StringnameThe parameter name.
Constructor Summary
Constructors Constructor Description 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.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Checks if two parameters are equal.DeviceParameter.StategetState()Gets the state of the device parameter.java.lang.StringgetValue()Gets the value.inthashCode()Hash code.voidsetValue(java.lang.String value, DeviceParameter.State state)Assigns the value and the state.java.lang.StringtoString()Outputs a debug string.
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. Thestateis not used in the comparison.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- Object to compare with.- Returns:
- true if equal, false otherwise.
hashCode
public int hashCode()
Hash code.- Overrides:
hashCodein classjava.lang.Object- Returns:
- Returns the hash code.
toString
public java.lang.String toString()
Outputs a debug string.- Overrides:
toStringin classjava.lang.Object- Returns:
- String as className[name=NN,value=VV[,sensitive],state=SS]