Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/Account.java')
-rw-r--r--org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/Account.java127
1 files changed, 127 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/Account.java b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/Account.java
new file mode 100644
index 00000000..6883bde7
--- /dev/null
+++ b/org.eclipse.mylyn.commons.identity.core/src/org/eclipse/mylyn/commons/identity/core/Account.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.commons.identity.core;
+
+import java.io.Serializable;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * @author Steffen Pingel
+ */
+public class Account implements Serializable {
+
+ private static final long serialVersionUID = 3670630150657553390L;
+
+ public static Account id(String id) {
+ Assert.isNotNull(id);
+ return new Account(id);
+ }
+
+ private final String id;
+
+ private String kind;
+
+ private String name;
+
+ private String url;
+
+ private Account(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Account other = (Account) obj;
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ } else if (!id.equals(other.id)) {
+ return false;
+ }
+ if (kind == null) {
+ if (other.kind != null) {
+ return false;
+ }
+ } else if (!kind.equals(other.kind)) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ if (url == null) {
+ if (other.url != null) {
+ return false;
+ }
+ } else if (!url.equals(other.url)) {
+ return false;
+ }
+ return true;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getKind() {
+ return kind;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((kind == null) ? 0 : kind.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((url == null) ? 0 : url.hashCode());
+ return result;
+ }
+
+ public Account kind(String kind) {
+ this.kind = kind;
+ return this;
+ }
+
+ public Account name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Account url(String url) {
+ this.url = url;
+ return this;
+ }
+
+}

Back to the top