Coverage Report - org.acegisecurity.acl.basic.cache.BasicAclEntryHolder
 
Classes in this File Line Coverage Branch Coverage Complexity
BasicAclEntryHolder
100% 
100% 
1.5
 
 1  
 /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
 2  
  *
 3  
  * Licensed under the Apache License, Version 2.0 (the "License");
 4  
  * you may not use this file except in compliance with the License.
 5  
  * You may obtain a copy of the License at
 6  
  *
 7  
  *     http://www.apache.org/licenses/LICENSE-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing, software
 10  
  * distributed under the License is distributed on an "AS IS" BASIS,
 11  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
  * See the License for the specific language governing permissions and
 13  
  * limitations under the License.
 14  
  */
 15  
 
 16  
 package org.acegisecurity.acl.basic.cache;
 17  
 
 18  
 import org.acegisecurity.acl.basic.BasicAclEntry;
 19  
 
 20  
 import org.springframework.util.Assert;
 21  
 
 22  
 import java.io.Serializable;
 23  
 
 24  
 
 25  
 /**
 26  
  * Used by {@link EhCacheBasedAclEntryCache} to store the array of <code>BasicAclEntry</code>s in the cache.<P>This
 27  
  * is necessary because caches store a single object per key, not an array.</p>
 28  
  *  <P>This class uses value object semantics. ie: construction-based initialisation without any setters for the
 29  
  * properties.</p>
 30  
  *
 31  
  * @author Ben Alex
 32  
  * @version $Id: BasicAclEntryHolder.java 1496 2006-05-23 13:38:33Z benalex $
 33  
  */
 34  
 public class BasicAclEntryHolder implements Serializable {
 35  
     //~ Instance fields ================================================================================================
 36  
 
 37  
     private BasicAclEntry[] basicAclEntries;
 38  
 
 39  
     //~ Constructors ===================================================================================================
 40  
 
 41  
 /**
 42  
      * Constructs the <code>BasicAclEntryHolder</code>.
 43  
      *
 44  
      * @param aclEntries to cache (any <code>null</code>s will cause an
 45  
      *        exception, which should not be a problem as the contract for
 46  
      *        <code>BasicAclEntryCache</code> allows exceptions if
 47  
      *        <code>null</code>s are presented)
 48  
      *
 49  
      * @throws IllegalArgumentException if a <code>null</code> exists anywhere
 50  
      *         in the <code>aclEntries</code> or if a <code>null</code> is
 51  
      *         passed to the constructor
 52  
      */
 53  6
     public BasicAclEntryHolder(BasicAclEntry[] aclEntries) {
 54  6
         Assert.notNull(aclEntries, "aclEntries cannot be null");
 55  
 
 56  11
         for (int i = 0; i < aclEntries.length; i++) {
 57  7
             Assert.notNull(aclEntries[i], "aclEntries cannot be null");
 58  
         }
 59  
 
 60  4
         this.basicAclEntries = aclEntries;
 61  4
     }
 62  
 
 63  
     //~ Methods ========================================================================================================
 64  
 
 65  
     public BasicAclEntry[] getBasicAclEntries() {
 66  6
         return basicAclEntries;
 67  
     }
 68  
 }