Interface Evidence

    • Method Detail

      • getDefaultPrincipal

        default Principal getDefaultPrincipal()
        Get the default Principal associated with this evidence (may be null).
        Returns:
        the default Principal associated with this evidence (may benull)
        Since:
        1.10.0
      • getDecodedPrincipal

        default Principal getDecodedPrincipal()
        Get the Principal derived from this evidence using an evidence decoder (may be null).
        Returns:
        the Principal derived from this evidence using an evidence decoder (may be null)
        Since:
        1.10.0
      • setDecodedPrincipal

        default void setDecodedPrincipal​(Principal principal)
        Set the Principal derived from this evidence using an evidence decoder (may be null). This method is a no-op by default. It is intended to be implemented by evidence types that can be associated with a principal derived from an evidence decoder.
        Parameters:
        principal - the principal derived from this evidence using an evidence decoder (may be null)
        Since:
        1.10.0
      • castAs

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

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

        default <E extends Evidence,​R> R castAndApply​(Class<E> evidenceType,
                                                            String algorithmName,
                                                            Function<E,​R> function)
        Cast this evidence type and apply a function if the type matches.
        Type Parameters:
        E - the evidence type
        R - the return type
        Parameters:
        evidenceType - the evidence 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 evidence is not of the given type
      • castAndApply

        default <E extends Evidence,​R> R castAndApply​(Class<E> evidenceType,
                                                            Function<E,​R> function)
        Cast this evidence type and apply a function if the type matches.
        Type Parameters:
        E - the evidence type
        R - the return type
        Parameters:
        evidenceType - the evidence type class to check
        function - the function to apply
        Returns:
        the result of the function, or null if the evidence is not of the given type