org.netbeans.libs.git/1 1.1

org.netbeans.libs.git
Class GitURI

java.lang.Object
  extended by org.netbeans.libs.git.GitURI

public final class GitURI
extends Object

Representation of a supported Git URI, that denotes a remote repository and is used mainly in Git commands connecting to remote repositories. An instance of this class is immutable meaning any setter method constructs a new instance but does not modify the original instance.


Constructor Summary
GitURI(String uriString)
          Constructor creating an instance of a Git URI.
 
Method Summary
 boolean equals(Object o)
           
 String getHost()
          Returns the URI's host.
 String getPass()
          Returns the password part of the URI's credentials part.
 String getPath()
          Returns the path on the host to the resource denoted by the URI.
 int getPort()
          Returns the port number specified by the URI.
 String getScheme()
          Returns the URI's scheme as a string.
 String getUser()
          Returns the username part of the URI's credentials part.
 int hashCode()
           
 boolean isRemote()
          Returns true if this URI references a repository on another system.
 GitURI setHost(String host)
          Creates a new instance with the given new host name.
 GitURI setPass(String password)
          Creates a new instance with the given new password.
 GitURI setPath(String path)
          Constructs a new instance with the given path.
 GitURI setPort(int port)
          Constructs a new instance with the given port number.
 GitURI setScheme(String scheme)
          Constructs a new instance with the given user name.
 GitURI setUser(String user)
          Constructs a new instance with the given user name.
 String toPrivateString()
          Returns string representation that contains also username and password as plaintext.
 String toString()
          Returns string representation if the URI without the credentials part
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GitURI

public GitURI(String uriString)
       throws URISyntaxException
Constructor creating an instance of a Git URI. In case the given uri string has an unsupported format a URISyntaxException is thrown.

Parameters:
uriString - string representation of a Git URI.
Throws:
URISyntaxException - if the given string has unsupported format
Method Detail

toPrivateString

public String toPrivateString()
Returns string representation that contains also username and password as plaintext.

Returns:
full form (along with user credentials) of the Git URI

setUser

public GitURI setUser(String user)
Constructs a new instance with the given user name.

Parameters:
user - user name
Returns:
new instance that contains user as part of the credential area.

setScheme

public GitURI setScheme(String scheme)
Constructs a new instance with the given user name.

Parameters:
scheme - new scheme
Returns:
a duplicate instance of this with modified scheme part

setPort

public GitURI setPort(int port)
Constructs a new instance with the given port number.

Parameters:
port - port number
Returns:
a duplicate instance of this with modified port number.

setPath

public GitURI setPath(String path)
Constructs a new instance with the given path.

Parameters:
path - path to a resource
Returns:
a duplicate instance of this with modified path to a resource.

setPass

public GitURI setPass(String password)
Creates a new instance with the given new password.

Parameters:
password - new password
Returns:
a duplicate instance of this with a new password

setHost

public GitURI setHost(String host)
Creates a new instance with the given new host name.

Parameters:
host - new host name
Returns:
a duplicate instance of this with a new host name

isRemote

public boolean isRemote()
Returns true if this URI references a repository on another system.


getUser

public String getUser()
Returns the username part of the URI's credentials part.


getScheme

public String getScheme()
Returns the URI's scheme as a string.


getPort

public int getPort()
Returns the port number specified by the URI.


getPath

public String getPath()
Returns the path on the host to the resource denoted by the URI.


getPass

public String getPass()
Returns the password part of the URI's credentials part.


getHost

public String getHost()
Returns the URI's host.


toString

public String toString()
Returns string representation if the URI without the credentials part

Overrides:
toString in class Object
Returns:
readable representation of the URI with empty credentials.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

org.netbeans.libs.git/1 1.1

Built on May 22 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.