public final class ObfuscatedString extends java.lang.Object implements IObfuscatedString
ODI domain layer uses this class to model a string that is obfuscated. Typical obfuscated strings are passwords and credentials.
An instance of ObfuscatedString
doesn't offer any additional method and primarily
provides type safety and is a convenient holder for a string that is obfuscated.
Modifier and Type | Method and Description |
---|---|
char[] |
getObfuscatedValue()
Returns a char[] representing this ObfuscatedString.
|
static ObfuscatedString |
obfuscate(char[] pStringToObfuscate)
Creates an
ObfuscatedString instance from the given not obfuscated password
as a char array. |
static ObfuscatedString |
obfuscate(java.lang.String pStringToObfuscate)
Deprecated.
use
obfuscate(char[]) instead for better security |
java.lang.String |
toString()
Returns a
String object representing this ObfuscatedString. |
static ObfuscatedString |
valueOf(java.lang.String pObfuscatedString)
Creates an
ObfuscatedString instance from the string standard representation as
described in the toString() method. |
@Deprecated public static ObfuscatedString obfuscate(java.lang.String pStringToObfuscate)
obfuscate(char[])
instead for better securityObfuscatedString
instance from the given not obfuscated string.
Note that the given string must not be null
. In order to create an
ObfuscatedString
for an empty password, the empty string (i.e. ""
)
must be used.
pStringToObfuscate
- the string to obfuscateObfuscatedString
instanceDomainRuntimeException
- if the given string is null
public static ObfuscatedString obfuscate(char[] pStringToObfuscate)
ObfuscatedString
instance from the given not obfuscated password
as a char array.
Note that the given char array must not be null
. In order to create an
ObfuscatedString
for an empty password, the empty string (i.e. ""
)
must be used.
After calling this method the caller needs to make sure to reset all chars of the the passed in char array if it is sensitive info e.g. password.
pStringToObfuscate
- the string to obfuscateObfuscatedString
instanceDomainRuntimeException
- if the given char array is null
public static ObfuscatedString valueOf(java.lang.String pObfuscatedString)
ObfuscatedString
instance from the string standard representation as
described in the toString()
method.pObfuscatedString
- the already obfuscated StringObfuscatedString
holding the given obfuscated stringDomainRuntimeException
- if the given string is null
public java.lang.String toString()
String
object representing this ObfuscatedString.toString
in interface IObfuscatedString
toString
in class java.lang.Object
Object.toString()
public char[] getObfuscatedValue()