當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。