mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-23 11:27:57 +01:00
Make UserId constructor private in favor of factory methods
This commit is contained in:
parent
2ad944977d
commit
1ce28a09af
1 changed files with 6 additions and 2 deletions
|
@ -15,13 +15,13 @@
|
|||
*/
|
||||
package org.pgpainless.key.util;
|
||||
|
||||
public class UserId implements CharSequence {
|
||||
public final class UserId implements CharSequence {
|
||||
|
||||
private final String name;
|
||||
private final String comment;
|
||||
private final String email;
|
||||
|
||||
public UserId(String name, String comment, String email) {
|
||||
private UserId(String name, String comment, String email) {
|
||||
this.name = name;
|
||||
this.comment = comment;
|
||||
this.email = email;
|
||||
|
@ -49,6 +49,10 @@ public class UserId implements CharSequence {
|
|||
return new UserId(null, null, email);
|
||||
}
|
||||
|
||||
public static UserId nameAndEmail(String name, String email) {
|
||||
return withName(name).noComment().withEmail(email);
|
||||
}
|
||||
|
||||
public static WithComment withName(String name) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("Name must not be null.");
|
||||
|
|
Loading…
Reference in a new issue