forked from nutzam/nutz
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
提供一些比较傲容易实例化的 Region,同时为 Json 增加一个强制输出字符串的功能
- Loading branch information
Showing
12 changed files
with
307 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.nutz.lang.util; | ||
|
||
import java.util.Date; | ||
|
||
import org.nutz.lang.Strings; | ||
import org.nutz.lang.Times; | ||
|
||
public class DateRegion extends Region<Date> { | ||
|
||
public DateRegion() { | ||
super(); | ||
} | ||
|
||
public DateRegion(String str) { | ||
super(); | ||
this.valueOf(str); | ||
} | ||
|
||
public Date fromString(String str) { | ||
str = Strings.trim(str); | ||
if (Strings.isEmpty(str)) | ||
return null; | ||
return Times.D(str); | ||
} | ||
|
||
public String toString(Date d) { | ||
String str = Times.sDT(d); | ||
if (str.endsWith(" 00:00:00")) | ||
return str.substring(0, 10); | ||
return str; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.nutz.lang.util; | ||
|
||
public class DoubleRegion extends Region<Double> { | ||
|
||
public DoubleRegion() { | ||
super(); | ||
} | ||
|
||
public DoubleRegion(String str) { | ||
super(); | ||
this.valueOf(str); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.nutz.lang.util; | ||
|
||
public class FloatRegion extends Region<Float> { | ||
|
||
public FloatRegion() { | ||
super(); | ||
} | ||
|
||
public FloatRegion(String str) { | ||
super(); | ||
this.valueOf(str); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.nutz.lang.util; | ||
|
||
public class IntRegion extends Region<Integer> { | ||
|
||
public IntRegion() { | ||
super(); | ||
} | ||
|
||
public IntRegion(String str) { | ||
super(); | ||
this.valueOf(str); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.nutz.lang.util; | ||
|
||
public class LongRegion extends Region<Long> { | ||
|
||
public LongRegion() { | ||
super(); | ||
} | ||
|
||
public LongRegion(String str) { | ||
super(); | ||
this.valueOf(str); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.