KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > core > impl > invocation > MappingResult


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Forums JBoss Portlet *
6  * *
7  * Distributable under LGPL license. *
8  * See terms of license at gnu.org. *
9  * *
10  *****************************************/

11 package org.jboss.portal.core.impl.invocation;
12
13 /**
14  * The result of a request to a mapper.
15  *
16  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
17  * @version $Revision: 1.1 $
18  */

19 public class MappingResult
20 {
21
22    private final Object JavaDoc target;
23    private final String JavaDoc targetPath;
24    private final String JavaDoc targetPathInfo;
25
26    public MappingResult(Object JavaDoc target, String JavaDoc targetPath, String JavaDoc targetPathInfo)
27    {
28       this.target = target;
29       this.targetPath = targetPath;
30       this.targetPathInfo = targetPathInfo;
31    }
32
33    public Object JavaDoc getTarget()
34    {
35       return target;
36    }
37
38    public String JavaDoc getTargetPathInfo()
39    {
40       return targetPathInfo;
41    }
42
43    public int hashCode()
44    {
45       int hashCode = (target != null ? target.hashCode() : 0) +
46                      (targetPath != null ? targetPath.hashCode() : 0) +
47                      (targetPathInfo != null ? targetPathInfo.hashCode() : 0);
48       return hashCode;
49    }
50
51    public boolean equals(Object JavaDoc obj)
52    {
53       if (obj == this)
54       {
55          return true;
56       }
57       if (obj instanceof MappingResult)
58       {
59          MappingResult other = (MappingResult)obj;
60          return (target == null ? (other.target == null) : target.equals(other.target)) &&
61                 (targetPath == null ? (other.targetPath == null) : targetPath.equals(other.targetPath)) &&
62                 (targetPathInfo == null ? (other.targetPathInfo == null) : targetPathInfo.equals(other.targetPathInfo));
63       }
64       return false;
65    }
66
67    public String JavaDoc toString()
68    {
69       StringBuffer JavaDoc buffer = new StringBuffer JavaDoc("MappingResult[");
70       buffer.append(target == null ? "-" : target.toString());
71       buffer.append(',');
72       buffer.append(targetPath == null ? "-" : targetPath);
73       buffer.append(',');
74       buffer.append(targetPathInfo == null ? "-" : targetPathInfo);
75       buffer.append("]");
76       return buffer.toString();
77    }
78 }
79
Popular Tags