public final class SecretValue extends java.lang.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 java.lang.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(java.lang.Object o) |
DataType |
getType() |
char[] |
getValue()
Returns the underlying char array content.
|
int |
hashCode() |
java.lang.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 java.lang.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 boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
SecretValue
object or on a
StructValue
that contains a secret and for instance logs the
result.toString
in class java.lang.Object
public void accept(ValueVisitor visitor)
public SecretValue copy()