本文整理了Java中javax.validation.constraints.Size.min()
方法的一些代码示例,展示了Size.min()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Size.min()
方法的具体详情如下:
包路径:javax.validation.constraints.Size
类名称:Size
方法名:min
暂无
代码示例来源:origin: swagger-api/swagger-core
Size size = (Size) annos.get("javax.validation.constraints.Size");
if ("integer".equals(property.getType()) || "number".equals(property.getType())) {
property.setMinimum(new BigDecimal(size.min()));
property.setMaximum(new BigDecimal(size.max()));
} else if (property instanceof StringSchema) {
StringSchema sp = (StringSchema) property;
sp.minLength(new Integer(size.min()));
sp.maxLength(new Integer(size.max()));
} else if (property instanceof ArraySchema) {
ArraySchema sp = (ArraySchema) property;
sp.setMinItems(size.min());
sp.setMaxItems(size.max());
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public final void initialize(Size annotation) {
if (!(annotation.min() >= 0)) {
throw new IllegalArgumentException(
"@Size.min must be a nonnegative nubmer");
}
if (!(annotation.max() >= 0)) {
throw new IllegalArgumentException(
"@Size.max must be a nonnegative nubmer");
}
if (!(annotation.min() <= annotation.max())) {
throw new IllegalArgumentException(
"@Size.min must be less than or equal to @Size.max");
}
min = annotation.min();
max = annotation.max();
}
代码示例来源:origin: benas/random-beans
@Override
public Randomizer<?> getRandomizer(Field field) {
Class<?> fieldType = field.getType();
Size sizeAnnotation = ReflectionUtils
.getAnnotation(field, Size.class);
final int min = sizeAnnotation.min();
final int max = sizeAnnotation.max();
if (fieldType.equals(String.class)) {
return new StringRandomizer(charset, min, max, random.nextLong());
}
return null;
}
}
代码示例来源:origin: Impetus/Kundera
int minSize = ((Size) annotate).min();
int maxSize = ((Size) annotate).max();
if (validationObject != null)
代码示例来源:origin: com.fasterxml.jackson.module/jackson-module-jsonSchema
private Integer getMinSize(BeanProperty prop) {
Size ann = getSizeAnnotation(prop);
if (ann != null) {
int value = ann.min();
if (value != 0) {
return value;
}
}
return null;
}
代码示例来源:origin: org.minijax/minijax-validator
@Override
public boolean isValid(final Object value, final ConstraintValidatorContext context) {
if (value == null) {
return true;
}
final int length = Array.getLength(value);
return length >= size.min() && length <= size.max();
}
}
代码示例来源:origin: org.minijax/minijax-validator
@Override
public boolean isValid(final Map<?, ?> value, final ConstraintValidatorContext context) {
return value == null || (value.size() >= size.min() && value.size() <= size.max());
}
}
代码示例来源:origin: canoo/dolphin-platform
@Override
public void initialize(Size constraintAnnotation) {
this.minSizeValue = constraintAnnotation.min();
this.maxSizeValue = constraintAnnotation.max();
}
代码示例来源:origin: FasterXML/jackson-module-jsonSchema
private Integer getMinSize(BeanProperty prop) {
Size ann = getSizeAnnotation(prop);
if (ann != null) {
int value = ann.min();
if (value != 0) {
return value;
}
}
return null;
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
@Override
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
@Override
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator
@Override
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator
@Override
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: theonedev/onedev
public boolean isPropertyRequired() {
return getPropertyGetter().getReturnType().isPrimitive()
|| getPropertyGetter().getAnnotation(NotNull.class) != null
|| getPropertyGetter().getAnnotation(NotEmpty.class) != null
|| getPropertyGetter().getAnnotation(Size.class) != null && getPropertyGetter().getAnnotation(Size.class).min()>=1;
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
@Override
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
@Override
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.hibernate-validator
@Override
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: apache/wicket
@Override
public void modify(FormComponent<?> component, ComponentTag tag, Size annotation)
{
if (hasLengthAttribute(tag.getName()))
{
tag.put("maxlength", annotation.max());
if (annotation.min() > 0)
{
tag.put("minlength", annotation.min());
}
}
}
代码示例来源:origin: Putnami/putnami-web-toolkit
private void appendSizeValidator(SourceWriter w, JField field) {
Size sizeAnnotation = field.getAnnotation(Size.class);
if (sizeAnnotation != null) {
w.println(", new SizeValidator(\"%s\", %s, %s)", sizeAnnotation.message(), sizeAnnotation.min(),
sizeAnnotation.max());
}
}
内容来源于网络,如有侵权,请联系作者删除!