View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.jdiagnose;
17  
18  import org.jdiagnose.runtime.ResultState;
19  
20  /***
21   * Useful for decorating ResultInfo instances.
22   * 
23   * @author jmccrindle
24   */
25  public class ResultInfoWrapper implements ResultInfo {
26      
27      protected ResultInfo resultInfo;
28      
29      /***
30       * @param resultInfo instance that all the methods
31       *        delegate to unless overwritten.
32       */
33      public ResultInfoWrapper(ResultInfo resultInfo) {
34          this.resultInfo = resultInfo;
35      }
36  
37      /***
38       * @see java.lang.Object#equals(java.lang.Object)
39       */
40      public boolean equals(Object obj) {
41          return resultInfo.equals(obj);
42      }
43      
44      /***
45       * @see org.jdiagnose.ResultInfo#getDuration()
46       */
47      public long getDuration() {
48          return resultInfo.getDuration();
49      }
50      
51      /***
52       * @see org.jdiagnose.ResultInfo#getFinishTime()
53       */
54      public long getFinishTime() {
55          return resultInfo.getFinishTime();
56      }
57      
58      /***
59       *  @see org.jdiagnose.ResultInfo#getName()
60       */
61      public String getName() {
62          return resultInfo.getName();
63      }
64      
65      /***
66       * @see org.jdiagnose.ResultInfo#getStartTime()
67       */
68      public long getStartTime() {
69          return resultInfo.getStartTime();
70      }
71      
72      /***
73       * @see org.jdiagnose.ResultInfo#getState()
74       */
75      public ResultState getState() {
76          return resultInfo.getState();
77      }
78      
79      /***
80       *  @see java.lang.Object#hashCode()
81       */
82      public int hashCode() {
83          return resultInfo.hashCode();
84      }
85      
86      /***
87       * @see java.lang.Object#toString()
88       */
89      public String toString() {
90          return resultInfo.toString();
91      }
92      
93      /***
94       * @see org.jdiagnose.ResultInfo#getMessage()
95       */
96      public DiagnosticMessage getMessage() {
97          return resultInfo.getMessage();
98      }
99  }