Coverage Report - de.smartics.properties.api.core.domain.DuplicatePropertyDeclarationsException
 
Classes in this File Line Coverage Branch Coverage Complexity
DuplicatePropertyDeclarationsException
0%
0/9
0%
0/2
1,333
 
 1  
 /*
 2  
  * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH
 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 de.smartics.properties.api.core.domain;
 17  
 
 18  
 import java.util.List;
 19  
 
 20  
 import de.smartics.properties.api.core.app.PropertyRootException;
 21  
 
 22  
 /**
 23  
  * Signals that a set of property descriptor has been encountered twice.
 24  
  */
 25  
 public class DuplicatePropertyDeclarationsException extends
 26  
     PropertyRootException
 27  
 {
 28  
   // ********************************* Fields *********************************
 29  
 
 30  
   // --- constants ------------------------------------------------------------
 31  
 
 32  
   /**
 33  
    * The class version identifier.
 34  
    * <p>
 35  
    * The value of this constant is {@value}.
 36  
    * </p>
 37  
    */
 38  
   private static final long serialVersionUID = 1L;
 39  
 
 40  
   // --- members --------------------------------------------------------------
 41  
 
 42  
   /**
 43  
    * The list of property declarations of declaration collisions. This is where
 44  
    * two interfaces declare properties with identical keys.
 45  
    *
 46  
    * @serial
 47  
    */
 48  
   private final List<DuplicatePropertyDeclarationException> exceptions;
 49  
 
 50  
   // ****************************** Initializer *******************************
 51  
 
 52  
   // ****************************** Constructors ******************************
 53  
 
 54  
   /**
 55  
    * Default constructor.
 56  
    *
 57  
    * @param exceptions the list of property declarations of declaration
 58  
    *          collisions.
 59  
    */
 60  
   public DuplicatePropertyDeclarationsException(
 61  
       final List<DuplicatePropertyDeclarationException> exceptions)
 62  
   {
 63  0
     super(createMessage(exceptions));
 64  
 
 65  0
     this.exceptions = exceptions;
 66  0
   }
 67  
 
 68  
   // ****************************** Inner Classes *****************************
 69  
 
 70  
   // ********************************* Methods ********************************
 71  
 
 72  
   // --- init -----------------------------------------------------------------
 73  
 
 74  
   private static String createMessage(
 75  
       final List<DuplicatePropertyDeclarationException> exceptions)
 76  
   {
 77  0
     final StringBuilder buffer = new StringBuilder(128);
 78  0
     buffer.append("Encountered " + exceptions.size()
 79  
                   + " duplicate property declarations.");
 80  0
     for (final DuplicatePropertyDeclarationException e : exceptions)
 81  
     {
 82  0
       buffer.append("\n  ").append(e.getLocalizedMessage());
 83  
     }
 84  0
     return buffer.toString();
 85  
   }
 86  
 
 87  
   // --- get&set --------------------------------------------------------------
 88  
 
 89  
   /**
 90  
    * Returns the list of property declarations of declaration collisions. This
 91  
    * is where two interfaces declare properties with identical keys.
 92  
    *
 93  
    * @return the list of property declarations of declaration collisions.
 94  
    */
 95  
   public final List<DuplicatePropertyDeclarationException> getExceptions()
 96  
   {
 97  0
     return exceptions;
 98  
   }
 99  
 
 100  
   // --- business -------------------------------------------------------------
 101  
 
 102  
   // --- object basics --------------------------------------------------------
 103  
 
 104  
 }