浏览代码

jfinal 5.1.9 release ^_^

James 1 年之前
父节点
当前提交
0b95cd8134

+ 5 - 4
src/main/java/com/jfinal/plugin/activerecord/tx/TxByActionKeyRegex.java

@@ -39,16 +39,18 @@ public class TxByActionKeyRegex implements Interceptor {
 	}
 
 	public TxByActionKeyRegex(String regex, boolean caseSensitive) {
-		if (StrKit.isBlank(regex))
+		if (StrKit.isBlank(regex)) {
 			throw new IllegalArgumentException("regex can not be blank.");
+		}
 
 		pattern = caseSensitive ? Pattern.compile(regex) : Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
 	}
 
 	public void intercept(final Invocation inv) {
 		Config config = Tx.getConfigByTxConfig(inv);
-		if (config == null)
+		if (config == null) {
 			config = DbKit.getConfig();
+		}
 
 		if (pattern.matcher(inv.getActionKey()).matches()) {
 			Db.use(config.getName()).tx(new IAtom() {
@@ -56,8 +58,7 @@ public class TxByActionKeyRegex implements Interceptor {
 					inv.invoke();
 					return true;
 				}});
-		}
-		else {
+		} else {
 			inv.invoke();
 		}
 	}

+ 7 - 5
src/main/java/com/jfinal/plugin/activerecord/tx/TxByActionKeys.java

@@ -34,17 +34,20 @@ public class TxByActionKeys implements Interceptor {
 	private Set<String> actionKeySet = new HashSet<String>();
 
 	public TxByActionKeys(String... actionKeys) {
-		if (actionKeys == null || actionKeys.length == 0)
+		if (actionKeys == null || actionKeys.length == 0) {
 			throw new IllegalArgumentException("actionKeys can not be blank.");
+		}
 
-		for (String actionKey : actionKeys)
+		for (String actionKey : actionKeys) {
 			actionKeySet.add(actionKey.trim());
+		}
 	}
 
 	public void intercept(final Invocation inv) {
 		Config config = Tx.getConfigByTxConfig(inv);
-		if (config == null)
+		if (config == null) {
 			config = DbKit.getConfig();
+		}
 
 		if (actionKeySet.contains(inv.getActionKey())) {
 			Db.use(config.getName()).tx(new IAtom() {
@@ -52,8 +55,7 @@ public class TxByActionKeys implements Interceptor {
 					inv.invoke();
 					return true;
 				}});
-		}
-		else {
+		} else {
 			inv.invoke();
 		}
 	}

+ 5 - 4
src/main/java/com/jfinal/plugin/activerecord/tx/TxByMethodRegex.java

@@ -39,16 +39,18 @@ public class TxByMethodRegex implements Interceptor {
 	}
 
 	public TxByMethodRegex(String regex, boolean caseSensitive) {
-		if (StrKit.isBlank(regex))
+		if (StrKit.isBlank(regex)) {
 			throw new IllegalArgumentException("regex can not be blank.");
+		}
 
 		pattern = caseSensitive ? Pattern.compile(regex) : Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
 	}
 
 	public void intercept(final Invocation inv) {
 		Config config = Tx.getConfigByTxConfig(inv);
-		if (config == null)
+		if (config == null) {
 			config = DbKit.getConfig();
+		}
 
 		if (pattern.matcher(inv.getMethodName()).matches()) {
 			Db.use(config.getName()).tx(new IAtom() {
@@ -56,8 +58,7 @@ public class TxByMethodRegex implements Interceptor {
 					inv.invoke();
 					return true;
 				}});
-		}
-		else {
+		} else {
 			inv.invoke();
 		}
 	}

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

@@ -34,17 +34,20 @@ public class TxByMethods implements Interceptor {
 	private Set<String> methodSet = new HashSet<String>();
 
 	public TxByMethods(String... methods) {
-		if (methods == null || methods.length == 0)
+		if (methods == null || methods.length == 0) {
 			throw new IllegalArgumentException("methods can not be null.");
+		}
 
-		for (String method : methods)
+		for (String method : methods) {
 			methodSet.add(method.trim());
+		}
 	}
 
 	public void intercept(final Invocation inv) {
 		Config config = Tx.getConfigByTxConfig(inv);
-		if (config == null)
+		if (config == null) {
 			config = DbKit.getConfig();
+		}
 
 		if (methodSet.contains(inv.getMethodName())) {
 			Db.use(config.getName()).tx(new IAtom() {
@@ -52,8 +55,7 @@ public class TxByMethods implements Interceptor {
 					inv.invoke();
 					return true;
 				}});
-		}
-		else {
+		} else {
 			inv.invoke();
 		}
 	}