%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
net.sf.infrared.base.model.LayerTime |
|
|
1 | /* |
|
2 | * Copyright 2005 Tavant Technologies and Contributors |
|
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 | * |
|
17 | * |
|
18 | * Original Author: kamal.govindraj (Tavant Technologies) |
|
19 | * Contributor(s): -; |
|
20 | * |
|
21 | */ |
|
22 | package net.sf.infrared.base.model; |
|
23 | ||
24 | import org.apache.log4j.Logger; |
|
25 | import net.sf.infrared.base.util.LoggingFactory; |
|
26 | ||
27 | import java.io.Serializable; |
|
28 | ||
29 | /** |
|
30 | * This class contains the total time taken for executions in each layer. Examples of layers |
|
31 | * are ejb layer, web layer, Remote Call, Entity, etc. A layer can be defined specific to an |
|
32 | * application that is being instrumented. |
|
33 | * |
|
34 | * @author kamal.govindraj |
|
35 | */ |
|
36 | public class LayerTime implements Cloneable, Serializable { |
|
37 | 4 | private static final Logger log = LoggingFactory.getLogger(LayerTime.class); |
38 | ||
39 | private String layer; |
|
40 | ||
41 | private long time; |
|
42 | ||
43 | 9 | public LayerTime(String layer) { |
44 | 9 | this.layer = layer; |
45 | 9 | } |
46 | ||
47 | public String getLayer() { |
|
48 | 3 | return this.layer; |
49 | } |
|
50 | ||
51 | public long getTime() { |
|
52 | 13 | return this.time; |
53 | } |
|
54 | ||
55 | public void setTime(long time) { |
|
56 | 3 | this.time = time; |
57 | 3 | } |
58 | ||
59 | public void addToTime(long time) { |
|
60 | 3 | this.time += time; |
61 | 3 | } |
62 | ||
63 | public void subtractFromTime(long time) { |
|
64 | 0 | this.time -= time; |
65 | 0 | } |
66 | ||
67 | public Object clone() { |
|
68 | try { |
|
69 | 0 | return super.clone(); |
70 | 0 | } catch (CloneNotSupportedException e) { |
71 | 0 | log.error("Error CloneNotSupportedException should never be thrown", e); |
72 | 0 | return null; // unreachable statement |
73 | } |
|
74 | } |
|
75 | ||
76 | public String toString() { |
|
77 | 0 | return layer + " = " + time; |
78 | } |
|
79 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |