Browse Source

jfinal 4.0 release

James 6 years ago
parent
commit
6ad62bea9e

+ 0 - 21
src/main/java/com/jfinal/aop/Enhance.java

@@ -1,21 +0,0 @@
-package com.jfinal.aop;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Enhance 用于配置被注入对象是否要增强
- * 
- * 由于下一版本的 jfinal 3.6 将根据目标类中是否存在 Before 注解
- * 来决定是否增强,所以该 Enhance 仅仅是一个过渡功能,不建议使用
- */
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-@Deprecated
-public @interface Enhance {
-	boolean value();				// 是否增强
-}

+ 0 - 178
src/main/java/com/jfinal/kit/JMap.java

@@ -1,178 +0,0 @@
-/**
- * Copyright (c) 2011-2019, James Zhan 詹波 (jfinal@126.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.jfinal.kit;
-
-import java.util.HashMap;
-import java.util.Map;
-import com.jfinal.json.Json;
-
-/**
- * 建议使用 Kv 代替 JMap,JMap 已被 Deprecated
- * 
- * JMap ---> JFinal Map 
- * 参数或者返回值封装,常用于业务层传参与返回值
- * 
- * Example:
- * 1:JMap para = JMap.create("id", 123);
- *    User user = user.findFirst(getSqlPara("find", para));
- * 
- * 2:return JMap.fail("msg", "用户名或密码错误");	// 登录失败返回
- *   return JMap.ok("loginUser", user);			// 登录成功返回
- * 
- * 3:JMap map = loginService.login(...);
- *   renderJson(map);
- */
-@SuppressWarnings({"serial", "rawtypes", "unchecked"})
-@Deprecated
-public class JMap extends HashMap {
-
-	private static final String STATUS_OK = "isOk";
-	private static final String STATUS_FAIL = "isFail";
-	
-	public JMap() {
-	}
-	
-	public static JMap by(Object key, Object value) {
-		return new JMap().set(key, value);
-	}
-	
-	public static JMap create(Object key, Object value) {
-		return new JMap().set(key, value);
-	}
-	
-	public static JMap create() {
-		return new JMap();
-	}
-	
-	public static JMap ok() {
-		return new JMap().setOk();
-	}
-	
-	public static JMap ok(Object key, Object value) {
-		return ok().set(key, value);
-	}
-	
-	public static JMap fail() {
-		return new JMap().setFail();
-	}
-	
-	public static JMap fail(Object key, Object value) {
-		return fail().set(key, value);
-	}
-	
-	public JMap setOk() {
-		super.put(STATUS_OK, Boolean.TRUE);
-		super.put(STATUS_FAIL, Boolean.FALSE);
-		return this;
-	}
-	
-	public JMap setFail() {
-		super.put(STATUS_OK, Boolean.FALSE);
-		super.put(STATUS_FAIL, Boolean.TRUE);
-		return this;
-	}
-	
-	public boolean isOk() {
-		Boolean isOk = (Boolean)get(STATUS_OK);
-		return isOk != null && isOk;
-	}
-	
-	public boolean isFail() {
-		Boolean isFail = (Boolean)get(STATUS_FAIL);
-		return isFail != null && isFail;
-	}
-	
-	public JMap set(Object key, Object value) {
-		super.put(key, value);
-		return this;
-	}
-	
-	public JMap set(Map map) {
-		super.putAll(map);
-		return this;
-	}
-	
-	public JMap set(JMap jMap) {
-		super.putAll(jMap);
-		return this;
-	}
-	
-	public JMap delete(Object key) {
-		super.remove(key);
-		return this;
-	}
-	
-	public <T> T getAs(Object key) {
-		return (T)get(key);
-	}
-	
-	public String getStr(Object key) {
-		return (String)get(key);
-	}
-
-	public Integer getInt(Object key) {
-		return (Integer)get(key);
-	}
-
-	public Long getLong(Object key) {
-		return (Long)get(key);
-	}
-
-	public Boolean getBoolean(Object key) {
-		return (Boolean)get(key);
-	}
-	
-	/**
-	 * key 存在,并且 value 不为 null
-	 */
-	public boolean notNull(Object key) {
-		return get(key) != null;
-	}
-	
-	/**
-	 * key 不存在,或者 key 存在但 value 为null
-	 */
-	public boolean isNull(Object key) {
-		return get(key) == null;
-	}
-	
-	/**
-	 * key 存在,并且 value 为 true,则返回 true
-	 */
-	public boolean isTrue(Object key) {
-		Object value = get(key);
-		return (value instanceof Boolean && ((Boolean)value == true));
-	}
-	
-	/**
-	 * key 存在,并且 value 为 false,则返回 true
-	 */
-	public boolean isFalse(Object key) {
-		Object value = get(key);
-		return (value instanceof Boolean && ((Boolean)value == false));
-	}
-	
-	public String toJson() {
-		return Json.getJson().toJson(this);
-	}
-	
-	public boolean equals(Object jMap) {
-		return jMap instanceof JMap && super.equals(jMap);
-	}
-}
-
-

