DATACMNS-1173 - Fixed value lookup of AnnotationRevisionMetadata.
Fixed handling of absent values. Minor refactorings. More unit tests.
This commit is contained in:
@@ -85,9 +85,9 @@ public class AnnotationRevisionMetadata<N extends Number & Comparable<N>> implem
|
||||
|
||||
return Lazy.of(() -> {
|
||||
|
||||
AnnotationDetectionFieldCallback numberCallback = new AnnotationDetectionFieldCallback(annotationType);
|
||||
ReflectionUtils.doWithFields(entity.getClass(), numberCallback);
|
||||
return numberCallback.getValue(entity);
|
||||
AnnotationDetectionFieldCallback callback = new AnnotationDetectionFieldCallback(annotationType);
|
||||
ReflectionUtils.doWithFields(entity.getClass(), callback);
|
||||
return Optional.ofNullable(callback.getValue(entity));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ public interface RevisionMetadata<N extends Number & Comparable<N>> {
|
||||
* @throws IllegalStateException if no revision number is available.
|
||||
*/
|
||||
default N getRequiredRevisionNumber() {
|
||||
return getRevisionNumber()
|
||||
.orElseThrow(() -> new IllegalStateException(String.format("No revision number found on %s!", getDelegate())));
|
||||
return getRevisionNumber().orElseThrow(
|
||||
() -> new IllegalStateException(String.format("No revision number found on %s!", (Object) getDelegate())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,8 +58,8 @@ public interface RevisionMetadata<N extends Number & Comparable<N>> {
|
||||
* @throw IllegalStateException if no revision date is available.
|
||||
*/
|
||||
default LocalDateTime getRequiredRevisionDate() {
|
||||
return getRevisionDate()
|
||||
.orElseThrow(() -> new IllegalStateException(String.format("No revision date found on %s!", getDelegate())));
|
||||
return getRevisionDate().orElseThrow(
|
||||
() -> new IllegalStateException(String.format("No revision date found on %s!", (Object) getDelegate())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user