View Javadoc

1   package org.apache.jcs.engine.stats;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.jcs.engine.stats.behavior.IStatElement;
23  
24  /**
25   * This is a stat data holder.
26   */
27  public class StatElement
28      implements IStatElement
29  {
30      /** name of the stat */
31      private String name = null;
32  
33      /** the data */
34      private String data = null;
35  
36      /**
37       * Get the name of the stat element, ex. HitCount
38       * <p>
39       * @return the stat element name
40       */
41      public String getName()
42      {
43          return name;
44      }
45  
46      /**
47       * @param name
48       */
49      public void setName( String name )
50      {
51          this.name = name;
52      }
53  
54      /**
55       * Get the data, ex. for hit count you would get a String value for some number.
56       * <p>
57       * @return String data
58       */
59      public String getData()
60      {
61          return data;
62      }
63  
64      /**
65       * Set the data for this element.
66       * <p>
67       * @param data
68       */
69      public void setData( String data )
70      {
71          this.data = data;
72      }
73  
74      /**
75       * @return a readable string.
76       */
77      @Override
78      public String toString()
79      {
80          StringBuffer buf = new StringBuffer();
81          buf.append( name + " = " + data );
82          return buf.toString();
83      }
84  }