Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
implement equals, hashcode and tostring for convenience
  • Loading branch information
chenson42 committed Oct 27, 2011
1 parent fa321a4 commit e2a722c
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 1 deletion.
Expand Up @@ -183,5 +183,36 @@ public void setContainsBigLob(boolean containsBigLobs) {

public boolean isContainsBigLob() {
return containsBigLob;
}

@Override
public int hashCode() {
if (channelId != null) {
return channelId.hashCode();
} else {
return super.hashCode();
}
}

@Override
public boolean equals(Object obj) {
if (channelId != null) {
if (obj instanceof Channel) {
return channelId.equals(((Channel) obj).channelId);
} else {
return false;
}
} else {
return super.equals(obj);
}
}

@Override
public String toString() {
if (channelId != null) {
return channelId;
} else {
return super.toString();
}
}
}
Expand Down
Expand Up @@ -53,6 +53,37 @@ public String getDescription() {

public void setDescription(String description) {
this.description = description;
}

@Override
public int hashCode() {
if (nodeGroupId != null) {
return nodeGroupId.hashCode();
} else {
return super.hashCode();
}
}

@Override
public boolean equals(Object obj) {
if (nodeGroupId != null) {
if (obj instanceof NodeGroup) {
return nodeGroupId.equals(((NodeGroup) obj).nodeGroupId);
} else {
return false;
}
} else {
return super.equals(obj);
}
}

@Override
public String toString() {
if (nodeGroupId != null) {
return nodeGroupId;
} else {
return super.toString();
}
}

}
Expand Down
Expand Up @@ -214,7 +214,6 @@ public String createDefaultName() {
public boolean equals(Object obj) {
if (obj instanceof Router && routerId != null) {
return routerId.equals(((Router) obj).routerId);

} else {
return false;
}
Expand All @@ -223,6 +222,15 @@ public boolean equals(Object obj) {
@Override
public int hashCode() {
return routerId != null ? routerId.hashCode() : super.hashCode();
}

@Override
public String toString() {
if (routerId != null) {
return routerId;
} else {
return super.toString();
}
}

}
Expand Down
Expand Up @@ -467,6 +467,15 @@ public boolean equals(Object obj) {
@Override
public int hashCode() {
return triggerId != null ? triggerId.hashCode() : super.hashCode();
}

@Override
public String toString() {
if (triggerId != null) {
return triggerId;
} else {
return super.toString();
}
}

}
Expand Down
Expand Up @@ -208,5 +208,11 @@ public boolean isSame(TriggerRouter triggerRouter) {
&& (this.router == null && triggerRouter.router == null)
|| (this.router != null && triggerRouter.router != null && this.router
.equals(triggerRouter.router));
}

@Override
public String toString() {
return (trigger != null ? trigger.toString() : "") + ":"
+ (router != null ? router.toString() : "");
}
}
Expand Down
Expand Up @@ -171,4 +171,35 @@ public void setNodeGroupLink(NodeGroupLink nodeGroupLink) {
public NodeGroupLink getNodeGroupLink() {
return nodeGroupLink;
}

@Override
public int hashCode() {
if (transformId != null) {
return transformId.hashCode();
} else {
return super.hashCode();
}
}

@Override
public boolean equals(Object obj) {
if (transformId != null) {
if (obj instanceof TransformTable) {
return transformId.equals(((TransformTable) obj).transformId);
} else {
return false;
}
} else {
return super.equals(obj);
}
}

@Override
public String toString() {
if (transformId != null) {
return transformId;
} else {
return super.toString();
}
}
}

0 comments on commit e2a722c

Please sign in to comment.