Class BasePassword

  • All Implemented Interfaces:
    CloneHandler<BaseObject>, Serializable, Comparable

    public class BasePassword
    extends AbstractBaseString
    Wrapper for a String object to be editable in the GOE. Used for entering passwords which get Base64 encoded.

    This not an attempt to keep passwords safe in any way, merely of obscuring them slightly.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • BasePassword

        public BasePassword()
        Initializes the string with length 0.
      • BasePassword

        public BasePassword​(String s)
        Initializes the object with the string to parse.
        Parameters:
        s - the string to parse
    • Method Detail

      • decode

        protected String decode​(String base64)
        Turns the base64 encoded string into plain text. Expects the string to be surrounded by BASE64_START and BASE64_END
        Parameters:
        base64 - the encoded string
        Returns:
        the decoded string, null in case of an error
        See Also:
        BASE64_START, BASE64_END
      • encode

        protected String encode​(String raw)
        Encodes the given string in base64.
        Parameters:
        raw - the string to encode
        Returns:
        the encoded string
      • isValid

        public boolean isValid​(String value)
        Checks whether the string value is a valid presentation for this class.
        Overrides:
        isValid in class AbstractBaseString
        Parameters:
        value - the string value to check
        Returns:
        always true if not base64 encoded, otherwise the base64 string must be properly surrounded
        See Also:
        BASE64_START, BASE64_END
      • setValue

        public void setValue​(String value)
        Sets the string value.
        Overrides:
        setValue in class AbstractBaseString
        Parameters:
        value - the string value, clear text or base64 encoded
      • getMaskedValue

        public String getMaskedValue()
        Returns the current string value masked with MASK_CHAR.
        Returns:
        the masked password
        See Also:
        MASK_CHAR
      • getTipText

        public String getTipText()
        Returns a tool tip for the GUI editor (ignored if null is returned).
        Specified by:
        getTipText in class AbstractBaseString
        Returns:
        the tool tip