Revision: 1655 http://svn.sourceforge.net/spring-rich-c/?rev=1655&view=rev Author: kevinstembridge Date: 2007-01-12 12:21:56 -0800 (Fri, 12 Jan 2007)
Log Message: ----------- Initial import Added Paths: ----------- trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandException.java trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberEncodingException.java trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberException.java Added: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandException.java =================================================================== --- trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandException.java (rev 0) +++ trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandException.java 2007-01-12 20:21:56 UTC (rev 1655) @@ -0,0 +1,70 @@ +/* + * 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; + +import org.springframework.richclient.application.ApplicationException; + + +/** + * Indicates that a runtime or configuration error has occurred within the Command + * framework. This is a fairly generic exception. Before creating and throwing an instance + * of this type, consider if a more specific subclass would be more appropriate. + * + * @author Kevin Stembridge + * @since 0.3 + * + */ +public class CommandException extends ApplicationException { + + private static final long serialVersionUID = 7845755447557671461L; + + /** + * Creates a new [EMAIL PROTECTED] CommandException}. + */ + public CommandException() { + super(); + } + + /** + * Creates a new [EMAIL PROTECTED] CommandException} with the specified message. + * + * @param message The detail message. + */ + public CommandException(String message) { + super(message); + } + + /** + * Creates a new [EMAIL PROTECTED] CommandException} with the specified message + * and nested exception. + * + * @param message The detail mesage. + * @param cause The nested exception. + */ + public CommandException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Creates a new [EMAIL PROTECTED] CommandException} with the specified nested exception. + * + * @param cause The nested exception. + */ + public CommandException(Throwable cause) { + super(cause); + } + +} Property changes on: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/CommandException.java ___________________________________________________________________ Name: svn:keywords + Author Id Revision Date HeadURL Name: svn:eol-style + native Added: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberEncodingException.java =================================================================== --- trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberEncodingException.java (rev 0) +++ trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberEncodingException.java 2007-01-12 20:21:56 UTC (rev 1655) @@ -0,0 +1,65 @@ +/* + * 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 an encoded string specifying a command group member type is not valid. + * + * @author Kevin Stembridge + * @since 0.3 + * + */ +public class InvalidGroupMemberEncodingException extends CommandException { + + private static final long serialVersionUID = 4716510307315369998L; + + private final String encodedString; + + private static String createDefaultMessage(String message, String encodedString) { + + if (message != null) { + return message + " [encodedString = '" + encodedString + "']"; + } + else { + return "The given string [" + encodedString + "] is not a valid command group member encoding."; + } + + } + + /** + * Creates a new [EMAIL PROTECTED] InvalidGroupMemberEncodingException} with the given detail message + * and encoded string. The encoded string will be appended to the given message. + * + * @param message The detail message. If null, a default message will be created. + * @param encodedString The encoded string that is invalid. + * + */ + public InvalidGroupMemberEncodingException(String message, String encodedString) { + super(createDefaultMessage(message, encodedString)); + this.encodedString = encodedString; + } + + + /** + * Returns the string that is not a valid group member encoding. + * @return Returns the value of the encodedString field, possibly null. + */ + public String getEncodedString() { + return this.encodedString; + } + +} Property changes on: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberEncodingException.java ___________________________________________________________________ Name: svn:keywords + Author Id Revision Date HeadURL Name: svn:eol-style + native Added: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberException.java =================================================================== --- trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberException.java (rev 0) +++ trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberException.java 2007-01-12 20:21:56 UTC (rev 1655) @@ -0,0 +1,107 @@ +/* + * 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 an object is not a valid member of a [EMAIL PROTECTED] CommandGroup}. + * + * <p> + * Usually, a command group member will be a subclass of [EMAIL PROTECTED] AbstractCommand}, however some + * command group implementations may define more specific rules about what types of members they + * will accept. + * </p> + * + * @author Kevin Stembridge + * @since 0.3 + * + */ +public class InvalidGroupMemberException extends CommandException { + + private static final long serialVersionUID = 7891614557214887191L; + + private final Class invalidMemberClass; + private final Class commandGroupClass; + + private static String createDefaultMessage(Class invalidMemberClass, Class commandGroupClass) { + + return "An object of type [" + + invalidMemberClass + + "] is not a valid member for a group of type [" + + commandGroupClass + + "]"; + + } + + /** + * Creates a new [EMAIL PROTECTED] InvalidGroupMemberException}. + * + * @param invalidMemberClass The class of the invalid member. + * @param commandGroupClass The class of the command group that the member is not valid for. + */ + public InvalidGroupMemberException(Class invalidMemberClass, Class commandGroupClass) { + super(createDefaultMessage(invalidMemberClass, commandGroupClass)); + this.invalidMemberClass = invalidMemberClass; + this.commandGroupClass = commandGroupClass; + } + + /** + * Creates a new [EMAIL PROTECTED] InvalidGroupMemberException}. + * + * @param message The detail message. + * @param invalidMemberClass The class of the invalid member. + * @param commandGroupClass The class of the command group that the member is invalid for. + */ + public InvalidGroupMemberException(String message, Class invalidMemberClass, Class commandGroupClass) { + this(message, invalidMemberClass, commandGroupClass, null); + } + + /** + * Creates a new [EMAIL PROTECTED] InvalidGroupMemberException}. + * + * @param message The detail message. + * @param invalidMemberClass The class of the invalid member. + * @param commandGroupClass The class of the command group that the member is invalid for. + * @param cause The nested exception. + */ + public InvalidGroupMemberException(String message, + Class invalidMemberClass, + Class commandGroupClass, + Throwable cause) { + + super(message, cause); + this.invalidMemberClass = invalidMemberClass; + this.commandGroupClass = commandGroupClass; + + } + + /** + * Returns the class of the command group that the member is invalid for. + * @return Returns the value of the commandGroupClass field, possibly null. + */ + public Class getCommandGroupClass() { + return this.commandGroupClass; + } + + /** + * Returns the class of the invalid member. + * @return Returns the value of the invalidMemberClass field, possibly null. + */ + public Class getInvalidMemberClass() { + return this.invalidMemberClass; + } + +} Property changes on: trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/InvalidGroupMemberException.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