Revision: 1654
          http://svn.sourceforge.net/spring-rich-c/?rev=1654&view=rev
Author:   kevinstembridge
Date:     2007-01-12 12:20:30 -0800 (Fri, 12 Jan 2007)

Log Message:
-----------
Initial import

Added Paths:
-----------
    
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ConfigurationException.java
    
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/PropertyNotSetException.java

Added: 
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ConfigurationException.java
===================================================================
--- 
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ConfigurationException.java
                           (rev 0)
+++ 
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ConfigurationException.java
   2007-01-12 20:20:30 UTC (rev 1654)
@@ -0,0 +1,68 @@
+/*
+ * 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.application;
+
+
+/**
+ * Indicates that there is a problem with the runtime configuration of the 
application. This is 
+ * a fairly general top-level exception. Before creating and throwing an 
instance of this type, 
+ *  consider if a more specific subclass would be appropriate.
+ *
+ * @author Kevin Stembridge
+ * @since 0.3
+ *
+ */
+public class ConfigurationException extends ApplicationException {
+
+    private static final long serialVersionUID = 1210397078030323683L;
+
+    /**
+     * Creates a new [EMAIL PROTECTED] ConfigurationException}.
+     */
+    public ConfigurationException() {
+        super();
+    }
+
+    /**
+     * Creates a new [EMAIL PROTECTED] ConfigurationException} with the 
specified message.
+     *
+     * @param message The detail message.
+     */
+    public ConfigurationException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new [EMAIL PROTECTED] ConfigurationException} with the 
specified message
+     * and nested exception.
+     *
+     * @param message The detail mesage.
+     * @param cause The nested exception.
+     */
+    public ConfigurationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Creates a new [EMAIL PROTECTED] ConfigurationException} with the 
specified nested exception.
+     *
+     * @param cause The nested exception.
+     */
+    public ConfigurationException(Throwable cause) {
+        super(cause);
+    }
+
+}


Property changes on: 
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ConfigurationException.java
___________________________________________________________________
Name: svn:keywords
   + Author Id Revision Date HeadURL
Name: svn:eol-style
   + native

Added: 
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/PropertyNotSetException.java
===================================================================
--- 
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/PropertyNotSetException.java
                          (rev 0)
+++ 
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/PropertyNotSetException.java
  2007-01-12 20:20:30 UTC (rev 1654)
@@ -0,0 +1,91 @@
+/*
+ * 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.application;
+
+
+/**
+ * Indicatets that the initialization of an object has not set a required 
property. 
+ *
+ * @author Kevin Stembridge
+ * @since 0.3
+ *
+ */
+public class PropertyNotSetException extends ConfigurationException {
+    
+    private static final long serialVersionUID = 6848949416219396182L;
+
+    /**
+     * Throws an instance of this exception if the given [EMAIL PROTECTED] 
propertyValue} is null.
+     *
+     * @param propertyValue The value of the property.
+     * @param propertyName The name of the property.
+     * @param beanClass The class on which the property is supposed to be set.
+     * 
+     * @throws PropertyNotSetException if [EMAIL PROTECTED] propertyValue} is 
null.
+     */
+    public static void throwIfNull(Object propertyValue, String propertyName, 
Class beanClass) {
+        
+        if (propertyValue == null) {
+            throw new PropertyNotSetException(beanClass, propertyName);
+        }
+        
+    }
+    
+    private final Class beanClass;
+    private final String propertyName;
+    
+    /**
+     * Creates a new [EMAIL PROTECTED] PropertyNotSetException} with the 
+     * specified bean class and property name.
+     *
+     * @param beanClass The class of the JavaBean that has an uninitialized 
property.
+     * @param propertyName The name of the property that has not been set.
+     */
+    public PropertyNotSetException(Class beanClass, String propertyName) {
+        this("The [" 
+             + propertyName 
+             + "] property of class [" 
+             + beanClass 
+             + "] has not been initialized.",
+             beanClass,
+             propertyName);
+        
+    }
+    
+    private PropertyNotSetException(String message, Class beanClass, String 
propertyName) {
+        super(message);
+        this.beanClass = beanClass;
+        this.propertyName = propertyName;
+        
+    }
+    
+    /**
+     * Returns the class of the JavaBean that has the uninitialized property. 
+     * @return Returns the value of the beanClass field.
+     */
+    public Class getBeanClass() {
+        return this.beanClass;
+    }
+    
+    /**
+     * Returns the name of the property that has not been set.
+     * @return Returns the value of the propertyName field.
+     */
+    public String getPropertyName() {
+        return this.propertyName;
+    }
+
+}


Property changes on: 
trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/PropertyNotSetException.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

Reply via email to