Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
33ac50cc
Commit
33ac50cc
authored
Mar 29, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除处理
parent
3dbe6c70
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
CheckerHelper.java
.../main/java/com/yanzuoguang/util/helper/CheckerHelper.java
+20
-1
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/CheckerHelper.java
View file @
33ac50cc
...
@@ -14,6 +14,7 @@ import java.util.regex.Pattern;
...
@@ -14,6 +14,7 @@ import java.util.regex.Pattern;
*/
*/
public
final
class
CheckerHelper
{
public
final
class
CheckerHelper
{
public
static
final
String
PARAM_NOT_NULL_TIPS
=
"param [%s] is null"
;
public
static
final
String
PARAM_NOT_NULL_TIPS
=
"param [%s] is null"
;
public
static
final
String
PARAM_NOT_EMPTY_TIPS
=
"param [%s] is empty"
;
public
static
final
String
PARAM_NOT_NUMBER
=
"param [%s] must be number"
;
public
static
final
String
PARAM_NOT_NUMBER
=
"param [%s] must be number"
;
public
static
final
String
PARAM_OVER_MAX_LENGTH
=
"param [%s] maxlength is "
;
public
static
final
String
PARAM_OVER_MAX_LENGTH
=
"param [%s] maxlength is "
;
...
@@ -51,12 +52,30 @@ public final class CheckerHelper {
...
@@ -51,12 +52,30 @@ public final class CheckerHelper {
* @param paramVal
* @param paramVal
* @return
* @return
*/
*/
public
CheckerHelper
notNull
(
String
paramName
,
Object
paramVal
)
{
if
(!
isValid
())
{
return
this
;
}
if
(
paramVal
==
null
)
{
this
.
checkResult
=
String
.
format
(
PARAM_NOT_NULL_TIPS
,
paramName
);
this
.
setValid
(
false
);
}
return
this
;
}
/**
* 非空检查,包括空字符串
*
* @param paramName
* @param paramVal
* @return
*/
public
CheckerHelper
notBlankCheck
(
String
paramName
,
Object
paramVal
)
{
public
CheckerHelper
notBlankCheck
(
String
paramName
,
Object
paramVal
)
{
if
(!
isValid
())
{
if
(!
isValid
())
{
return
this
;
return
this
;
}
}
if
(
StringHelper
.
isEmpty
(
paramVal
))
{
if
(
StringHelper
.
isEmpty
(
paramVal
))
{
this
.
checkResult
=
String
.
format
(
PARAM_NOT_
NULL
_TIPS
,
paramName
);
this
.
checkResult
=
String
.
format
(
PARAM_NOT_
EMPTY
_TIPS
,
paramName
);
this
.
setValid
(
false
);
this
.
setValid
(
false
);
}
}
return
this
;
return
this
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment