Browse Source

Merge branch 'master' into jfinal-java8

James 8 years ago
parent
commit
8f76b2e015

+ 4 - 6
src/main/java/com/jfinal/template/ext/extensionmethod/DoubleExt.java

@@ -16,8 +16,6 @@
 
 package com.jfinal.template.ext.extensionmethod;
 
-import com.jfinal.template.expr.ast.Logic;
-
 /**
  * 针对 java.lang.Double 的扩展方法
  * 
@@ -27,19 +25,19 @@ import com.jfinal.template.expr.ast.Logic;
 public class DoubleExt {
 	
 	public Boolean toBoolean(Double self) {
-		return Logic.isTrue(self);
+		return self != 0;
 	}
 	
 	public Integer toInt(Double self) {
-		return self != null ? self.intValue() : null;
+		return self.intValue();
 	}
 	
 	public Long toLong(Double self) {
-		return self != null ? self.longValue() : null;
+		return self.longValue();
 	}
 	
 	public Float toFloat(Double self) {
-		return self != null ? self.floatValue() : null;
+		return self.floatValue();
 	}
 	
 	public Double toDouble(Double self) {

+ 4 - 6
src/main/java/com/jfinal/template/ext/extensionmethod/FloatExt.java

@@ -16,8 +16,6 @@
 
 package com.jfinal.template.ext.extensionmethod;
 
-import com.jfinal.template.expr.ast.Logic;
-
 /**
  * 针对 java.lang.Float 的扩展方法
  * 
@@ -27,15 +25,15 @@ import com.jfinal.template.expr.ast.Logic;
 public class FloatExt {
 	
 	public Boolean toBoolean(Float self) {
-		return Logic.isTrue(self);
+		return self != 0;
 	}
 	
 	public Integer toInt(Float self) {
-		return self != null ? self.intValue() : null;
+		return self.intValue();
 	}
 	
 	public Long toLong(Float self) {
-		return self != null ? self.longValue() : null;
+		return self.longValue();
 	}
 	
 	public Float toFloat(Float self) {
@@ -43,7 +41,7 @@ public class FloatExt {
 	}
 	
 	public Double toDouble(Float self) {
-		return self != null ? self.doubleValue() : null;
+		return self.doubleValue();
 	}
 }
 

+ 4 - 6
src/main/java/com/jfinal/template/ext/extensionmethod/IntegerExt.java

@@ -16,8 +16,6 @@
 
 package com.jfinal.template.ext.extensionmethod;
 
-import com.jfinal.template.expr.ast.Logic;
-
 /**
  * 针对 java.lang.Integer 的扩展方法
  * 
@@ -47,7 +45,7 @@ import com.jfinal.template.expr.ast.Logic;
 public class IntegerExt {
 	
 	public Boolean toBoolean(Integer self) {
-		return Logic.isTrue(self);
+		return self != 0;
 	}
 	
 	public Integer toInt(Integer self) {
@@ -55,15 +53,15 @@ public class IntegerExt {
 	}
 	
 	public Long toLong(Integer self) {
-		return self != null ? self.longValue() : null;
+		return self.longValue();
 	}
 	
 	public Float toFloat(Integer self) {
-		return self != null ? self.floatValue() : null;
+		return self.floatValue();
 	}
 	
 	public Double toDouble(Integer self) {
-		return self != null ? self.doubleValue() : null;
+		return self.doubleValue();
 	}
 }
 

+ 4 - 6
src/main/java/com/jfinal/template/ext/extensionmethod/LongExt.java

@@ -16,8 +16,6 @@
 
 package com.jfinal.template.ext.extensionmethod;
 
-import com.jfinal.template.expr.ast.Logic;
-
 /**
  * 针对 java.lang.Long 的扩展方法
  * 
@@ -27,11 +25,11 @@ import com.jfinal.template.expr.ast.Logic;
 public class LongExt {
 	
 	public Boolean toBoolean(Long self) {
-		return Logic.isTrue(self);
+		return self != 0;
 	}
 	
 	public Integer toInt(Long self) {
-		return self != null ? self.intValue() : null;
+		return self.intValue();
 	}
 	
 	public Long toLong(Long self) {
@@ -39,11 +37,11 @@ public class LongExt {
 	}
 	
 	public Float toFloat(Long self) {
-		return self != null ? self.floatValue() : null;
+		return self.floatValue();
 	}
 	
 	public Double toDouble(Long self) {
-		return self != null ? self.doubleValue() : null;
+		return self.doubleValue();
 	}
 }