ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbe...@apache.org
Subject svn commit: r748038 - in /ibatis/trunk/java/ibatis-3: ./ ibatis-3-core/src/main/java/org/apache/ibatis/annotations/ ibatis-3-core/src/main/java/org/apache/ibatis/binding/ ibatis-3-core/src/main/java/org/apache/ibatis/mapping/ ibatis-3-core/src/main/jav...
Date Thu, 26 Feb 2009 06:40:24 GMT
Author: cbegin
Date: Thu Feb 26 06:40:24 2009
New Revision: 748038

URL: http://svn.apache.org/viewvc?rev=748038&view=rev
Log:
Fixed a bunch of stuff that I apparently broke without noticing... I blame Maven!!!

Modified:
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/annotations/Annotations.java
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperAnnotationParser.java
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/ResultMapping.java
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/BaseParser.java
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/MapperParser.java
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/binding/BoundAuthorMapper.java
    ibatis/trunk/java/ibatis-3/version.properties

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/annotations/Annotations.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/annotations/Annotations.java?rev=748038&r1=748037&r2=748038&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/annotations/Annotations.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/annotations/Annotations.java
Thu Feb 26 06:40:24 2009
@@ -35,7 +35,7 @@
   @Retention(RetentionPolicy.RUNTIME)
   @Target(ElementType.METHOD)
   public static @interface Result {
-    boolean key() default false;
+    boolean id() default false;
     String column() default "";
     String property() default "";
     Class javaType() default void.class;

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperAnnotationParser.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperAnnotationParser.java?rev=748038&r1=748037&r2=748038&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperAnnotationParser.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperAnnotationParser.java
Thu Feb 26 06:40:24 2009
@@ -3,7 +3,6 @@
 import static org.apache.ibatis.annotations.Annotations.*;
 import org.apache.ibatis.mapping.*;
 import org.apache.ibatis.parser.MapperConfigurator;
-import org.apache.ibatis.type.TypeHandler;
 import org.apache.ibatis.type.JdbcType;
 
 import java.lang.annotation.Annotation;
@@ -11,7 +10,6 @@
 import java.lang.reflect.TypeVariable;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 
 public class MapperAnnotationParser {
 
@@ -31,6 +29,7 @@
     parseCacheRef();
     Method[] methods = type.getMethods();
     for (Method method : methods) {
+      parseConstructor(method);
       parseResults(method);
       parseStatement(method);
     }
@@ -56,6 +55,8 @@
       String resultMapId = type.getName() + "." + method.getName();
       configurator.resultMapStart(resultMapId,getReturnType(method),null);
       for (Result result : results.value()) {
+        ArrayList<ResultFlag> flags = new ArrayList<ResultFlag>();
+        if (result.id()) flags.add(ResultFlag.ID);
         configurator.resultMapping(
             result.property(),
             result.column(),
@@ -64,13 +65,36 @@
             null,
             null,
             result.typeHandler() == void.class ? null : result.typeHandler(),
-            null);
+            flags);
       }
       configurator.resultMapEnd();
       hasResults = true;
     }
   }
 
