Revision: 1673 http://svn.sourceforge.net/spring-rich-c/?rev=1673&view=rev Author: kevinstembridge Date: 2007-01-16 12:16:54 -0800 (Tue, 16 Jan 2007)
Log Message: ----------- Initial import Added Paths: ----------- trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandNotOfRequiredTypeException.java Added: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandNotOfRequiredTypeException.java =================================================================== --- trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandNotOfRequiredTypeException.java (rev 0) +++ trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandNotOfRequiredTypeException.java 2007-01-16 20:16:54 UTC (rev 1673) @@ -0,0 +1,84 @@ +/* + * Copyright 2002-2004 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.springframework.richclient.command; + + +/** + * Indicates that a command object was not of the expected type. + * + * @author Kevin Stembridge + * @since 0.3 + * + */ +public class CommandNotOfRequiredTypeException extends CommandException { + + private static final long serialVersionUID = 6891900212653390852L; + + private final String commandId; + private final Class requiredType; + private final Class actualType; + + private static String createMessage(String commandId, Class requiredType, Class actualType) { + + return "The command with id [" + + commandId + + "] was expected to be of type [" + + requiredType + + "] but was of type [" + + actualType + + "]"; + + } + + /** + * Creates a new [EMAIL PROTECTED] CommandNotOfRequiredTypeException}. + * + * @param commandId The id of the command. + * @param requiredType The required type of the command. + * @param actualType The actual type of the command. + */ + public CommandNotOfRequiredTypeException(String commandId, Class requiredType, Class actualType) { + super(createMessage(commandId, requiredType, actualType)); + this.commandId = commandId; + this.requiredType = requiredType; + this.actualType = actualType; + } + + /** + * Returns the actual type of the command. + * @return Returns the value of the actualType field, possibly null. + */ + public Class getActualType() { + return this.actualType; + } + + /** + * Returns the id of the command + * @return Returns the value of the commandId field, possibly null. + */ + public String getCommandId() { + return this.commandId; + } + + /** + * Returns the type that the command was expected to be. + * @return Returns the value of the requiredType field, possibly null. + */ + public Class getRequiredType() { + return this.requiredType; + } + +} Property changes on: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandNotOfRequiredTypeException.java ___________________________________________________________________ Name: svn:keywords + Author Id Revision Date HeadURL Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ spring-rich-c-cvs mailing list spring-rich-c-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs