Interface Password

    • Method Detail

      • castAs

        default <P extends Password> P castAs​(Class<P> passwordType,
                                              String algorithmName)
        Cast this password type if the type and algorithm matches.
        Type Parameters:
        P - the password type
        Parameters:
        passwordType - the password type class to check
        algorithmName - the name of the algorithm or null if any algorithm is acceptable
        Returns:
        the password cast as the target type, or null if the password does not match the criteria
      • castAs

        default <P extends Password> P castAs​(Class<P> passwordType)
        Cast this password type if the type matches.
        Type Parameters:
        P - the password type
        Parameters:
        passwordType - the password type class to check
        Returns:
        the password cast as the target type, or null if the password does not match the criteria
      • castAndApply

        default <P extends Password,​R> R castAndApply​(Class<P> passwordType,
                                                            String algorithmName,
                                                            Function<P,​R> function)
        Cast this password type and apply a function if the type matches.
        Type Parameters:
        P - the password type
        R - the return type
        Parameters:
        passwordType - the password type class to check
        algorithmName - the name of the algorithm or null if any algorithm is acceptable
        function - the function to apply
        Returns:
        the result of the function, or null if the password is not of the given type
      • castAndApply

        default <P extends Password,​R> R castAndApply​(Class<P> passwordType,
                                                            Function<P,​R> function)
        Cast this password type and apply a function if the type matches.
        Type Parameters:
        P - the password type
        R - the return type
        Parameters:
        passwordType - the password type class to check
        function - the function to apply
        Returns:
        the result of the function, or null if the password is not of the given type
      • getParameterSpec

        default AlgorithmParameterSpec getParameterSpec()
        Get the applicable algorithm parameter specification for this password type.
        Returns:
        the algorithm parameter specification, or null if this password type does not support algorithms
      • impliesParameters

        default boolean impliesParameters​(AlgorithmParameterSpec parameterSpec)
        Determine if this password is matched by the given parameter specification.
        Parameters:
        parameterSpec - the parameter specification (must not be null)
        Returns:
        true if the password is matched by the parameters, false otherwise