com.microsoft.tfs.core.util
Class TFSUser

java.lang.Object
  extended by com.microsoft.tfs.core.util.TFSUser
All Implemented Interfaces:
java.lang.Comparable

public final class TFSUser
extends java.lang.Object
implements java.lang.Comparable

Identifies a user by a username and Windows domain name, and provides methods for parsing these from and printing these to strings.

Since:
TEE-SDK-10.1
Thread-safety:
immutable

Constructor Summary
TFSUser(java.lang.String usernameAndOptionalDomain)
           Constructs a TFSUser from the given username (and optionally, domain) string.
TFSUser(java.lang.String username, java.lang.String domain)
          Constructs a TFSUser from the given username (and optionally, domain) string.
TFSUser(TFSUser user)
          Constructs a TFSUser from the given TFSUser class.
 
Method Summary
 int compareTo(java.lang.Object o)
          
 boolean equals(java.lang.Object obj)
          
 java.lang.String getDomain()
           
 java.lang.String getUsername()
           
 int hashCode()
          
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TFSUser

public TFSUser(java.lang.String usernameAndOptionalDomain)
        throws TFSUsernameParseException

Constructs a TFSUser from the given username (and optionally, domain) string. These styles are supported:

If a separator is found at the beginning or end of the input, the username or domain will be considered empty, respectively. If the username is empty, the construction throws TFSUsernameParseException.

Parameters:
usernameAndOptionalDomain - the username and optional domain string (must not be null)
Throws:
TFSUsernameParseException - when the string could not be parsed.

TFSUser

public TFSUser(java.lang.String username,
               java.lang.String domain)
        throws TFSUsernameParseException
Constructs a TFSUser from the given username (and optionally, domain) string.

Parameters:
username - the username string to assign (must not be null)
domain - the domain string to assign (may be null).
Throws:
TFSUsernameParseException - when the inputs were not invalid

TFSUser

public TFSUser(TFSUser user)
Constructs a TFSUser from the given TFSUser class.

Parameters:
user - the instance to initialize the new instance's values from.
Method Detail

getUsername

public java.lang.String getUsername()
Returns:
the username (never null).

getDomain

public java.lang.String getDomain()
Returns:
the domain (null if null during construction).

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)

Specified by:
compareTo in interface java.lang.Comparable


© 2015 Microsoft. All rights reserved.