-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7515e51
commit 5300eb3
Showing
10 changed files
with
78 additions
and
154 deletions.
There are no files selected for viewing
15 changes: 0 additions & 15 deletions
15
src/main/java/fr/ouestfrance/querydsl/model/FieldMetadata.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/fr/ouestfrance/querydsl/service/ext/ReflectUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package fr.ouestfrance.querydsl.service.ext; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
import lombok.SneakyThrows; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Internal reflect class that allow to retrieve object | ||
*/ | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
final class ReflectUtils { | ||
|
||
|
||
/** | ||
* Get safe value for a field | ||
* | ||
* @param field to retrieve data | ||
* @param object source object | ||
* @return optional value | ||
*/ | ||
@SneakyThrows | ||
@SuppressWarnings("java:S3011") | ||
public static Optional<Object> getObject(Field field, Object object) { | ||
// allow to access the field if record or field from clazz | ||
field.setAccessible(true); | ||
return Optional.ofNullable(field.get(object)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 0 additions & 53 deletions
53
src/main/java/fr/ouestfrance/querydsl/utils/ReflectUtils.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
src/test/java/fr/ouestfrance/querydsl/utils/ReflectUtilsTest.java
This file was deleted.
Oops, something went wrong.