Coverage Report - de.smartics.properties.api.core.context.alias.DuplicateAliasException
 
Classes in this File Line Coverage Branch Coverage Complexity
DuplicateAliasException
0%
0/8
N/A
N/A
1
 
 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.context.alias;
 17  
 
 18  
 /**
 19  
  * Signals that an alias points to two different physical resources.
 20  
  */
 21  
 public final class DuplicateAliasException extends AliasException
 22  
 {
 23  
   // ********************************* Fields *********************************
 24  
 
 25  
   // --- constants ------------------------------------------------------------
 26  
 
 27  
   /**
 28  
    * The class version identifier.
 29  
    * <p>
 30  
    * The value of this constant is {@value}.
 31  
    * </p>
 32  
    */
 33  
   private static final long serialVersionUID = 1L;
 34  
 
 35  
   // --- members --------------------------------------------------------------
 36  
 
 37  
   /**
 38  
    * The physical value stored with the alias.
 39  
    *
 40  
    * @serial
 41  
    */
 42  
   private final String oldTarget;
 43  
 
 44  
   /**
 45  
    * The new physical value that differs from the previously stored.
 46  
    *
 47  
    * @serial
 48  
    */
 49  
   private final String newTarget;
 50  
 
 51  
   // ****************************** Initializer *******************************
 52  
 
 53  
   // ****************************** Constructors ******************************
 54  
 
 55  
   /**
 56  
    * Convenience constructor without a cause.
 57  
    *
 58  
    * @param alias the alias that signals a problem.
 59  
    * @param oldTarget the target value stored with the alias.
 60  
    * @param newTarget the new target value that differs from the previously
 61  
    *          stored.
 62  
    */
 63  
   public DuplicateAliasException(final String alias, final String oldTarget,
 64  
       final String newTarget)
 65  
   {
 66  0
     this(null, alias, oldTarget, newTarget);
 67  0
   }
 68  
 
 69  
   /**
 70  
    * Default constructor.
 71  
    *
 72  
    * @param cause the cause (which is saved for later retrieval by the
 73  
    *          {@link #getCause()} method). (A <tt>null</tt> value is permitted,
 74  
    *          and indicates that the cause is nonexistent or unknown.)
 75  
    * @param alias the alias that signals a problem.
 76  
    * @param oldTarget the target value stored with the alias.
 77  
    * @param newTarget the new target value that differs from the previously
 78  
    *          stored.
 79  
    */
 80  
   public DuplicateAliasException(final Throwable cause, final String alias,
 81  
       final String oldTarget, final String newTarget)
 82  
   {
 83  0
     super("Duplicate alias '" + alias + "' with contradicting targets found: '"
 84  
           + newTarget + "' replaced '" + oldTarget + "'.", cause, alias);
 85  0
     this.oldTarget = oldTarget;
 86  0
     this.newTarget = newTarget;
 87  0
   }
 88  
 
 89  
   // ****************************** Inner Classes *****************************
 90  
 
 91  
   // ********************************* Methods ********************************
 92  
 
 93  
   // --- init -----------------------------------------------------------------
 94  
 
 95  
   // --- get&set --------------------------------------------------------------
 96  
 
 97  
   /**
 98  
    * Returns the target value stored with the alias.
 99  
    *
 100  
    * @return the target value stored with the alias.
 101  
    */
 102  
   public String getOldTarget()
 103  
   {
 104  0
     return oldTarget;
 105  
   }
 106  
 
 107  
   /**
 108  
    * Returns the new target value that differs from the previously stored.
 109  
    *
 110  
    * @return the new target value that differs from the previously stored.
 111  
    */
 112  
   public String getNewTarget()
 113  
   {
 114  0
     return newTarget;
 115  
   }
 116  
 
 117  
   // --- business -------------------------------------------------------------
 118  
 
 119  
   // --- object basics --------------------------------------------------------
 120  
 
 121  
 }