Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does QueryDSL's PathBuilder's validate() do?

QueryDSL documentation is unfortunately quite lacking. For many of the methods I've had to either dig deep into grepcode or to track down any source code online that uses the methods of interest to try to figure out how they're using it.

So what does QueryDSL's PathBuilder's validate() do?

like image 673
Michael Tontchev Avatar asked Mar 20 '26 21:03

Michael Tontchev


1 Answers

PathBuilder provides a pluggable validation mechanism for property creation. You can inject a PathBuilderValidator via the constructor. The default validator passes every property.

In action this means that pathBuilder.get("name") will have Object by default, String for a String typed field using PathBuilderValidator.FIELDS and String for a String typed property using PathBuilderValidator.PROPERTIES.

Apologies for the limited documentation. That will be improved with the 4.0.0 release.

https://github.com/querydsl/querydsl/blob/e4b20fc15a6b6d8108ccfdf5cb22df47f929e5e7/querydsl-core/src/main/java/com/querydsl/core/types/path/PathBuilderValidator.java

like image 141
Timo Westkämper Avatar answered Mar 23 '26 11:03

Timo Westkämper