public final class SecretValue extends Object implements DataValue
The content of the value is stored in a char[] which allows
for cleaning the value from memory when it is no longer needed, this can
be done via clear().
In addition the actual content will not be returned by the toString()
as a precaution for avoiding accidental displaying or logging it.
| Modifier and Type | Field and Description |
|---|---|
static String |
STRING_REPRESENTATION
Constant returned by the
toString() method of SecretValue. |
| Constructor and Description |
|---|
SecretValue(char[] value)
Create a value with the specified char array content.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ValueVisitor visitor) |
void |
clear()
Clear the content inside SecretValue
|
SecretValue |
copy() |
boolean |
equals(Object o) |
DataType |
getType() |
char[] |
getValue()
Returns the underlying char array content.
|
int |
hashCode() |
String |
toString()
Always returns "<secret>" - Safety precaution for the case when
someone uses the toString directly on
SecretValue object or on a
StructValue that contains a secret and for instance logs the
result. |
public static final String STRING_REPRESENTATION
toString() method of SecretValue.public SecretValue(char[] value)
value - char[]CoreException - if the passed char array is nullpublic char[] getValue()
public void clear()
public String toString()
SecretValue object or on a
StructValue that contains a secret and for instance logs the
result.public void accept(ValueVisitor visitor)
public SecretValue copy()
copy in interface DataValueConcurrentModificationException
if the DataValue is modified at the time of coping.Copyright © 2023. All rights reserved.