javax.validation.constraints.NotNull类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(516)

本文整理了Java中javax.validation.constraints.NotNull类的一些代码示例,展示了NotNull类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NotNull类的具体详情如下:
包路径:javax.validation.constraints.NotNull
类名称:NotNull

NotNull介绍

暂无

代码示例

代码示例来源:origin: netgloo/spring-boot-samples

@Entity
@Table(name="users")
public class User {
 @Id
 @GeneratedValue(strategy = GenerationType.AUTO)
 private long id;
 @NotNull
 @Size(min = 3, max = 80)
 private String email;
 @NotNull
 @Size(min = 2, max = 80)
 private String name;

代码示例来源:origin: fabric8io/kubernetes-client

@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({
  "apiVersion",
  "kind",
  @NotNull
  @JsonProperty("apiVersion")
  private String apiVersion = "admission.k8s.io/v1beta1";
  @NotNull
  @JsonProperty("kind")
  private String kind = "AdmissionReview";
  @JsonProperty("request")
  @Valid
  private AdmissionRequest request;
  @JsonProperty("response")
  @Valid
  private AdmissionResponse response;
  @JsonIgnore

代码示例来源:origin: signalapp/Signal-Server

public class MessageCacheConfiguration {

 @JsonProperty
 @NotNull
 @Valid
 private RedisConfiguration redis;

 @JsonProperty
 private int persistDelayMinutes = 10;

 public RedisConfiguration getRedisConfiguration() {
  return redis;
 }

 public int getPersistDelayMinutes() {
  return persistDelayMinutes;
 }

}

代码示例来源:origin: apache/incubator-druid

/**
 */
public class ConfigManagerConfig
{
 @JsonProperty
 @NotNull
 private Period pollDuration = new Period("PT1M");

 public Period getPollDuration()
 {
  return pollDuration;
 }
}

代码示例来源:origin: prontera/spring-cloud-rest-tcc

/**
 * @author Zhao Junjian
 */
@Getter
@Setter
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"}, ignoreUnknown = true)
public class LoginRequest extends RestfulRequest {

  private static final long serialVersionUID = -3286520204644035655L;

  @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;

}

代码示例来源:origin: hibernate/hibernate-orm

@Entity
public class C {
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Id
  Long id;
  @NotNull
  String name;

代码示例来源:origin: joelittlejohn/jsonschema2pojo

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
  "post_office_box",
  "extended_address",
public class Address {
  @NotNull
  @JsonProperty("locality")
  private String locality;
  @NotNull
  @JsonProperty("region")
  private String region;
  @NotNull
  @JsonProperty("country_name")
  private String countryName;
  @JsonProperty("address")
  @Valid
  private List<Object> address = new ArrayList<Object>();
  @JsonIgnore
  @Valid
  private Map<String, Object> additionalProperties = new HashMap<String, Object>();

代码示例来源:origin: prontera/spring-cloud-rest-tcc

/**
 * @author Zhao Junjian
 */
@Getter
@Setter
@AllArgsConstructor
@ToString
@EqualsAndHashCode
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"}, ignoreUnknown = true)
public class TccRequest implements Serializable {

  private static final long serialVersionUID = 1847362921754190531L;

  @Valid
  @NotNull
  @Size(min = 1)
  @ApiModelProperty(value = "参与方提供的链接集合", required = true)
  private List<Participant> participantLinks;

}

代码示例来源:origin: cloudfoundry/uaa

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class IdentityZone {
  @NotNull
  private String subdomain;
  @NotNull
  private String name;
  @JsonProperty("last_modified")
  private Date lastModified = new Date();

代码示例来源:origin: spring-projects/spring-framework

public class BeanWithMapEntryConstraint {
  @Valid
  private Map<@NotNull String, @NotNull String> property;
  public Map<String, String> getProperty() {
    return property;
  }
  public void setProperty(Map<String, String> property) {
    this.property = property;
  }
}

代码示例来源:origin: Graylog2/graylog2-server

@JsonProperty("node_name")
@NotNull
@Size(min = 1)
public abstract String nodeName();

代码示例来源:origin: szerhusenBC/jwt-spring-security-demo

@Entity
@Table(name = "AUTHORITY")
public class Authority {
  @NotNull
  @Enumerated(EnumType.STRING)
  private AuthorityName name;

代码示例来源:origin: torodb/stampede

@Description("config.pool")
@JsonPropertyOrder({"connectionPoolTimeout", "connectionPoolSize"})
public class Pool implements ConnectionPoolConfig {
 @NotNull
 @JsonProperty(required = true)
 private Long connectionPoolTimeout = 10L * 1000;
 @Description("config.generic.connectionPoolSize")
 @NotNull
 @Min(20)
 @JsonProperty(required = true)
 private Integer connectionPoolSize = 30;
 @NotNull
 @Min(1)
 @JsonIgnore

代码示例来源:origin: dzinot/spring-boot-oauth2-jwt

/**
 * 
 * <h2>Permission</h2>
 * 
 * @author Kristijan Georgiev
 * 
 *         Permission entity
 *
 */

@Entity
@Setter
@Getter
@NoArgsConstructor
public class Permission extends BaseIdEntity {

  private static final long serialVersionUID = 1L;

  @NotNull
  @Size(min = 1, max = 60)
  private String name;

}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * @author Emmanuel Bernard
 */
@Entity
public class Rock extends Music {
  @NotNull
  public Integer bit;
}

代码示例来源:origin: prestodb/presto

@NotNull
@Size(min = 1)
public List<ServerAddress> getSeeds()
{
  return seeds;
}

代码示例来源:origin: spring-projects/spring-framework

private static class SimpleBean {
  @NotNull
  private final String name;
  public SimpleBean(String name) {
    this.name = name;
  }
  @SuppressWarnings("unused")
  public String getName() {
    return name;
  }
}

代码示例来源:origin: Netflix/conductor

/**
 *
 * @param workflowDefList Workflow definitions to be updated.
 */
void updateWorkflowDef(@NotNull(message = "WorkflowDef list name cannot be null or empty")
            @Size(min=1, message = "WorkflowDefList is empty")
                List<@NotNull(message = "WorkflowDef cannot be null") @Valid WorkflowDef> workflowDefList);

代码示例来源:origin: com.haulmont.cuba/cuba-global

if (notNull != null) {
  if (isDefinedForDefaultValidationGroup(notNull)) {
    metaProperty.getAnnotations().put(NotNull.class.getName() + VALIDATION_NOTNULL_MESSAGE, notNull.message());
    metaProperty.getAnnotations().put(NotNull.class.getName() + VALIDATION_NOTNULL_MESSAGE, notNull.message());
    metaProperty.getAnnotations().put(NotNull.class.getName() + VALIDATION_NOTNULL_UI_COMPONENT, true);
  metaProperty.getAnnotations().put(Size.class.getName() + VALIDATION_MIN, size.min());
  metaProperty.getAnnotations().put(Size.class.getName() + VALIDATION_MAX, size.max());

代码示例来源:origin: ebean-orm/ebean

if (notNull != null && isEbeanValidationGroups(notNull.groups())) {
  if (size.max() < Integer.MAX_VALUE) {
   maxSize = Math.max(maxSize, size.max());

相关文章