Coverage report

  %line %branch
org.apache.jcs.engine.control.group.GroupId
81% 
69% 

 1  
 package org.apache.jcs.engine.control.group;
 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 java.io.Serializable;
 23  
 
 24  
 /**
 25  
  * Used to avoid name conflict when group cache items are mixed with non-group
 26  
  * cache items in the same cache.
 27  
  *
 28  
  */
 29  
 public class GroupId
 30  
     implements Serializable
 31  
 {
 32  
     private static final long serialVersionUID = 4626368486444860133L;
 33  
 
 34  
     /** Description of the Field */
 35  
     public final String groupName;
 36  
 
 37  
     /**
 38  
      * the name of the region.
 39  
      */
 40  
     public final String cacheName;
 41  
 
 42  
     private String toString;
 43  
 
 44  
     /**
 45  
      * Constructor for the GroupId object
 46  
      *
 47  
      * @param cacheName
 48  
      * @param groupName
 49  
      */
 50  
     public GroupId( String cacheName, String groupName )
 51  608
     {
 52  608
         this.cacheName = cacheName;
 53  608
         this.groupName = groupName;
 54  
 
 55  608
         if ( cacheName == null )
 56  
         {
 57  0
             throw new IllegalArgumentException( "cacheName must not be null." );
 58  
         }
 59  608
         if ( groupName == null )
 60  
         {
 61  0
             throw new IllegalArgumentException( "groupName must not be null." );
 62  
         }
 63  608
     }
 64  
 
 65  
     /*
 66  
      *  (non-Javadoc)
 67  
      * @see java.lang.Object#equals(java.lang.Object)
 68  
      */
 69  
     public boolean equals( Object obj )
 70  
     {
 71  800
         if ( obj == null || !( obj instanceof GroupId ) )
 72  
         {
 73  0
             return false;
 74  
         }
 75  800
         GroupId g = (GroupId) obj;
 76  800
         return cacheName.equals( g.cacheName ) && groupName.equals( g.groupName );
 77  
     }
 78  
 
 79  
     /*
 80  
      *  (non-Javadoc)
 81  
      * @see java.lang.Object#hashCode()
 82  
      */
 83  
     public int hashCode()
 84  
     {
 85  1208
         return cacheName.hashCode() + groupName.hashCode();
 86  
     }
 87  
 
 88  
     /*
 89  
      *  (non-Javadoc)
 90  
      * @see java.lang.Object#toString()
 91  
      */
 92  
     public String toString()
 93  
     {
 94  408
         if ( toString == null )
 95  
         {
 96  408
             toString = "[groupId=" + cacheName + ", " + groupName + ']';
 97  
         }
 98  
 
 99  408
         return toString;
 100  
     }
 101  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.