当前位置: 首页>>代码示例>>Java>>正文


Java Range类代码示例

本文整理汇总了Java中org.hibernate.validator.constraints.Range的典型用法代码示例。如果您正苦于以下问题:Java Range类的具体用法?Java Range怎么用?Java Range使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Range类属于org.hibernate.validator.constraints包,在下文中一共展示了Range类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkNumberInputType

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
private void checkNumberInputType(Field field) {
	if("number".equals(type)){
		Min min = field.getAnnotation(Min.class);
		if(min != null){
			this.min = min.value();
		}
		Max max = field.getAnnotation(Max.class);
		if(max != null){
			this.max = max.value();
		}
		Range range = field.getAnnotation(Range.class);
		if(range != null){
			this.min = range.min();
			this.max = range.max();
		}
	}
}
 
开发者ID:qlefevre,项目名称:crud-admin-spring-boot-starter,代码行数:18,代码来源:CrudAdminObjectField.java

示例2: getValidator

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
private static Optional<Validator> getValidator(Annotation annotation) {
	Validator validator = null;

	if (isValidable(annotation)) {
		if (annotation instanceof Range || annotation instanceof Length) {
			validator = new RangeValidator(annotation);
		} else if (annotation instanceof Pattern) {
			validator = new PatternValidator(annotation);
		} else {
			validator = new DefaultValidator(annotation);
		}
	}
	return Optional.ofNullable(validator);
}
 
开发者ID:damianwajser,项目名称:spring-rest-commons-options,代码行数:15,代码来源:ValidatorFactory.java

示例3: readAll

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@GET @Produces(MediaType.APPLICATION_JSON)
public Response readAll(
    @NotEmptyButNull @QueryParam("last_id") String lastId,
    @Range(min = 1, max = Globals.MAX_SIZE) @DefaultValue("20") @QueryParam("size") int size) {

    RebaseAsserts.existCategory(category);
    List<Document> feeds = new ArrayList<>();
    List<Bson> filters = new ArrayList<>();
    if (lastId != null) {
        filters.add(lt(Feed._ID, objectId(lastId)));
    }
    filters.add(eq(Feed.CATEGORY, category));
    filters.add(eq(Feed.OWNER, owner));
    MongoDBs.feeds().find().sort(descending(Feed._ID))
        .filter(and(filters))
        .limit(size)
        .into(feeds);
    return Response.ok(feeds).build();
}
 
开发者ID:drakeet,项目名称:rebase-server,代码行数:20,代码来源:FeedResource.java

示例4: testRange

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@Test
public void testRange() {
	Set<ConstraintViolation<ObjectWithValidation>> violations = validator.validate(obj, Range.class);
	assertNotNull(violations);
	assertEquals(violations.size(), 1);

	if (runPeformance) {
		long time = System.currentTimeMillis();
		for (int index = 0; index < 10000; index++) {
			validator.validate(obj, Range.class);
		}
		long used = System.currentTimeMillis() - time;
		System.out.println("Hibernate Validator [Range] check used " + used + "ms, avg. " + ((double) used) / 10000
				+ "ms.");
	}
}
 
开发者ID:bradwoo8621,项目名称:nest-old,代码行数:17,代码来源:TestObject.java

示例5: getId

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "QUESTION_ID_SEQ")
@SequenceGenerator(name = "QUESTION_ID_SEQ", sequenceName = "QUESTION_ID_SEQ")
@Range(min = 1l, max = 999999999l, message = RANGE)
@Column(name = "ID")
public Integer getId() {
    return id;
}
 
开发者ID:vhontar,项目名称:WebBoxter,代码行数:9,代码来源:QuestionEntity.java

示例6: getId

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ANSWER_ID_SEQ")
@SequenceGenerator(name = "ANSWER_ID_SEQ", sequenceName = "ANSWER_ID_SEQ")
@Range(min = 1l, max = 999999999l, message = RANGE)
@Column(name = "ID", unique = true, length = 9)
public Integer getId() {
    return id;
}
 
开发者ID:vhontar,项目名称:WebBoxter,代码行数:9,代码来源:AnswerEntity.java

示例7: getQos

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@Range(min = 0, max = 2)
public int getQos() {
	return this.qos;
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:mqtt,代码行数:5,代码来源:MqttSinkProperties.java

示例8: getMaxPriority

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@Range(min = 0, max = 255)
public Integer getMaxPriority() {
	return this.maxPriority;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-rabbit,代码行数:5,代码来源:RabbitCommonProperties.java

示例9: getPort

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@Range(min = 0, max = 65535)
public int getPort() {
	return this.port;
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:cassandra,代码行数:5,代码来源:CassandraProperties.java

示例10: getSequence

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@Column(nullable = false)
@Range(min = 1)
public int getSequence() {
    return sequence;
}
 
开发者ID:caeos,项目名称:coner-core,代码行数:6,代码来源:RunHibernateEntity.java

示例11: getPorta

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@Range(min = 2, max = 5)
public Integer getPorta() {
	return porta;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:5,代码来源:VeiculoVO.java

示例12: getAge

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
/**
 * @return the age
 */
@Range(min = 10)
public int getAge() {
	return age;
}
 
开发者ID:bradwoo8621,项目名称:nest-old,代码行数:8,代码来源:Worker.java

示例13: getSchema_version

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
@NotNull
@Range(min = 1, max = 1)
Integer getSchema_version();
 
开发者ID:cloudera,项目名称:cm_ext,代码行数:4,代码来源:ParcelDescriptor.java

示例14: getAutoConfigShare

import org.hibernate.validator.constraints.Range; //导入依赖的package包/类
/**
 * During autoconfiguration for RM, the share dictates the percentage of the
 * role's overall memory allotment that should be set aside for this memory
 * quantity.
 * <p>
 * If null, parameter is not autoconfigured for RM.
 */
@Range(min = 0, max = 100)
Integer getAutoConfigShare();
 
开发者ID:cloudera,项目名称:cm_ext,代码行数:10,代码来源:MemoryParameter.java


注:本文中的org.hibernate.validator.constraints.Range类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。