- java.lang.Object
-
- org.eclipse.jgit.transport.CredentialItem
-
- org.eclipse.jgit.transport.CredentialItem.CharArrayType
-
- Direct Known Subclasses:
CredentialItem.Password
- Enclosing class:
- CredentialItem
public static class CredentialItem.CharArrayType extends CredentialItem
An item whose value is stored as a char[] and is therefore clearable.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.transport.CredentialItem
CredentialItem.CharArrayType, CredentialItem.InformationalMessage, CredentialItem.Password, CredentialItem.StringType, CredentialItem.Username, CredentialItem.YesNoType
-
-
Constructor Summary
Constructors Constructor Description CharArrayType(String promptText, boolean maskValue)Initialize a prompt for a secure value stored in a character array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Destroys the current value, clearing the internal array.char[]getValue()Get the current value.voidsetValue(char[] newValue)Set the new value, clearing the old value array.voidsetValueNoCopy(char[] newValue)Set the new value, clearing the old value array.-
Methods inherited from class org.eclipse.jgit.transport.CredentialItem
getPromptText, isValueSecure
-
-
-
-
Constructor Detail
-
CharArrayType
public CharArrayType(String promptText, boolean maskValue)
Initialize a prompt for a secure value stored in a character array.- Parameters:
promptText- prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.maskValue- true if the value should be masked from displaying during input. This should be true for passwords and other secrets, false for names and other public data.
-
-
Method Detail
-
clear
public void clear()
Destroys the current value, clearing the internal array.- Specified by:
clearin classCredentialItem
-
getValue
public char[] getValue()
Get the current value. The returned array will be cleared out whenclear()is called. Callers that need the array elements to survive should delay invokingclear()until the value is no longer necessary.- Returns:
- the current value array. The actual internal array is returned, reducing the number of copies present in memory.
-
setValue
public void setValue(char[] newValue)
Set the new value, clearing the old value array.- Parameters:
newValue- if not null, the array is copied.
-
setValueNoCopy
public void setValueNoCopy(char[] newValue)
Set the new value, clearing the old value array.- Parameters:
newValue- the new internal array. The array is NOT copied.
-
-