mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-23 19:38:00 +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;
|
package org.pgpainless.key.util;
|
||||||
|
|
||||||
public class UserId implements CharSequence {
|
public final class UserId implements CharSequence {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String comment;
|
private final String comment;
|
||||||
private final String email;
|
private final String email;
|
||||||
|
|
||||||
public UserId(String name, String comment, String email) {
|
private UserId(String name, String comment, String email) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
|
@ -49,6 +49,10 @@ public class UserId implements CharSequence {
|
||||||
return new UserId(null, null, email);
|
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) {
|
public static WithComment withName(String name) {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
throw new IllegalArgumentException("Name must not be null.");
|
throw new IllegalArgumentException("Name must not be null.");
|
||||||
|
|
Loading…
Reference in a new issue