Class User.Name
- java.lang.Object
-
- com.aoindustries.aoserv.client.account.User.Name
-
- com.aoindustries.aoserv.client.linux.User.Name
-
- com.aoindustries.aoserv.client.postgresql.User.Name
-
- All Implemented Interfaces:
DtoFactory<UserName>
,FastExternalizable
,Internable<User.Name>
,Externalizable
,Serializable
,Comparable<User.Name>
- Enclosing class:
- User
public static final class User.Name extends User.Name implements FastExternalizable
Represents a PostgreSQL user ID. PostgreSQL user ids must:- Be non-null
- Be non-empty
- Be between 1 and 31 characters
- Must start with
[a-z]
- The rest of the characters may contain [a-z], [0-9], and underscore (_)
- Must be a valid
User.Name
- this is implied by the above rules
- Author:
- AO Industries, Inc.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
POSTGRESQL_NAME_MAX_LENGTH
The maximum length of a PostgreSQL username.-
Fields inherited from class com.aoindustries.aoserv.client.linux.User.Name
LINUX_NAME_MAX_LENGTH
-
Fields inherited from class com.aoindustries.aoserv.client.account.User.Name
MAX_LENGTH, name
-
-
Constructor Summary
Constructors Constructor Description Name()
Deprecated.Only required for implementation, do not use directly.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PostgresUserName
getDto()
long
getSerialVersionUID()
User.Name
intern()
Interns this name much in the same fashion asString.intern()
.protected void
validate()
static ValidationResult
validate(String id)
Validates a PostgreSQL user id.static User.Name
valueOf(String id)
-
Methods inherited from class com.aoindustries.aoserv.client.account.User.Name
compareTo, equals, hashCode, readExternal, toString, writeExternal
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
-
-
-
-
Field Detail
-
POSTGRESQL_NAME_MAX_LENGTH
public static final int POSTGRESQL_NAME_MAX_LENGTH
The maximum length of a PostgreSQL username.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Name
@Deprecated public Name()
Deprecated.Only required for implementation, do not use directly.- See Also:
FastExternalizable
-
-
Method Detail
-
validate
public static ValidationResult validate(String id)
Validates a PostgreSQL user id.
-
valueOf
public static User.Name valueOf(String id) throws ValidationException
- Parameters:
id
- whennull
, returnsnull
- Throws:
ValidationException
-
validate
protected void validate() throws ValidationException
- Overrides:
validate
in classUser.Name
- Throws:
ValidationException
-
intern
public User.Name intern()
Description copied from class:User.Name
Interns this name much in the same fashion asString.intern()
.Because this has subtypes, two
User.Name
that areUser.Name.equals(java.lang.Object)
may not necessarily return the same instance object after interning. Thus, unless you know objects are of the same class,User.Name.equals(java.lang.Object)
should still be used for equality check instead of theobj1 == obj2
shortcut.To more efficiently check post-interned equivalence, one could also do
obj1 == obj2 || (obj1.getClass() != obj2.getClass() && obj1.equals(obj2))
, but is it worth it?And then if we abuse the fact that interned user ids have an interned name, one could check equivalence of post-interned user ids as
obj1.getId() == obj2.getId()
, but once again, is it worth it? Just callUser.Name.equals(java.lang.Object)
.- Specified by:
intern
in interfaceInternable<User.Name>
- Overrides:
intern
in classUser.Name
- See Also:
String.intern()
-
getDto
public PostgresUserName getDto()
- Specified by:
getDto
in interfaceDtoFactory<UserName>
- Overrides:
getDto
in classUser.Name
-
getSerialVersionUID
public long getSerialVersionUID()
- Specified by:
getSerialVersionUID
in interfaceFastExternalizable
- Overrides:
getSerialVersionUID
in classUser.Name
-
-