001 package com.softnetConsult.utils.exceptions; 002 003 /** 004 * A Throwable Bug (Error) that should be thrown to report that an unexpected case within a 005 * switch statement cas been encountered. This class exists to faciliate brievity 006 * and expressiveness of the source code. 007 * 008 * <p style="font-size:smaller;">This product includes software developed by the 009 * <strong>SoftNet-Consult Java Utility Library</strong> project and its contributors.<br /> 010 * (<a href="http://java-tools.sourceforge.net" target="_blank">http://java-tools.sourceforge.net</a>)<br /> 011 * Copyright (c) 2007-2008 SoftNet-Consult.<br /> 012 * Copyright (c) 2007-2008 G. Paperin.<br /> 013 * All rights reserved. 014 * </p> 015 * <p style="font-size:smaller;">File: UnexpectedSwitchCase.java<br /> 016 * Library API version: {@value com.softnetConsult.utils.APIProperties#apiVersion}<br /> 017 * Java compliance version: {@value com.softnetConsult.utils.APIProperties#javaComplianceVersion} 018 * </p> 019 * <p style="font-size:smaller;">Redistribution and use in source and binary forms, with or 020 * without modification, are permitted provided that the following terms and conditions are met: 021 * </p> 022 * <p style="font-size:smaller;">1. Redistributions of source code must retain the above 023 * acknowledgement of the SoftNet-Consult Java Utility Library project, the above copyright 024 * notice, this list of conditions and the following disclaimer.<br /> 025 * 2. Redistributions in binary form must reproduce the above acknowledgement of the 026 * SoftNet-Consult Java Utility Library project, the above copyright notice, this list of 027 * conditions and the following disclaimer in the documentation and/or other materials 028 * provided with the distribution.<br /> 029 * 3. All advertising materials mentioning features or use of this software or any derived 030 * software must display the following acknowledgement:<br /> 031 * <em>This product includes software developed by the SoftNet-Consult Java Utility Library 032 * project and its contributors.</em> 033 * </p> 034 * <p style="font-size:smaller;">THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY 035 * OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 036 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 037 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 038 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 039 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 040 * </p> 041 * @author Greg Paperin (<a href="http://www.paperin.org" target="_blank">http://www.paperin.org</a>) 042 * @version {@value com.softnetConsult.utils.APIProperties#apiVersion} 043 * 044 */ 045 public class UnexpectedSwitchCase extends Bug { 046 047 048 049 // /** 050 // * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 051 // * case was encountered within a switch statement and provides the specified 052 // * message as an explanation. 053 // * 054 // * @param message Explanation message. 055 // */ 056 // public UnexpectedSwitchCase(String message) { 057 // super((null == message || 0 == message.trim().length()) ? "No informaion specified" : message); 058 // } 059 060 061 /** 062 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 063 * case was encountered within a switch statement that forks on a variable of 064 * type {@code byte}. 065 * 066 * @param caseConstant The unexpected switch case that was encountered. 067 */ 068 public UnexpectedSwitchCase(byte caseConstant) { 069 super("Unexpected switch case constant of type byte: " + caseConstant); 070 } 071 072 /** 073 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 074 * case was encountered within a switch statement that forks on a variable of 075 * type {@code char}. 076 * 077 * @param caseConstant The unexpected switch case that was encountered. 078 */ 079 public UnexpectedSwitchCase(char caseConstant) { 080 super("Unexpected switch case constant of type char: " + caseConstant); 081 } 082 083 /** 084 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 085 * case was encountered within a switch statement that forks on a variable of 086 * type {@code short}. 087 * 088 * @param caseConstant The unexpected switch case that was encountered. 089 */ 090 public UnexpectedSwitchCase(short caseConstant) { 091 super("Unexpected switch case constant of type short: " + caseConstant); 092 } 093 094 /** 095 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 096 * case was encountered within a switch statement that forks on a variable of 097 * type {@code int}. 098 * 099 * @param caseConstant The unexpected switch case that was encountered. 100 */ 101 public UnexpectedSwitchCase(int caseConstant) { 102 super("Unexpected switch case constant of type int: " + caseConstant); 103 } 104 105 /** 106 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 107 * case was encountered within a switch statement that forks on a variable of 108 * type {@code Byte}. 109 * 110 * @param caseConstant The unexpected switch case that was encountered. 111 */ 112 public UnexpectedSwitchCase(Byte caseConstant) { 113 super("Unexpected switch case constant of wrapper type Byte: " + caseConstant); 114 } 115 116 /** 117 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 118 * case was encountered within a switch statement that forks on a variable of 119 * type {@code Character}. 120 * 121 * @param caseConstant The unexpected switch case that was encountered. 122 */ 123 public UnexpectedSwitchCase(Character caseConstant) { 124 super("Unexpected switch case constant of wrapper type Character: " + caseConstant); 125 } 126 127 /** 128 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 129 * case was encountered within a switch statement that forks on a variable of 130 * type {@code Short}. 131 * 132 * @param caseConstant The unexpected switch case that was encountered. 133 */ 134 public UnexpectedSwitchCase(Short caseConstant) { 135 super("Unexpected switch case constant of wrapper type Short: " + caseConstant); 136 } 137 138 /** 139 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 140 * case was encountered within a switch statement that forks on a variable of 141 * type {@code Integer}. 142 * 143 * @param caseConstant The unexpected switch case that was encountered. 144 */ 145 public UnexpectedSwitchCase(Integer caseConstant) { 146 super("Unexpected switch case constant of wrapper type Integer: " + caseConstant); 147 } 148 149 /** 150 * Constructs a new UnexpectedSwitchCase-Bug that indicates that an unexpected 151 * case was encountered within a switch statement that forks on a variable of 152 * an Enum-type {@code E}. 153 * @param <E> The {@code Enum}-type of the variable on which the concerned switch 154 * statement was forked. 155 * @param caseConstant The unexpected switch case that was encountered. 156 */ 157 public <E extends Enum<E>> UnexpectedSwitchCase(E caseConstant) { 158 super("Unexpected switch case constant of enum type " 159 + caseConstant.getClass().getName() + ": " + caseConstant); 160 } 161 162 } // public class UnexpectedSwitchCase