本文整理了Java中javax.validation.constraints.Min
类的一些代码示例,展示了Min
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Min
类的具体详情如下:
包路径:javax.validation.constraints.Min
类名称:Min
暂无
代码示例来源:origin: prontera/spring-cloud-rest-tcc
private static final long serialVersionUID = -7019570768557438079L;
@NotNull
@NotBlank
@Pattern(regexp = "^\\d{11}$", message = "请输入11位手机号")
@JsonProperty("mobile")
@ApiModelProperty(value = "手机号", example = "18888888888", required = true)
private String mobile;
@NotNull
@Size(min = 6, max = 20, message = "请输入6~20位的密码")
@JsonProperty("login_pwd")
@ApiModelProperty(value = "登录与支付密码", example = "123123123", required = true)
private String loginPwd;
@NotNull
@Min(100L)
@Max(100000000L)
@JsonProperty("balance")
@ApiModelProperty(value = "用户的初始化余额", example = "100000000", required = true)
private Long balance;
代码示例来源:origin: apache/incubator-druid
@JsonProperty
@Min(1)
private int numThreads = Math.max(10, (JvmUtils.getRuntimeInfo().getAvailableProcessors() * 17) / 16 + 2) + 30;
@JsonProperty
@Min(1)
private int queueSize = Integer.MAX_VALUE;
@JsonProperty
private boolean enableRequestLimit = false;
@Min(0)
private long defaultQueryTimeout = TimeUnit.MINUTES.toMillis(5);
@Min(1)
private long maxScatterGatherBytes = Long.MAX_VALUE;
@Min(1)
private long maxQueryTimeout = Long.MAX_VALUE;
@Min(0)
private int inflateBufferSize = DEFAULT_GZIP_INFLATE_BUFFER_SIZE;
@Min(-1)
@Max(9)
private int compressionLevel = Deflater.DEFAULT_COMPRESSION;
代码示例来源:origin: apache/incubator-druid
@JsonProperty
@NotNull
private String ip = DruidNode.getDefaultHost();
@JsonProperty
@NotNull
private String version = "0";
@JsonProperty
@Min(1)
private int capacity = Math.max(1, JvmUtils.getRuntimeInfo().getAvailableProcessors() - 1);
代码示例来源:origin: apache/incubator-druid
/**
*/
public class TopNQueryConfig
{
@JsonProperty
@Min(1)
private int minTopNThreshold = 1000;
public int getMinTopNThreshold()
{
return minTopNThreshold;
}
}
代码示例来源:origin: Graylog2/graylog2-server
@JsonCreator
public static IndexSetSummary create(@JsonProperty("id") @Nullable String id,
@JsonProperty("title") @NotBlank String title,
@JsonProperty("description") @Nullable String description,
@JsonProperty("default") boolean isDefault,
@JsonProperty("writable") boolean isWritable,
@JsonProperty("index_prefix") @Pattern(regexp = IndexSetConfig.INDEX_PREFIX_REGEX) String indexPrefix,
@JsonProperty("shards") @Min(1) int shards,
@JsonProperty("replicas") @Min(0) int replicas,
@JsonProperty("rotation_strategy_class") @NotNull String rotationStrategyClass,
@JsonProperty("rotation_strategy") @NotNull RotationStrategyConfig rotationStrategy,
@JsonProperty("retention_strategy_class") @NotNull String retentionStrategyClass,
@JsonProperty("retention_strategy") @NotNull RetentionStrategyConfig retentionStrategy,
@JsonProperty("creation_date") @NotNull ZonedDateTime creationDate,
@JsonProperty("index_analyzer") @NotBlank String indexAnalyzer,
@JsonProperty("index_optimization_max_num_segments") @Min(1L) int indexOptimizationMaxNumSegments,
@JsonProperty("index_optimization_disabled") boolean indexOptimizationDisabled,
@JsonProperty("field_type_refresh_interval") Duration fieldTypeRefreshInterval) {
return new AutoValue_IndexSetSummary(id, title, description, isDefault, isWritable, indexPrefix, shards, replicas,
rotationStrategyClass, rotationStrategy, retentionStrategyClass, retentionStrategy, creationDate,
indexAnalyzer, indexOptimizationMaxNumSegments, indexOptimizationDisabled, fieldTypeRefreshInterval);
}
代码示例来源:origin: dropwizard/dropwizard
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultServerFactory.class);
@Valid
@NotNull
private List<ConnectorFactory> applicationConnectors = Collections.singletonList(HttpConnectorFactory.application());
@Valid
@NotNull
private List<ConnectorFactory> adminConnectors = Collections.singletonList(HttpConnectorFactory.admin());
@Min(2)
private int adminMaxThreads = 64;
@Min(1)
private int adminMinThreads = 1;
代码示例来源:origin: Graylog2/graylog2-server
@JsonCreator
public static ChangeUserRequest create(@JsonProperty("email") @Nullable @Email String email,
@JsonProperty("full_name") @Nullable String fullName,
@JsonProperty("permissions") @Nullable List<String> permissions,
@JsonProperty("timezone") @Nullable String timezone,
@JsonProperty("startpage") @Nullable @Valid Startpage startpage,
@JsonProperty("session_timeout_ms") @Nullable @Min(1) Long sessionTimeoutMs,
@JsonProperty("roles") @Nullable List<String> roles) {
return new AutoValue_ChangeUserRequest(email, fullName, permissions, timezone, startpage, sessionTimeoutMs, roles);
}
}
代码示例来源:origin: javaee-samples/javaee7-samples
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public void post2(@NotNull @FormParam("name") String name, @Min(1) @Max(10) @FormParam("age") int age) {
}
}
代码示例来源:origin: apache/incubator-druid
@JsonProperty
@Min(1)
private int segmentsPerNode = 50;
@JsonProperty
@Max(1024 * 1024)
@Min(1024)
private long maxBytesPerNode = 512 * 1024;
@JsonProperty
private boolean skipLoadSpec = false;
代码示例来源:origin: prestodb/presto
@NotNull
@Min(1)
public int getCardinalityCacheSize()
{
return cardinalityCacheSize;
}
代码示例来源:origin: forezp/SpringBootLearning
@NotNull
@Size(min=2, max=30)
private String name;
@NotNull
@Min(18)
private Integer age;
代码示例来源:origin: hibernate/hibernate-orm
@Size(max = 2)
public String serial;
@Size(max = 2)
public String name;
public Date expDate;
@Size(min = 0)
public String description;
@Min(1000)
public BigInteger lifetime;
@NotNull
@Valid
public Tuner tuner;
@Valid
public Recorder recorder;
代码示例来源:origin: org.glassfish.admin/config-api
/**
* Gets the value of the maxPendingCount property.
*
* Max no of pending connections on the listen socket
*
* @return possible object is
* {@link String }
*/
@Attribute (defaultValue="4096")
@Min(value=1)
@Max(value=Integer.MAX_VALUE)
String getMaxPendingCount();
代码示例来源:origin: prestodb/presto
@Min(2)
@Max(1000)
public int getMaxOpenSortFiles()
{
return maxOpenSortFiles;
}
代码示例来源:origin: apache/accumulo
@Template(name = "/default.ftl")
public Map<String,Object> getServerActivity(
@QueryParam("shape") @DefaultValue("circles") @Pattern(
regexp = ALPHA_NUM_REGEX_BLANK_OK) String shape,
@QueryParam("size") @DefaultValue("40") @Min(1) @Max(100) int size,
@QueryParam("motion") @DefaultValue("") @Pattern(
regexp = ALPHA_NUM_REGEX_BLANK_OK) String motion,
@QueryParam("color") @DefaultValue("allavg") @Pattern(
regexp = ALPHA_NUM_REGEX_BLANK_OK) String color) {
代码示例来源:origin: prestodb/presto
@Min(1)
public int getFetchSize()
{
return fetchSize;
}
代码示例来源: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()));
if ("integer".equals(property.getType()) || "number".equals(property.getType())) {
Max max = (Max) annos.get("javax.validation.constraints.Max");
property.setMaximum(new BigDecimal(max.value()));
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) {
Pattern pattern = (Pattern) annos.get("javax.validation.constraints.Pattern");
if (property instanceof StringSchema) {
property.setPattern(pattern.regexp());
代码示例来源:origin: com.holon-platform.core/holon-core
getValidationMessage(property, a.message(), Validator.ValidationMessage.NOT_NULL)));
LOGGER.debug(() -> "BeanPropertyBeanValidationPostProcessor: added validator to property ["
+ property + "] for constraint [" + NotNull.class.getName() + "]");
property.validator(Validator.min(Long.valueOf(a.value()).doubleValue(),
getValidationMessage(property, a.message(), Validator.ValidationMessage.MIN)));
LOGGER.debug(
() -> "BeanPropertyBeanValidationPostProcessor: added validator to property [" + property
+ "] for constraint [" + Min.class.getName() + "] with value [" + a.value() + "]");
});
property.getAnnotation(DecimalMin.class).ifPresent(a -> {
property.validator(Validator.min(Integer.valueOf(a.min()).doubleValue(),
getValidationMessage(property, a.message(), Validator.ValidationMessage.MIN)));
property.validator(Validator.max(Integer.valueOf(a.max()).doubleValue(),
getValidationMessage(property, a.message(), Validator.ValidationMessage.MAX)));
LOGGER.debug(() -> "BeanPropertyBeanValidationPostProcessor: added validator to property ["
((Builder) property).validator(Validator.pattern(a.regexp(),
getValidationMessage(property, a.message(), Validator.ValidationMessage.PATTERN),
convertPatternFlags(a.flags())));
LOGGER.debug(() -> "BeanPropertyBeanValidationPostProcessor: added validator to property ["
+ property + "] for constraint [" + Pattern.class.getName() + "] with value [" + a.regexp()
代码示例来源:origin: primefaces/primefaces
if (constraint.annotationType().equals(Size.class)) {
Size size = (Size) constraint;
if (size.max() > 0) {
setMaxlength(input, size.max());
spinner.setMax(max.value());
spinner.setMin(min.value());
代码示例来源:origin: benas/random-beans
maxValue = maxAnnotation.value();
minValue = minAnnotation.value();
内容来源于网络,如有侵权,请联系作者删除!