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
ac8c15a8
Commit
ac8c15a8
authored
Mar 31, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载视频
parent
6eb0e06d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
CheckerHelper.java
.../main/java/com/yanzuoguang/util/helper/CheckerHelper.java
+69
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/CheckerHelper.java
View file @
ac8c15a8
...
@@ -475,6 +475,75 @@ public final class CheckerHelper {
...
@@ -475,6 +475,75 @@ public final class CheckerHelper {
return
this
;
return
this
;
}
}
/**
* 检测最小值是否大于等于0,默认为0
*
* @param paramName 参数名称
* @param paramVal 参数值
* @return
*/
public
CheckerHelper
checkMin
(
String
paramName
,
double
paramVal
)
{
return
checkMin
(
paramName
,
0
,
paramVal
);
}
/**
* 检测最小值是否大于等于0,默认为0
*
* @param paramName 参数名称
* @param paramVal 参数值
* @param min 最小值
* @return
*/
public
CheckerHelper
checkMin
(
String
paramName
,
double
min
,
double
paramVal
)
{
if
(!
isValid
())
{
return
this
;
}
if
(
paramVal
<
min
)
{
this
.
checkResult
=
language
.
format
(
PARAM_NOT_MIN
,
paramName
,
min
);
this
.
setValid
(
false
);
}
return
this
;
}
/**
* 检测最大值
*
* @param paramName 参数名称
* @param paramVal 参数值
* @param max 最大值
* @return
*/
public
CheckerHelper
checkMax
(
String
paramName
,
double
max
,
double
paramVal
)
{
if
(!
isValid
())
{
return
this
;
}
if
(
paramVal
>
max
)
{
this
.
checkResult
=
language
.
format
(
PARAM_NOT_MAX
,
paramName
,
max
);
this
.
setValid
(
false
);
}
return
this
;
}
/**
* 检测最大值
*
* @param paramName 参数名称
* @param paramVal 参数值
* @param min 最小值
* @param max 最大值
* @return
*/
public
CheckerHelper
checkRange
(
String
paramName
,
double
min
,
double
max
,
double
paramVal
)
{
if
(!
isValid
())
{
return
this
;
}
if
(
paramVal
>
max
||
paramVal
<
min
)
{
this
.
checkResult
=
language
.
format
(
PARAM_NOT_RANGE
,
paramName
,
min
,
max
);
this
.
setValid
(
false
);
}
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