本文整理了Java中javax.validation.constraints.Size.max()
方法的一些代码示例,展示了Size.max()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Size.max()
方法的具体详情如下:
包路径:javax.validation.constraints.Size
类名称:Size
方法名:max
暂无
代码示例来源:origin: hibernate/hibernate-orm
private static void applySize(Property property, ConstraintDescriptor<?> descriptor, PropertyDescriptor propertyDescriptor) {
if ( Size.class.equals( descriptor.getAnnotation().annotationType() )
&& String.class.equals( propertyDescriptor.getElementClass() ) ) {
@SuppressWarnings("unchecked")
ConstraintDescriptor<Size> sizeConstraint = (ConstraintDescriptor<Size>) descriptor;
int max = sizeConstraint.getAnnotation().max();
@SuppressWarnings("unchecked")
final Iterator<Selectable> itor = property.getColumnIterator();
if ( itor.hasNext() ) {
final Selectable selectable = itor.next();
Column col = (Column) selectable;
if ( max < Integer.MAX_VALUE ) {
col.setLength( max );
}
}
}
}
代码示例来源:origin: swagger-api/swagger-core
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: primefaces/primefaces
if (constraint.annotationType().equals(Size.class)) {
Size size = (Size) constraint;
if (size.max() > 0) {
setMaxlength(input, 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: org.hibernate/hibernate-annotations
private static void applySize(Property property, ConstraintDescriptor<?> descriptor, PropertyDescriptor propertyDescriptor) {
if ( Size.class.equals( descriptor.getAnnotation().annotationType() )
&& String.class.equals( propertyDescriptor.getElementClass() ) ) {
@SuppressWarnings("unchecked")
ConstraintDescriptor<Size> sizeConstraint = ( ConstraintDescriptor<Size> ) descriptor;
int max = sizeConstraint.getAnnotation().max();
Column col = ( Column ) property.getColumnIterator().next();
if ( max < Integer.MAX_VALUE ) {
col.setLength( max );
}
}
}
代码示例来源:origin: Impetus/Kundera
int maxSize = ((Size) annotate).max();
if (validationObject != 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: 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.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.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: org.hibernate.validator/hibernate-validator
@Override
public void initialize(Size parameters) {
min = parameters.min();
max = parameters.max();
validateParameters();
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
private static void applySize(Property property, ConstraintDescriptor<?> descriptor, PropertyDescriptor propertyDescriptor) {
if ( Size.class.equals( descriptor.getAnnotation().annotationType() )
&& String.class.equals( propertyDescriptor.getElementClass() ) ) {
@SuppressWarnings("unchecked")
ConstraintDescriptor<Size> sizeConstraint = (ConstraintDescriptor<Size>) descriptor;
int max = sizeConstraint.getAnnotation().max();
Column col = (Column) property.getColumnIterator().next();
if ( max < Integer.MAX_VALUE ) {
col.setLength( max );
}
}
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
private static void applySize(PersistentAttributeMapping property, ConstraintDescriptor<?> descriptor, PropertyDescriptor propertyDescriptor) {
if ( Size.class.equals( descriptor.getAnnotation().annotationType() )
&& String.class.equals( propertyDescriptor.getElementClass() ) ) {
@SuppressWarnings("unchecked")
final ConstraintDescriptor<Size> sizeConstraint = (ConstraintDescriptor<Size>) descriptor;
final int max = sizeConstraint.getAnnotation().max();
final Column col = getColumn( property );
if ( max < Integer.MAX_VALUE ) {
col.setLength( (long) max );
}
}
}
代码示例来源: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: ebean-orm/ebean
if (size.max() < Integer.MAX_VALUE) {
maxSize = Math.max(maxSize, size.max());
内容来源于网络,如有侵权,请联系作者删除!