ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbe...@apache.org
Subject svn commit: r746637 - /ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperRegistry.java
Date Sun, 22 Feb 2009 04:55:48 GMT
Author: cbegin
Date: Sun Feb 22 04:55:48 2009
New Revision: 746637

URL: http://svn.apache.org/viewvc?rev=746637&view=rev
Log:
reformatted code

Modified:
    ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperRegistry.java

Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperRegistry.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperRegistry.java?rev=746637&r1=746636&r2=746637&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperRegistry.java
(original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/binding/MapperRegistry.java
Sun Feb 22 04:55:48 2009
@@ -45,7 +45,7 @@
 
   public void parseAnnotations(Class type) {
     Cache cache = parseCache(type);
-    parseMethodAnnotations(cache,type);
+    parseMethodAnnotations(cache, type);
   }
 
   private Cache parseCache(Class type) {
@@ -67,7 +67,7 @@
     for (Method method : methods) {
       MappedStatement statement = parseMappedStatement(method, cache);
       if (statement != null) {
-      config.addMappedStatement(statement);
+        config.addMappedStatement(statement);
       }
     }
   }
@@ -75,37 +75,41 @@
   private MappedStatement parseMappedStatement(Method method, Cache cache) {
     Class annotationType = getSqlAnnotationType(method);
     if (annotationType != null) {
-    String sql = getSqlAnnotationValue(method, annotationType);
-    String mappedStatementId = method.getDeclaringClass().getName() + "." + method.getName();
-    SqlSource sqlSource = new BasicSqlSource(sql);
-    MappedStatement.Builder builder = new MappedStatement.Builder(config, mappedStatementId,
sqlSource);
-    builder.resource(method.getDeclaringClass().getName().replace('.', '/') + ".java (best
guess)");
-
-    Options options = method.getAnnotation(Options.class);
-    if (options != null) {
-      builder.useCache(options.useCache());
-      builder.flushCacheRequired(options.flushCache());
-      builder.resultSetType(options.resultSetType());
-      builder.statementType(options.statementType());
-      builder.fetchSize(options.fetchSize());
-      builder.timeout(options.timeout());
-    }
+      String sql = getSqlAnnotationValue(method, annotationType);
+      String mappedStatementId = method.getDeclaringClass().getName() + "." + method.getName();
+      SqlSource sqlSource = new BasicSqlSource(sql);
+      MappedStatement.Builder builder = new MappedStatement.Builder(config, mappedStatementId,
sqlSource);
+      builder.resource(method.getDeclaringClass().getName().replace('.', '/') + ".java (best
guess)");
+
+      Options options = method.getAnnotation(Options.class);
+      if (options != null) {
+        builder.useCache(options.useCache());
+        builder.flushCacheRequired(options.flushCache());
+        builder.resultSetType(options.resultSetType());
+        builder.statementType(options.statementType());
+        builder.fetchSize(options.fetchSize());
+        builder.timeout(options.timeout());
+      }
 
-    builder.cache(cache);
+      builder.cache(cache);
 
-    Class returnType = method.getReturnType();
-    if (returnType.isAssignableFrom(Collection.class)) {
-      TypeVariable<? extends Class<?>>[] returnTypeVariables = returnType.getTypeParameters();
-      if (returnTypeVariables.length == 1) {
-        returnType = returnTypeVariables[0].getGenericDeclaration();
+      Class returnType = method.getReturnType();
+      if (returnType.isAssignableFrom(Collection.class)) {
+        TypeVariable<? extends Class<?>>[] returnTypeVariables = returnType.getTypeParameters();
+        if (returnTypeVariables.length == 1) {
+          returnType = returnTypeVariables[0].getGenericDeclaration();
+        }
       }
-    }
 
-    builder.parameterMap(new ParameterMap.Builder(config,"",Object.class,new ArrayList<ParameterMapping>()).build());
-    final ResultMap resultMap = new ResultMap.Builder(config, "", returnType, new ArrayList<ResultMapping>()).build();
-    builder.resultMaps(new ArrayList<ResultMap>() {{ add(resultMap); }});
+      builder.parameterMap(new ParameterMap.Builder(config, "", Object.class, new ArrayList<ParameterMapping>()).build());
+      final ResultMap resultMap = new ResultMap.Builder(config, "", returnType, new ArrayList<ResultMapping>()).build();
+      builder.resultMaps(new ArrayList<ResultMap>() {
+        {
+          add(resultMap);
+        }
+      });
 
-    return builder.build();
+      return builder.build();
     }
     return null;
   }
@@ -116,7 +120,7 @@
       try {
         String[] strings = (String[]) annotation.getClass().getMethod("value").invoke(annotation);
         StringBuilder sql = new StringBuilder();
-        for(String fragment : strings) {
+        for (String fragment : strings) {
           sql.append(fragment);
           sql.append(" ");
         }



Mime
View raw message