public class Contributor
extends java.lang.Object
implements java.io.Serializable
The notion of contributor abstracts these of author, tester, or approver in the Decision Governance Framework.
An instance of this class stores a user name and a status. A status is an arbitrary string, and its range is controlled outside of this class.
This class also introduces the Contributor.Role enumeration, to denote whether the contributor is an author, a tester, an approver, and so on.
| Modifier and Type | Class and Description |
|---|---|
static class |
Contributor.Role
This enumeration is used to denote whether a contributor is an author or a tester (
Author), or an approver (Approver). |
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
fullname |
protected java.lang.String |
name |
protected java.lang.String |
status |
| Constructor and Description |
|---|
Contributor(java.lang.String nameAndStatus)
Creates a contributor with the name and status provided in the argument as a colon-separated string.
|
Contributor(java.lang.String name,
java.lang.String status)
Creates a contributor with the provided name and status.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<Contributor> |
convert(java.util.List<?> raw_value)
Returns a list of contributors that matches the provided list.
|
boolean |
equals(java.lang.Object obj) |
static Contributor |
find(java.lang.String userName,
java.util.List<Contributor> contributors)
Returns the first contributor in the provided list that goes by the provided name, or
null if none is found. |
java.lang.String |
getName()
Returns the name of the contributor.
|
java.lang.String |
getStatus()
Returns the status of the contributor.
|
int |
hashCode() |
static boolean |
remove(java.lang.String userName,
java.util.List<Contributor> contributors)
Removes the first contributor in the provided list that goes by the provided name.
|
void |
setName(java.lang.String name)
Sets the name of the contributor.
|
void |
setStatus(java.lang.String status)
Sets the status of the contributor.
|
java.lang.String |
toString() |
static java.util.List<Contributor> |
update(Contributor contributor,
java.util.List<Contributor> contributors)
Finds the first contributor in the provided list that goes by the same name as the provided contributor, and replaces it with the latter.
|
protected java.lang.String name
protected java.lang.String status
protected java.lang.String fullname
public Contributor(java.lang.String name,
java.lang.String status)
Creates a contributor with the provided name and status.
name - The name of the contributor.status - The status of the contributor.public Contributor(java.lang.String nameAndStatus)
Creates a contributor with the name and status provided in the argument as a colon-separated string.
java.lang.IllegalArgumentException - If the argument contains no colon.nameAndStatus - The name and status of the contributor, for example "alice:Ready".public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String getName()
Returns the name of the contributor.
public void setName(java.lang.String name)
Sets the name of the contributor.
name - The new name of the contributor.public java.lang.String getStatus()
Returns the status of the contributor.
public void setStatus(java.lang.String status)
Sets the status of the contributor.
status - The new status of the contributor.public static Contributor find(java.lang.String userName, java.util.List<Contributor> contributors)
Returns the first contributor in the provided list that goes by the provided name, or null if none is found.
userName - The name of the contributor that is looked for.contributors - A list of contributors. May be null.null if none is found.public static java.util.List<Contributor> update(Contributor contributor, java.util.List<Contributor> contributors)
Finds the first contributor in the provided list that goes by the same name as the provided contributor, and replaces it with the latter. The provided list is not copied, it is modified.
contributor - A contributor. Nothing happens if null is given.contributors - A list of contributors. May be null.public static boolean remove(java.lang.String userName,
java.util.List<Contributor> contributors)
Removes the first contributor in the provided list that goes by the provided name.
userName - The name of the contributor to remove.contributors - A list of contributors. May be null.true if a contributor was removed, false otherwise.public static java.util.List<Contributor> convert(java.util.List<?> raw_value)
Returns a list of contributors that matches the provided list. The provided list must either be a list of Contributors, in which case
it is returned untouched, or a list of names and statuses as colon-separated strings (for example "alice:Ready"), in which case Contributor
instances are created, and their list is returned.
raw_value - Either a list of Contributors, or a list of strings of the form "alice:Ready".© Copyright IBM Corp. 1987, 2017