Class SelectUserId
- java.lang.Object
-
- org.pgpainless.util.selection.userid.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 givenstatic SelectUserId
byEmail(java.lang.CharSequence email)
Filter that selects user-ids by the givenstatic SelectUserId
containsEmailAddress(java.lang.CharSequence email)
Filter that filters for user-ids which contain the givenstatic SelectUserId
containsSubstring(java.lang.CharSequence query)
Filter that filters for user-ids which contain the givenstatic SelectUserId
exactMatch(java.lang.CharSequence query)
Filter that filters for user-ids which match the givenjava.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 givenstatic SelectUserId
or(SelectUserId... filters)
Filter that filters for user-ids which pass at least one of the givenjava.util.List<java.lang.String>
selectUserIds(java.util.List<java.lang.String> userIds)
Select all acceptable (seeaccept(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 givenstatic SelectUserId
validUserId(org.bouncycastle.openpgp.PGPKeyRing keyRing)
Filter that filters for valid user-ids on the given
-
-
-
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 (seeaccept(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 givenquery
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 givenquery
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 givensubstring
.- Parameters:
substring
- substring- Returns:
- filter
-
containsEmailAddress
public static SelectUserId containsEmailAddress(@Nonnull java.lang.CharSequence email)
Filter that filters for user-ids which contain the givenemail
address. Note: This only accepts user-ids which properly have the email address surrounded by angle brackets. The argumentemail
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 givenkeyRing
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 givenfilters
.- 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 givenfilters
.- Parameters:
filters
- filters- Returns:
- filter
-
not
public static SelectUserId not(SelectUserId filter)
Filter that inverts the result of the givenfilter
.- Parameters:
filter
- filter- Returns:
- inverting filter
-
byEmail
public static SelectUserId byEmail(java.lang.CharSequence email)
Filter that selects user-ids by the givenemail
address. It returns user-ids which either contain the givenemail
address as angle-bracketed string, or which equal the givenemail
string exactly.- Parameters:
email
- email- Returns:
- filter
-
-