public class MoreValidate
extends org.apache.commons.lang3.Validate
com.google.common.base.Preconditions , 一是少打几个字而已, 二是Validate的方法多,比如noNullElements()判断多个元素都不为空
目前主要参考 com.google.common.math.MathPreconditions , 补充数字为正数或非负数的校验| Constructor and Description |
|---|
MoreValidate() |
| Modifier and Type | Method and Description |
|---|---|
static double |
nonNegative(String role,
double x)
校验为非负数则返回该数字,否则抛出异常.
|
static int |
nonNegative(String role,
int x)
校验为非负数则返回该数字,否则抛出异常.
|
static Integer |
nonNegative(String role,
Integer x)
校验为非负数则返回该数字,否则抛出异常.
|
static long |
nonNegative(String role,
long x)
校验为非负数则返回该数字,否则抛出异常.
|
static Long |
nonNegative(String role,
Long x)
校验为非负数则返回该数字,否则抛出异常.
|
static double |
positive(String role,
double x)
校验为正数则返回该数字,否则抛出异常.
|
static int |
positive(String role,
int x)
校验为正数则返回该数字,否则抛出异常.
|
static Integer |
positive(String role,
Integer x)
校验为正数则返回该数字,否则抛出异常.
|
static long |
positive(String role,
long x)
校验为正数则返回该数字,否则抛出异常.
|
static Long |
positive(String role,
Long x)
校验为正数则返回该数字,否则抛出异常.
|
exclusiveBetween, exclusiveBetween, exclusiveBetween, exclusiveBetween, exclusiveBetween, exclusiveBetween, finite, finite, inclusiveBetween, inclusiveBetween, inclusiveBetween, inclusiveBetween, inclusiveBetween, inclusiveBetween, isAssignableFrom, isAssignableFrom, isInstanceOf, isInstanceOf, isTrue, isTrue, isTrue, isTrue, matchesPattern, matchesPattern, noNullElements, noNullElements, noNullElements, noNullElements, notBlank, notBlank, notEmpty, notEmpty, notEmpty, notEmpty, notEmpty, notEmpty, notEmpty, notEmpty, notNaN, notNaN, notNull, notNull, validIndex, validIndex, validIndex, validIndex, validIndex, validIndex, validState, validStatepublic static int positive(String role, int x)
public static long positive(String role, long x)
public static double positive(String role, double x)
public static int nonNegative(String role, int x)
public static long nonNegative(String role, long x)
public static double nonNegative(String role, double x)
Copyright © 2018. All rights reserved.