enjoy 4.0 release ^_^
This commit is contained in:
parent
4377d19e2f
commit
f6a855b6bf
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<artifactId>enjoy</artifactId>
|
<artifactId>enjoy</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>enjoy</name>
|
<name>enjoy</name>
|
||||||
<version>3.9-SNAPSHOT</version>
|
<version>4.0-SNAPSHOT</version>
|
||||||
<url>http://www.jfinal.com</url>
|
<url>http://www.jfinal.com</url>
|
||||||
<description>Enjoy is a simple, light, rapid, independent, extensible Java Template Engine.</description>
|
<description>Enjoy is a simple, light, rapid, independent, extensible Java Template Engine.</description>
|
||||||
|
|
||||||
|
@ -30,11 +30,6 @@ import java.util.Map;
|
|||||||
@SuppressWarnings({"serial", "rawtypes", "unchecked"})
|
@SuppressWarnings({"serial", "rawtypes", "unchecked"})
|
||||||
public class Kv extends HashMap {
|
public class Kv extends HashMap {
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private static final String STATE_OK = "isOk";
|
|
||||||
@Deprecated
|
|
||||||
private static final String STATE_FAIL = "isFail";
|
|
||||||
|
|
||||||
public Kv() {
|
public Kv() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,68 +41,6 @@ public class Kv extends HashMap {
|
|||||||
return new Kv();
|
return new Kv();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static Kv ok() {
|
|
||||||
return new Kv().setOk();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static Kv ok(Object key, Object value) {
|
|
||||||
return ok().set(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static Kv fail() {
|
|
||||||
return new Kv().setFail();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static Kv fail(Object key, Object value) {
|
|
||||||
return fail().set(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public Kv setOk() {
|
|
||||||
super.put(STATE_OK, Boolean.TRUE);
|
|
||||||
super.put(STATE_FAIL, Boolean.FALSE);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public Kv setFail() {
|
|
||||||
super.put(STATE_FAIL, Boolean.TRUE);
|
|
||||||
super.put(STATE_OK, Boolean.FALSE);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public boolean isOk() {
|
|
||||||
Boolean isOk = (Boolean)get(STATE_OK);
|
|
||||||
if (isOk != null) {
|
|
||||||
return isOk;
|
|
||||||
}
|
|
||||||
Boolean isFail = (Boolean)get(STATE_FAIL);
|
|
||||||
if (isFail != null) {
|
|
||||||
return !isFail;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new IllegalStateException("调用 isOk() 之前,必须先调用 ok()、fail() 或者 setOk()、setFail() 方法");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public boolean isFail() {
|
|
||||||
Boolean isFail = (Boolean)get(STATE_FAIL);
|
|
||||||
if (isFail != null) {
|
|
||||||
return isFail;
|
|
||||||
}
|
|
||||||
Boolean isOk = (Boolean)get(STATE_OK);
|
|
||||||
if (isOk != null) {
|
|
||||||
return !isOk;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new IllegalStateException("调用 isFail() 之前,必须先调用 ok()、fail() 或者 setOk()、setFail() 方法");
|
|
||||||
}
|
|
||||||
|
|
||||||
public Kv set(Object key, Object value) {
|
public Kv set(Object key, Object value) {
|
||||||
super.put(key, value);
|
super.put(key, value);
|
||||||
return this;
|
return this;
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package com.jfinal.kit;
|
package com.jfinal.kit;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Parameter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 反射工具类
|
* 反射工具类
|
||||||
*/
|
*/
|
||||||
@ -29,6 +32,45 @@ public class ReflectKit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getMethodSignature(Method method) {
|
||||||
|
StringBuilder ret = new StringBuilder()
|
||||||
|
.append(method.getDeclaringClass().getName())
|
||||||
|
.append(".")
|
||||||
|
.append(method.getName())
|
||||||
|
.append("(");
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
Parameter[] paras = method.getParameters();
|
||||||
|
for (Parameter p : paras) {
|
||||||
|
if (index++ > 0) {
|
||||||
|
ret.append(", ");
|
||||||
|
}
|
||||||
|
ret.append(p.getParameterizedType().getTypeName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret.append(")").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public static String getMethodSignature(Method method) {
|
||||||
|
StringBuilder ret = new StringBuilder()
|
||||||
|
.append(method.getDeclaringClass().getName())
|
||||||
|
.append(".")
|
||||||
|
.append(method.getName())
|
||||||
|
.append("(");
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
java.lang.reflect.Type[] paraTypes = method.getGenericParameterTypes();
|
||||||
|
for (java.lang.reflect.Type type : paraTypes) {
|
||||||
|
if (index++ > 0) {
|
||||||
|
ret.append(", ");
|
||||||
|
}
|
||||||
|
ret.append(type.getTypeName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret.append(")").toString();
|
||||||
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ import com.jfinal.template.stat.Scope;
|
|||||||
*
|
*
|
||||||
* field 表达式取值优先次序,以 user.name 为例
|
* field 表达式取值优先次序,以 user.name 为例
|
||||||
* 1:假如 user.getName() 存在,则优先调用
|
* 1:假如 user.getName() 存在,则优先调用
|
||||||
* 2:假如 user 为 Model 子类,则调用 user.get("name")
|
* 2:假如 user 具有 public name 属性,则取 user.name 属性值
|
||||||
* 3:假如 user 为 Record,则调用 user.get("name")
|
* 3:假如 user 为 Model 子类,则调用 user.get("name")
|
||||||
* 4:假如 user 为 Map,则调用 user.get("name")
|
* 4:假如 user 为 Record,则调用 user.get("name")
|
||||||
* 5:假如 user 具有 public name 属性,则取 user.name 属性值
|
* 5:假如 user 为 Map,则调用 user.get("name")
|
||||||
*/
|
*/
|
||||||
public class Field extends Expr {
|
public class Field extends Expr {
|
||||||
|
|
||||||
|
@ -44,10 +44,13 @@ public class FieldKit {
|
|||||||
LinkedList<FieldGetter> ret = new LinkedList<FieldGetter>();
|
LinkedList<FieldGetter> ret = new LinkedList<FieldGetter>();
|
||||||
|
|
||||||
ret.addLast(new GetterMethodFieldGetter(null));
|
ret.addLast(new GetterMethodFieldGetter(null));
|
||||||
|
ret.addLast(new RealFieldGetter(null));
|
||||||
// ret.addLast(new ModelFieldGetter());
|
// ret.addLast(new ModelFieldGetter());
|
||||||
// ret.addLast(new RecordFieldGetter());
|
// ret.addLast(new RecordFieldGetter());
|
||||||
ret.addLast(new MapFieldGetter());
|
ret.addLast(new MapFieldGetter());
|
||||||
ret.addLast(new RealFieldGetter(null));
|
|
||||||
|
// 挪到第二的位置,addSharedObject(..., modelObj) 用法可以获取到 model 中的 public 属性
|
||||||
|
// ret.addLast(new RealFieldGetter(null));
|
||||||
ret.addLast(new ArrayLengthGetter());
|
ret.addLast(new ArrayLengthGetter());
|
||||||
// ret.addLast(new IsMethodFieldGetter());
|
// ret.addLast(new IsMethodFieldGetter());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user