+  public void parseConstructor(Method method) {
+    ConstructorArgs args = method.getAnnotation(ConstructorArgs.class);
+    if (args != null) {
+      String resultMapId = type.getName() + "." + method.getName();
+      configurator.resultMapStart(resultMapId,getReturnType(method),null);
+      for (Arg arg : args.value()) {
+        ArrayList<ResultFlag> flags = new ArrayList<ResultFlag>();
+        flags.add(ResultFlag.CONSTRUCTOR);
+        if (arg.id()) flags.add(ResultFlag.ID);
+        configurator.resultMapping(
+            null,
+            arg.column(),
+            arg.javaType() == void.class ? null : arg.javaType(),
+            arg.jdbcType() == JdbcType.UNDEFINED ? null : arg.jdbcType(),
+            null,
+            null,
+            arg.typeHandler() == void.class ? null : arg.typeHandler(),
+            flags);      }
+      configurator.resultMapEnd();
+      hasResults = true;
+    }
+  }
+
   private void parseStatement(Method method) {
     Class annotationType = getSqlAnnotationType(method);
     Options options = method.getAnnotation(Options.class);

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/ResultMapping.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/ResultMapping.java?rev=748038&r1=748037&r2=748038&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/ResultMapping.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/ResultMapping.java
Thu Feb 26 06:40:24 2009
@@ -3,7 +3,6 @@
 import org.apache.ibatis.type.JdbcType;
 import org.apache.ibatis.type.TypeHandler;
 import org.apache.ibatis.type.TypeHandlerRegistry;
-import org.apache.derby.impl.sql.compile.SQLParser;
 
 import java.util.ArrayList;
 import java.util.Collections;

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/BaseParser.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/BaseParser.java?rev=748038&r1=748037&r2=748038&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/BaseParser.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/BaseParser.java
Thu Feb 26 06:40:24 2009
@@ -80,6 +80,7 @@
   }
 
   protected String resolveAlias(String alias) {
+    System.out.println(this.getClass() +" " + typeAliasRegistry);
     return typeAliasRegistry.resolveAlias(alias);
   }
 }

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/MapperParser.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/MapperParser.java?rev=748038&r1=748037&r2=748038&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/MapperParser.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/parser/MapperParser.java
Thu Feb 26 06:40:24 2009
@@ -24,6 +24,9 @@
     this.parser.setValidation(true);
     this.parser.setVariables(configuration.getVariables());
     this.parser.setEntityResolver(new MapperEntityResolver());
+    this.typeAliasRegistry = configuration.getTypeAliasRegistry();
+    this.typeHandlerRegistry = configuration.getTypeHandlerRegistry();
+    this.configuration = configuration;
   }
 
   public void parse() {
@@ -50,10 +53,10 @@
   //  <cache type="LRU" flushInterval="3600000" size="1000" readOnly="false" />
   @Nodelet("/mapper/cache")
   public void cacheElement(NodeletContext context) throws Exception {
-    String type = context.getStringAttribute("perpetual");
+    String type = context.getStringAttribute("type","PERPETUAL");
     type = typeAliasRegistry.resolveAlias(type);
     Class typeClass = Class.forName(type);
-    String eviction = context.getStringAttribute("eviction");
+    String eviction = context.getStringAttribute("eviction","LRU");
     eviction = typeAliasRegistry.resolveAlias(eviction);
     Class evictionClass = Class.forName(eviction);
     Long flushInterval = context.getLongAttribute("flushInterval");

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/binding/BoundAuthorMapper.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/binding/BoundAuthorMapper.java?rev=748038&r1=748037&r2=748038&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/binding/BoundAuthorMapper.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/test/java/org/apache/ibatis/binding/BoundAuthorMapper.java
Thu Feb 26 06:40:24 2009
@@ -5,8 +5,11 @@
 
 public interface BoundAuthorMapper {
 
+//  @ConstructorArgs({
+//      @Arg(column = "AUTHOR_ID")
+//      })
   @Results({
-      @Result(property = "id",column = "AUTHOR_ID"),
+    @Result(property="id",column = "AUTHOR_ID"),
       @Result(property = "username",column = "AUTHOR_USERNAME"),
       @Result(property = "password",column = "AUTHOR_PASSWORD"),
       @Result(property = "email",column = "AUTHOR_EMAIL"),

Modified: ibatis/trunk/java/ibatis-3/version.properties
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/version.properties?rev=748038&r1=748037&r2=748038&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/version.properties (original)
+++ ibatis/trunk/java/ibatis-3/version.properties Thu Feb 26 06:40:24 2009
@@ -1,5 +1,5 @@
-#Build version info
-#Sat Feb 21 21:47:38 MST 2009
-version=3.0.0
-buildDate=2009/02/21 21\:47
-buildNum=131
+#Build version info
+#Wed Feb 25 23:32:13 MST 2009
+version=3.0.0
+buildDate=2009/02/25 23\:32
+buildNum=134



Mime
View raw message