commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r651750 - in /commons/proper/scxml/branches/J6/src: main/java/org/apache/commons/scxml/io/ main/java/org/apache/commons/scxml/model/ test/java/org/apache/commons/scxml/model/
Date Sat, 26 Apr 2008 00:46:46 GMT
Author: rahul
Date: Fri Apr 25 17:46:43 2008
New Revision: 651750

URL: http://svn.apache.org/viewvc?rev=651750&view=rev
Log:
Type safety improvements.
Remove one test that is made obsolete by these improvements.

Modified:
    commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLDigester.java
    commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLParser.java
    commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/CustomAction.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java

Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLDigester.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLDigester.java?rev=651750&r1=651749&r2=651750&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLDigester.java
(original)
+++ commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLDigester.java
Fri Apr 25 17:46:43 2008
@@ -1033,7 +1033,7 @@
             } else {
                 scxmlRules.setNamespaceURI(ca.getNamespaceURI());
                 String xpfLocalName = STR_SLASH + ca.getLocalName();
-                Class klass = ca.getActionClass();
+                Class<? extends Action> klass = ca.getActionClass();
                 if (SCXMLHelper.implementationOf(klass,
                         ExternalContent.class)) {
                     addCustomActionRulesTuple(xp + xpfLocalName, scxmlRules,
@@ -1078,8 +1078,8 @@
      *              <code>NodeCreateRule</code>
      */
     private static void addCustomActionRulesTuple(final String xp,
-            final ExtendedBaseRules scxmlRules, final Class klass,
-            final boolean bodyContent) {
+            final ExtendedBaseRules scxmlRules,
+            final Class<? extends Action> klass, final boolean bodyContent) {
         addActionRulesTuple(xp, scxmlRules, klass);
         if (bodyContent) {
             try {
@@ -1121,7 +1121,8 @@
      *              in the ObjectCreateRule for this action
      */
     private static void addActionRulesTuple(final String xp,
-            final ExtendedBaseRules scxmlRules, final Class klass) {
+            final ExtendedBaseRules scxmlRules,
+            final Class<? extends Action> klass) {
         addSimpleRulesTuple(xp, scxmlRules, klass, null, null, "addAction");
         scxmlRules.add(xp, new SetExecutableParentRule());
         scxmlRules.add(xp, new SetCurrentNamespacesRule());
@@ -1140,7 +1141,7 @@
      * @param addMethod The method that the SetNextRule should call
      */
     private static void addSimpleRulesTuple(final String xp,
-            final ExtendedBaseRules scxmlRules, final Class klass,
+            final ExtendedBaseRules scxmlRules, final Class<?> klass,
             final String[] args, final String[] props,
             final String addMethod) {
         scxmlRules.add(xp, new ObjectCreateRule(klass));

Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLParser.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLParser.java?rev=651750&r1=651749&r2=651750&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLParser.java
(original)
+++ commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/io/SCXMLParser.java
Fri Apr 25 17:46:43 2008
@@ -1065,7 +1065,7 @@
             } else {
                 scxmlRules.setNamespaceURI(ca.getNamespaceURI());
                 String xpfLocalName = STR_SLASH + ca.getLocalName();
-                Class klass = ca.getActionClass();
+                Class<? extends Action> klass = ca.getActionClass();
                 if (SCXMLHelper.implementationOf(klass,
                         ExternalContent.class)) {
                     addCustomActionRulesTuple(xp + xpfLocalName, scxmlRules,
@@ -1110,8 +1110,8 @@
      *              <code>NodeCreateRule</code>
      */
     private static void addCustomActionRulesTuple(final String xp,
-            final ExtendedBaseRules scxmlRules, final Class klass,
-            final boolean bodyContent) {
+            final ExtendedBaseRules scxmlRules,
+            final Class<? extends Action> klass, final boolean bodyContent) {
         addActionRulesTuple(xp, scxmlRules, klass);
         if (bodyContent) {
             try {
@@ -1153,7 +1153,8 @@
      *              in the ObjectCreateRule for this action
      */
     private static void addActionRulesTuple(final String xp,
-            final ExtendedBaseRules scxmlRules, final Class klass) {
+            final ExtendedBaseRules scxmlRules,
+            final Class<? extends Action> klass) {
         addSimpleRulesTuple(xp, scxmlRules, klass, null, null, "addAction");
         scxmlRules.add(xp, new SetExecutableParentRule());
         scxmlRules.add(xp, new SetCurrentNamespacesRule());
@@ -1172,7 +1173,7 @@
      * @param addMethod The method that the SetNextRule should call
      */
     private static void addSimpleRulesTuple(final String xp,
-            final ExtendedBaseRules scxmlRules, final Class klass,
+            final ExtendedBaseRules scxmlRules, final Class<?> klass,
             final String[] args, final String[] props,
             final String addMethod) {
         scxmlRules.add(xp, new ObjectCreateRule(klass));

Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/CustomAction.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/CustomAction.java?rev=651750&r1=651749&r2=651750&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/CustomAction.java
(original)
+++ commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/CustomAction.java
Fri Apr 25 17:46:43 2008
@@ -75,7 +75,7 @@
     /**
      * The implementation of this custom action.
      */
-    private Class actionClass;
+    private Class<? extends Action> actionClass;
 
     /**
      * The log for this custom action.
@@ -93,7 +93,7 @@
      *                    custom action.
      */
     public CustomAction(final String namespaceURI, final String localName,
-            final Class actionClass) {
+            final Class<? extends Action> actionClass) {
         this.log = LogFactory.getLog(CustomAction.class);
         if (SCXMLHelper.isStringEmpty(namespaceURI)) {
             log.error(ERR_NO_NAMESPACE);
@@ -122,7 +122,7 @@
      *
      * @return Returns the action class.
      */
-    public Class getActionClass() {
+    public Class<? extends Action> getActionClass() {
         return actionClass;
     }
 

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java?rev=651750&r1=651749&r2=651750&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java
Fri Apr 25 17:46:43 2008
@@ -120,19 +120,9 @@
     }
 
     public void testAddBadCustomAction05() {
-        try {
-            new CustomAction("http://my.actions.domain/CUSTOM", "foo",
-                this.getClass());
-            fail("Added custom action which is not an Action class subtype");
-        } catch (IllegalArgumentException iae) {
-            // Expected
-        }
-    }
-
-    public void testAddBadCustomAction06() {
-        try {
+        try {            
             new CustomAction("http://www.w3.org/2005/07/scxml", "foo",
-                this.getClass());
+                Hello.class);
             fail("Added custom action in the SCXML namespace");
         } catch (IllegalArgumentException iae) {
             // Expected



Mime
View raw message