com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.attr
Class Account

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.gerritevents.dto.attr.Account
All Implemented Interfaces:
GerritJsonDTO

public class Account
extends Object
implements GerritJsonDTO

Represents a Gerrit JSON Account DTO. An account that is related to an event or attribute.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Constructor Summary
Account()
          Default constructor.
Account(net.sf.json.JSONObject json)
          Constructor that fills with data directly.
Account(String name, String email)
          For easier testing.
 
Method Summary
 boolean equals(Object o)
           
 void fromJson(net.sf.json.JSONObject json)
          Takes a JSON object and fills its internal data-structure.
 String getEmail()
          Account user's preferred email.
 String getName()
          Account user's full name.
 String getNameAndEmail()
          Gives the full name and email in the format "name" <email@somewhere.com>.
 int hashCode()
           
 void setEmail(String email)
          Account user's preferred email.
 void setName(String name)
          Account user's full name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Account

public Account()
Default constructor.


Account

public Account(net.sf.json.JSONObject json)
Constructor that fills with data directly.

Parameters:
json - the JSON Object with data.
See Also:
fromJson(net.sf.json.JSONObject)

Account

public Account(String name,
               String email)
For easier testing.

Parameters:
name - the name.
email - the email.
Method Detail

fromJson

public void fromJson(net.sf.json.JSONObject json)
Description copied from interface: GerritJsonDTO
Takes a JSON object and fills its internal data-structure.

Specified by:
fromJson in interface GerritJsonDTO
Parameters:
json - the JSON Object.

getEmail

public String getEmail()
Account user's preferred email.

Returns:
the email.

setEmail

public void setEmail(String email)
Account user's preferred email.

Parameters:
email - the email

getName

public String getName()
Account user's full name.

Returns:
the name.

setName

public void setName(String name)
Account user's full name.

Parameters:
name - the full name

getNameAndEmail

public String getNameAndEmail()
Gives the full name and email in the format "name" <email@somewhere.com>. If either the name or the email is null then null is returned. If either is an empty string then an empty string is returned.

Returns:
the name and email in one string.

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2004-2012 Hudson. All Rights Reserved.