jsr

Adding @NotNull or Pattern constraints on List<String>

[亡魂溺海] 提交于 2019-12-12 12:02:06
问题 How can we ensure the individual strings inside a list are not null/blank or follow a specific pattern @NotNull List<String> emailIds; I also want to add a pattern @Pattern("\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b.") but I can live without it.But I would definitely like to have a constraint which will check if any strings inside a list are null or blank. Also how would the Json schema look like "ids": { "description": "The ids associated with this.", "type": "array", "minItems": 1, "items"

Compile Error: JSR/RET are not supported with computeFrames option

孤人 提交于 2019-12-08 19:12:13
问题 Getting this error on an IntelliJ project when I compile java files. There is no specific source file listed, but it fails with this error. Removing the following compiler flags fixes the error: -source 1.5 -target 1.5 However, these need to be in there as we are targeting Java 5. Is there some specific code (maybe a try/catch block) that is causing this error? 2013-10-15 16:21:50,556 [26947209] INFO - ompiler.BackendCompilerWrapper - JSR/RET are not supported with computeFrames option java

JSR - 349 bean validation for Spring @RestController with Spring Boot

回眸只為那壹抹淺笑 提交于 2019-12-04 13:42:35
问题 I am using Spring Boot 1.5.2.RELEASE and not able to incorporate JSR - 349 ( bean validation 1.1 ) for @RequestParam & @PathVariable at method itself. For POST requests, if method parameter is a Java POJO then annotating that parameter with @Valid is working fine but annotating @RequestParam & @PathVariable with something like @NotEmpty , @Email not working. I have annotated controller class with Spring's @Validated There are lots of questions on SO and I have commented on this answer that

How to implement a JSR Specification

匆匆过客 提交于 2019-12-04 03:51:21
I'm considering implementing one or two JSR APIs. I have not yet read the entire specification (the plan is to read them as I code the implementation) but I am very familiar with them. I have read that the JSR process includes implementing a Test Compatibility Kit (TCK) for testing said JSR implementations. Before I start writing a bunch of unit tests to verify the correctness/completeness of my implementation I would really like to use this TCK but I have no idea if it is available for me. After downloading all files and googling around I could not find anything that could be defined as a TCK

What does the jsr keyword mean?

巧了我就是萌 提交于 2019-12-04 03:29:46
问题 I'm looking at some Java code, and I've noticed the following: if (!foo(bar, baz, qux)) { i = 0; jsr 433; } javac chokes on it, saying it's not a statement and that a semicolon is expected after the keyword jsr . I did some Googling, and I found some code containing the same thing, which leads me to believe it's there intentionally (even though they weren't able to get it to compile either). So what does jsr do? How does one get code containing it to compile? 回答1: I'm close to sure that this

Spring Boot JSR-303/349 configuration

梦想的初衷 提交于 2019-12-03 08:11:29
In my Spring Boot 1.5.1 application I'm trying to configure support of JSR-303 / JSR-349 validation. I have added a following annotations @NotNull @Size(min = 1) to my method: @Service @Transactional public class DecisionDaoImpl extends BaseDao implements DecisionDao { @Override public Decision create(@NotNull @Size(min = 1) String name, String description, String url, String imageUrl, Decision parentDecision, Tenant tenant, User user) { ... } } I'm trying to invoke this method from my test, but it does not fail on the validation constraints. This is my test and configs: @SpringBootTest

JSR - 349 bean validation for Spring @RestController with Spring Boot

。_饼干妹妹 提交于 2019-12-03 07:46:54
I am using Spring Boot 1.5.2.RELEASE and not able to incorporate JSR - 349 ( bean validation 1.1 ) for @RequestParam & @PathVariable at method itself. For POST requests, if method parameter is a Java POJO then annotating that parameter with @Valid is working fine but annotating @RequestParam & @PathVariable with something like @NotEmpty , @Email not working. I have annotated controller class with Spring's @Validated There are lots of questions on SO and I have commented on this answer that its not working for me. Spring Boot includes - validation-api-1.1.0.Final.jar and hibernate-validator-5.3

Validate only if the field is not Null

百般思念 提交于 2019-12-01 08:24:12
I use JSR303 Spring Validation and I have the following; @Digits(fraction = 0, integer = 15) private String tpMobile; Validation says Must be number between 10-15 digits , but the thing is this field is optional . So when user left it empty also the same error message shows. So what I want to do is validate only if the field is not empty. If the field is empty skip validating that field Instead of using @Digit , I would like to suggest you to use @Pattern(message="YOUR_MESSAGE", regexp="REGULAR_EXPRESSION") Main reason is that we show message for such set of values for which we want to

Validate only if the field is not Null

廉价感情. 提交于 2019-12-01 06:06:46
问题 I use JSR303 Spring Validation and I have the following; @Digits(fraction = 0, integer = 15) private String tpMobile; Validation says Must be number between 10-15 digits , but the thing is this field is optional . So when user left it empty also the same error message shows. So what I want to do is validate only if the field is not empty. If the field is empty skip validating that field 回答1: Instead of using @Digit , I would like to suggest you to use @Pattern(message="YOUR_MESSAGE", regexp=

Are Project Coin's collection enhancements going to be in JDK8? [closed]

落花浮王杯 提交于 2019-11-30 22:31:16
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Initially Project Coin had enhanced support for collections e.g. list[3] instead of list.get(3) and map["hello"] = 27 instead of map