-
Notifications
You must be signed in to change notification settings - Fork 253
Open
Description
As a follow-up to #1001, it would be nice to simplify Matcher implementations. For example IdMatcher could be reduced to just
public record IdMatcher(@NonNull String id) implements CredentialsMatcher {
@Override
public boolean matches(@NonNull Credentials item) {
return item instanceof IdCredentials idc && id.equals(idc.getId());
}
}This would replace the advice in
credentials-plugin/src/main/java/com/cloudbees/plugins/credentials/CredentialsMatcher.java
Lines 32 to 34 in 36c1cee
| * <li>Implement {@link Object#toString()}</li> | |
| * <li>Implement {@link Object#equals(Object)} and {@link Object#hashCode()}</li> | |
| * <li>Define a {@code serialVersionUID} field to ensure consistent serialization</li> |
It is important to retain binary compatibility for the constructors, since many plugins appear to instantiate at least IdCredentials directly rather than going through CredentialsMatchers.withId.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels