001 /*
002 * Copyright 2002-2004 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005 * use this file except in compliance with the License. You may obtain a copy of
006 * the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013 * License for the specific language governing permissions and limitations under
014 * the License.
015 */
016 package org.springframework.richclient.command;
017
018
019 /**
020 * Indicates that an encoded string specifying a command group member type is not valid.
021 *
022 * @author Kevin Stembridge
023 * @since 0.3
024 *
025 */
026 public class InvalidGroupMemberEncodingException extends CommandException {
027
028 private static final long serialVersionUID = 4716510307315369998L;
029
030 private final String encodedString;
031
032 private static String createDefaultMessage(String message, String encodedString) {
033
034 if (message != null) {
035 return message + " [encodedString = '" + encodedString + "']";
036 }
037 else {
038 return "The given string [" + encodedString + "] is not a valid command group member encoding.";
039 }
040
041 }
042
043 /**
044 * Creates a new {@code InvalidGroupMemberEncodingException} with the given detail message
045 * and encoded string. The encoded string will be appended to the given message.
046 *
047 * @param message The detail message. If null, a default message will be created.
048 * @param encodedString The encoded string that is invalid.
049 *
050 */
051 public InvalidGroupMemberEncodingException(String message, String encodedString) {
052 super(createDefaultMessage(message, encodedString));
053 this.encodedString = encodedString;
054 }
055
056
057 /**
058 * Returns the string that is not a valid group member encoding.
059 * @return Returns the value of the encodedString field, possibly null.
060 */
061 public String getEncodedString() {
062 return this.encodedString;
063 }
064
065 }