本文整理了Java中javax.validation.constraints.Min.value()
方法的一些代码示例,展示了Min.value()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Min.value()
方法的具体详情如下:
包路径:javax.validation.constraints.Min
类名称:Min
方法名:value
暂无
代码示例来源:origin: hibernate/hibernate-orm
private static void applyMin(Property property, ConstraintDescriptor<?> descriptor, Dialect dialect) {
if ( Min.class.equals( descriptor.getAnnotation().annotationType() ) ) {
@SuppressWarnings("unchecked")
ConstraintDescriptor<Min> minConstraint = (ConstraintDescriptor<Min>) descriptor;
long min = minConstraint.getAnnotation().value();
@SuppressWarnings("unchecked")
final Iterator<Selectable> itor = property.getColumnIterator();
if ( itor.hasNext() ) {
final Selectable selectable = itor.next();
if ( Column.class.isInstance( selectable ) ) {
Column col = (Column) selectable;
String checkConstraint = col.getQuotedName(dialect) + ">=" + min;
applySQLCheck( col, checkConstraint );
}
}
}
}
代码示例来源:origin: swagger-api/swagger-core
if ("integer".equals(property.getType()) || "number".equals(property.getType())) {
Min min = (Min) annos.get("javax.validation.constraints.Min");
property.setMinimum(new BigDecimal(min.value()));
代码示例来源:origin: primefaces/primefaces
spinner.setMin(min.value());
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public final void initialize(Min constraintAnnotation) {
min = constraintAnnotation.value();
}
代码示例来源:origin: org.hibernate/hibernate-annotations
private static void applyMin(Property property, ConstraintDescriptor<?> descriptor) {
if ( Min.class.equals( descriptor.getAnnotation().annotationType() ) ) {
@SuppressWarnings( "unchecked" )
ConstraintDescriptor<Min> minConstraint = (ConstraintDescriptor<Min>) descriptor;
long min = minConstraint.getAnnotation().value();
Column col = (Column) property.getColumnIterator().next();
col.setCheckConstraint( col.getName() + ">=" + min );
}
}
代码示例来源:origin: benas/random-beans
minValue = minAnnotation.value();
代码示例来源:origin: Impetus/Kundera
/**
* Checks whether a given value is greater than given min value or not
*
* @param validationObject
* @param annotate
* @return
*/
private boolean validateMinValue(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true;
}
Long minValue = ((Min) annotate).value();
if (checkvalidDigitTypes(validationObject.getClass()))
{
if ((NumberUtils.toLong(toString(validationObject))) < minValue)
{
throwValidationException(((Min) annotate).message());
}
}
return true;
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
@Override
public void initialize(Min maxValue) {
this.minValue = maxValue.value();
}
代码示例来源:origin: org.apache.bval/bval-jsr
@Override
public void initialize(Min annotation) {
this.minValue = annotation.value();
}
代码示例来源:origin: org.minijax/minijax-validator
@Override
public boolean isValid(final Number value, final ConstraintValidatorContext context) {
return value == null || value.longValue() >= min.value();
}
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
@Override
public void initialize(Min minValue) {
this.minValue = BigDecimal.valueOf( minValue.value() );
}
代码示例来源:origin: org.hibernate.validator/hibernate-validator
@Override
public void initialize(Min minValue) {
this.minValue = BigDecimal.valueOf( minValue.value() );
}
代码示例来源:origin: org.glassfish.main.common/amx-core
public Long min()
{
final Min min = mMethod.getAnnotation(Min.class);
if (min != null)
{
return min.value();
}
final long[] minMax = minMaxFromDataType(attribute().dataType());
return minMax == null ? null : minMax[0];
}
代码示例来源:origin: com.fasterxml.jackson.module/jackson-module-jsonSchema
@Override
public Double getNumberMinimum(BeanProperty prop) {
Min minAnnotation = prop.getAnnotation(Min.class);
if (minAnnotation != null) {
return (double) minAnnotation.value();
}
DecimalMin decimalMinAnnotation = prop.getAnnotation(DecimalMin.class);
return decimalMinAnnotation != null ? new BigDecimal(decimalMinAnnotation.value()).doubleValue() : null;
}
代码示例来源:origin: FasterXML/jackson-module-jsonSchema
@Override
public Double getNumberMinimum(BeanProperty prop) {
Min minAnnotation = prop.getAnnotation(Min.class);
if (minAnnotation != null) {
return (double) minAnnotation.value();
}
DecimalMin decimalMinAnnotation = prop.getAnnotation(DecimalMin.class);
return decimalMinAnnotation != null ? new BigDecimal(decimalMinAnnotation.value()).doubleValue() : null;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
private static void applyMin(Property property, ConstraintDescriptor<?> descriptor, Dialect dialect) {
if ( Min.class.equals( descriptor.getAnnotation().annotationType() ) ) {
@SuppressWarnings("unchecked")
ConstraintDescriptor<Min> minConstraint = (ConstraintDescriptor<Min>) descriptor;
long min = minConstraint.getAnnotation().value();
Column col = (Column) property.getColumnIterator().next();
String checkConstraint = col.getQuotedName(dialect) + ">=" + min;
applySQLCheck( col, checkConstraint );
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
private static void applyMin(Property property, ConstraintDescriptor<?> descriptor, Dialect dialect) {
if ( Min.class.equals( descriptor.getAnnotation().annotationType() ) ) {
@SuppressWarnings("unchecked")
ConstraintDescriptor<Min> minConstraint = (ConstraintDescriptor<Min>) descriptor;
long min = minConstraint.getAnnotation().value();
Column col = (Column) property.getColumnIterator().next();
String checkConstraint = col.getQuotedName(dialect) + ">=" + min;
applySQLCheck( col, checkConstraint );
}
}
代码示例来源:origin: fr.putnami.pwt/pwt
private void appendMinValidator(SourceWriter w, JField field) {
Min minAnnotation = field.getAnnotation(Min.class);
if (minAnnotation != null) {
w.println(", new MinValidator(\"%s\", %s)", minAnnotation.message(), minAnnotation.value());
}
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
private static void applyMin(PersistentAttributeMapping property, ConstraintDescriptor<?> descriptor, Dialect dialect) {
if ( Min.class.equals( descriptor.getAnnotation().annotationType() ) ) {
@SuppressWarnings("unchecked")
final ConstraintDescriptor<Min> minConstraint = (ConstraintDescriptor<Min>) descriptor;
final long min = minConstraint.getAnnotation().value();
final Column col = getColumn( property );
final String checkConstraint = col.getQuotedName(dialect) + ">=" + min;
applySQLCheck( col, checkConstraint );
}
}
代码示例来源:origin: cloudera/cm_ext
@Test
public void testFindAnnotationMethod() {
assertEquals(3l,
ReflectionHelper.findAnnotation(childABar, Min.class).value());
assertNull(ReflectionHelper.findAnnotation(childABar, Max.class));
assertEquals(4l,
ReflectionHelper.findAnnotation(childAFoo, Max.class).value());
}
内容来源于网络,如有侵权,请联系作者删除!