Class SelectUserId


  • public abstract class SelectUserId
    extends java.lang.Object
    Filter for selecting user-ids from keys and from lists.
    • Constructor Summary

      Constructors 
      Constructor Description
      SelectUserId()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract boolean accept​(java.lang.String userId)
      Return true, if the given user-id is accepted by this particular filter, false otherwise.
      static SelectUserId and​(SelectUserId... filters)
      Filter that filters for user-ids which pass all the given
      static SelectUserId byEmail​(java.lang.CharSequence email)
      Filter that selects user-ids by the given
      static SelectUserId containsEmailAddress​(java.lang.CharSequence email)
      Filter that filters for user-ids which contain the given
      static SelectUserId containsSubstring​(java.lang.CharSequence query)
      Filter that filters for user-ids which contain the given
      static SelectUserId exactMatch​(java.lang.CharSequence query)
      Filter that filters for user-ids which match the given
      java.lang.String firstMatch​(java.util.List<java.lang.String> userIds)
      Return the first valid, acceptable user-id from the list of user-ids.
      java.lang.String firstMatch​(org.bouncycastle.openpgp.PGPKeyRing keyRing)
      Return the first valid, acceptable user-id from the given public or secret key ring.
      static SelectUserId not​(SelectUserId filter)
      Filter that inverts the result of the given
      static SelectUserId or​(SelectUserId... filters)
      Filter that filters for user-ids which pass at least one of the given
      java.util.List<java.lang.String> selectUserIds​(java.util.List<java.lang.String> userIds)
      Select all acceptable (see accept(String)) from the given list of user-ids.
      java.util.List<java.lang.String> selectUserIds​(org.bouncycastle.openpgp.PGPKeyRing keyRing)
      Select all currently valid user-ids of the given key ring.
      static SelectUserId startsWith​(java.lang.CharSequence substring)
      Filter that filters for user-ids which start with the given
      static SelectUserId validUserId​(org.bouncycastle.openpgp.PGPKeyRing keyRing)
      Filter that filters for valid user-ids on the given
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SelectUserId

        public SelectUserId()
    • Method Detail

      • accept

        protected abstract boolean accept​(java.lang.String userId)
        Return true, if the given user-id is accepted by this particular filter, false otherwise.
        Parameters:
        userId - user-id
        Returns:
        acceptance of the filter
      • selectUserIds

        @Nonnull
        public java.util.List<java.lang.String> selectUserIds​(@Nonnull
                                                              org.bouncycastle.openpgp.PGPKeyRing keyRing)
        Select all currently valid user-ids of the given key ring.
        Parameters:
        keyRing - public or secret key ring
        Returns:
        valid user-ids
      • selectUserIds

        @Nonnull
        public java.util.List<java.lang.String> selectUserIds​(@Nonnull
                                                              java.util.List<java.lang.String> userIds)
        Select all acceptable (see accept(String)) from the given list of user-ids.
        Parameters:
        userIds - list of user-ids
        Returns:
        sub-list of acceptable user-ids
      • firstMatch

        @Nullable
        public java.lang.String firstMatch​(org.bouncycastle.openpgp.PGPKeyRing keyRing)
        Return the first valid, acceptable user-id from the given public or secret key ring.
        Parameters:
        keyRing - public or secret key ring
        Returns:
        first matching valid user-id or null
      • firstMatch

        @Nullable
        public java.lang.String firstMatch​(@Nonnull
                                           java.util.List<java.lang.String> userIds)
        Return the first valid, acceptable user-id from the list of user-ids.
        Parameters:
        userIds - list of user-ids
        Returns:
        first matching valid user-id or null
      • containsSubstring

        public static SelectUserId containsSubstring​(@Nonnull
                                                     java.lang.CharSequence query)
        Filter that filters for user-ids which contain the given
        query
        as a substring.
        Parameters:
        query - query
        Returns:
        filter
      • exactMatch

        public static SelectUserId exactMatch​(@Nonnull
                                              java.lang.CharSequence query)
        Filter that filters for user-ids which match the given
        query
        exactly.
        Parameters:
        query - query
        Returns:
        filter
      • startsWith

        public static SelectUserId startsWith​(@Nonnull
                                              java.lang.CharSequence substring)
        Filter that filters for user-ids which start with the given
        substring
        .
        Parameters:
        substring - substring
        Returns:
        filter
      • containsEmailAddress

        public static SelectUserId containsEmailAddress​(@Nonnull
                                                        java.lang.CharSequence email)
        Filter that filters for user-ids which contain the given
        email
        address. Note: This only accepts user-ids which properly have the email address surrounded by angle brackets. The argument
        email
        can both be a plain email address (
        "[email protected]"
        ), or surrounded by angle brackets (<pre>"<[email protected]>"</pre>), the result of the filter will be the same.
        Parameters:
        email - email address
        Returns:
        filter
      • validUserId

        public static SelectUserId validUserId​(org.bouncycastle.openpgp.PGPKeyRing keyRing)
        Filter that filters for valid user-ids on the given
        keyRing
        only.
        Parameters:
        keyRing - public / secret keys
        Returns:
        filter
      • and

        public static SelectUserId and​(SelectUserId... filters)
        Filter that filters for user-ids which pass all the given
        filters
        .
        Parameters:
        filters - filters
        Returns:
        filter
      • or

        public static SelectUserId or​(SelectUserId... filters)
        Filter that filters for user-ids which pass at least one of the given
        filters
        .
        Parameters:
        filters - filters
        Returns:
        filter
      • not

        public static SelectUserId not​(SelectUserId filter)
        Filter that inverts the result of the given
        filter
        .
        Parameters:
        filter - filter
        Returns:
        inverting filter
      • byEmail

        public static SelectUserId byEmail​(java.lang.CharSequence email)
        Filter that selects user-ids by the given
        email
        address. It returns user-ids which either contain the given
        email
        address as angle-bracketed string, or which equal the given
        email
        string exactly.
        Parameters:
        email - email
        Returns:
        filter