浏览代码

变量名修改

James 10 年之前
父节点
当前提交
d330532f9d

+ 1 - 0
.gitignore

@@ -14,6 +14,7 @@ integration-repo
 /build/
 /build/
 
 
 # IDEA metadata and output dirs
 # IDEA metadata and output dirs
+/.idea/
 *.iml
 *.iml
 *.ipr
 *.ipr
 *.iws
 *.iws

+ 3 - 3
src/com/jfinal/config/Routes.java

@@ -86,11 +86,11 @@ public abstract class Routes {
 	
 	
 	/**
 	/**
 	 * Add url mapping to controller. The view path is controllerKey
 	 * Add url mapping to controller. The view path is controllerKey
-	 * @param controllerkey A key can find controller
+	 * @param controllerKey A key can find controller
 	 * @param controllerClass Controller Class
 	 * @param controllerClass Controller Class
 	 */
 	 */
-	public Routes add(String controllerkey, Class<? extends Controller> controllerClass) {
-		return add(controllerkey, controllerClass, controllerkey);
+	public Routes add(String controllerKey, Class<? extends Controller> controllerClass) {
+		return add(controllerKey, controllerClass, controllerKey);
 	}
 	}
 	
 	
 	public Set<Entry<String, Class<? extends Controller>>> getEntrySet() {
 	public Set<Entry<String, Class<? extends Controller>>> getEntrySet() {

+ 2 - 2
src/com/jfinal/plugin/activerecord/Sqls.java

@@ -26,11 +26,11 @@ import com.jfinal.kit.Prop;
  * 示例:<br>
  * 示例:<br>
  * Sqls.load("mySql.txt");<br>
  * Sqls.load("mySql.txt");<br>
  * String findBlogs = Sqls.get("findBlogs");<br>
  * String findBlogs = Sqls.get("findBlogs");<br>
- * Blog.me.find(findBlogs);<br><br>
+ * Blog.dao.find(findBlogs);<br><br>
  * 
  * 
  * Sqls.load("otherSql.txt");<br>
  * Sqls.load("otherSql.txt");<br>
  * String findUsers = Sqls.get("othersqls.txt", "findUser");<br>
  * String findUsers = Sqls.get("othersqls.txt", "findUser");<br>
- * User.me.find(findUsers);<br>
+ * User.dao.find(findUsers);<br>
  */
  */
 public class Sqls {
 public class Sqls {
 	
 	

+ 7 - 7
src/com/jfinal/plugin/activerecord/tx/TxByMethods.java

@@ -31,14 +31,14 @@ import com.jfinal.plugin.activerecord.IAtom;
  */
  */
 public class TxByMethods implements Interceptor {
 public class TxByMethods implements Interceptor {
 	
 	
-	private Set<String> actionMethodSet = new HashSet<String>();
+	private Set<String> methodSet = new HashSet<String>();
 	
 	
-	public TxByMethods(String... actionMethods) {
-		if (actionMethods == null || actionMethods.length == 0)
-			throw new IllegalArgumentException("actionMethods can not be blank.");
+	public TxByMethods(String... methods) {
+		if (methods == null || methods.length == 0)
+			throw new IllegalArgumentException("methods can not be null.");
 		
 		
-		for (String actionMethod : actionMethods)
-			actionMethodSet.add(actionMethod.trim());
+		for (String method : methods)
+			methodSet.add(method.trim());
 	}
 	}
 	
 	
 	public void intercept(final Invocation inv) {
 	public void intercept(final Invocation inv) {
@@ -46,7 +46,7 @@ public class TxByMethods implements Interceptor {
 		if (config == null)
 		if (config == null)
 			config = DbKit.getConfig();
 			config = DbKit.getConfig();
 		
 		
-		if (actionMethodSet.contains(inv.getMethodName())) {
+		if (methodSet.contains(inv.getMethodName())) {
 			DbPro.use(config.getName()).tx(new IAtom(){
 			DbPro.use(config.getName()).tx(new IAtom(){
 				public boolean run() throws SQLException {
 				public boolean run() throws SQLException {
 					inv.invoke();
 					inv.invoke();

+ 10 - 1
src/com/jfinal/plugin/redis/RedisInterceptor.java

@@ -26,8 +26,17 @@ import com.jfinal.aop.Invocation;
  * 改一下Redis.use() 为 Redis.use(otherCache) 即可
  * 改一下Redis.use() 为 Redis.use(otherCache) 即可
  */
  */
 public class RedisInterceptor implements Interceptor {
 public class RedisInterceptor implements Interceptor {
+	
+	/**
+	 * 通过继承 RedisInterceptor 类并覆盖此方法,可以指定
+	 * 当前线程所使用的 cache
+	 */
+	protected Cache getCache() {
+		return Redis.use();
+	}
+	
 	public void intercept(Invocation inv) {
 	public void intercept(Invocation inv) {
-		Cache cache = Redis.use();
+		Cache cache = getCache();
 		Jedis jedis = cache.getThreadLocalJedis();
 		Jedis jedis = cache.getThreadLocalJedis();
 		if (jedis != null) {
 		if (jedis != null) {
 			inv.invoke();
 			inv.invoke();