+ 0 - 93
src/main/java/com/jfinal/plugin/activerecord/Sqls.java

@@ -1,93 +0,0 @@
-/**
- * Copyright (c) 2011-2019, James Zhan 詹波 (jfinal@126.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.jfinal.plugin.activerecord;
-
-import java.util.concurrent.ConcurrentHashMap;
-import com.jfinal.core.Const;
-import com.jfinal.kit.Prop;
-
-/**
- * 外部存取 sql 语句的工具类.<br>
- * 示例:<br>
- * Sqls.load("mySql.txt");<br>
- * String findBlogs = Sqls.get("findBlogs");<br>
- * Blog.dao.find(findBlogs);<br><br>
- * 
- * Sqls.load("otherSql.txt");<br>
- * String findUsers = Sqls.get("othersqls.txt", "findUser");<br>
- * User.dao.find(findUsers);<br>
- */
-@Deprecated
-public class Sqls {
-	
-	private static Prop prop = null;
-	private static final ConcurrentHashMap<String, Prop> map = new ConcurrentHashMap<String, Prop>();
-	
-	private Sqls() {}
-	
-	/**
-	 * 加载 sql 文件.
-	 * 最先被加载的 sql 文件将成为默认 sql 文件,并能够被 Sqls.get(String) 使用到
-	 * 第一次以后 load 后的 sql 文件会被 Sqls.get(String, String) 使用到
-	 */
-	public static void load(String sqlFileName) {
-		use(sqlFileName);
-	}
-	
-	public static String get(String sqlKey) {
-		if (prop == null)
-			throw new IllegalStateException("Init sql propties file by invoking Sqls.load(String fileName) method first.");
-		return prop.get(sqlKey);
-	}
-	
-	public static String get(String slqFileName, String sqlKey) {
-		Prop prop = map.get(slqFileName);
-		if (prop == null)
-			throw new IllegalStateException("Init sql propties file by invoking Sqls.load(String fileName) method first.");
-		return prop.get(sqlKey);
-	}
-	
-	private static Prop use(String fileName) {
-		return use(fileName, Const.DEFAULT_ENCODING);
-	}
-	
-	private static Prop use(String fileName, String encoding) {
-		Prop result = map.get(fileName);
-		if (result == null) {
-			result = new Prop(fileName, encoding);
-			map.put(fileName, result);
-			if (Sqls.prop == null)
-				Sqls.prop = result;
-		}
-		return result;
-	}
-	
-	public static Prop useless(String sqlFileName) {
-		Prop previous = map.remove(sqlFileName);
-		if (Sqls.prop == previous)
-			Sqls.prop = null;
-		return previous;
-	}
-	
-	public static void clear() {
-		prop = null;
-		map.clear();
-	}
-}
-
-
-