Skip to content

Commit 999fd35

Browse files
authored
Merge pull request #622 from OmniFish-EE/ondromih-jnosql-contributions-main
Expose some private methods to extensions
2 parents 5218f65 + c2d4daf commit 999fd35

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
2222

2323
- Include support to Restriction interface
2424
- Include support to record projector
25+
- Support named query parameters in JDQL
2526
- Include Contains restriction keyword
2627
- Include EndsWith restriction keyword
2728
- Include StartsWith restriction keyword
29+
- Include IgnoreCase restriction keyword
2830

2931
== [1.1.9] - 2025-07-30
3032

jnosql-communication/jnosql-communication-semistructured/src/main/java/org/eclipse/jnosql/communication/semistructured/CriteriaCondition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2024,2025 Contributors to the Eclipse Foundation
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* and Apache License v2.0 which accompanies this distribution.

jnosql-mapping/jnosql-mapping-core/src/main/java/org/eclipse/jnosql/mapping/core/query/AbstractRepositoryProxy.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ public Object invoke(Object instance, Method method, Object[] params) throws Thr
156156

157157
RepositoryType type = RepositoryType.of(method, repositoryType());
158158

159+
return invokeForMethodType(type, instance, method, params);
160+
}
161+
162+
/**
163+
* This method allows overriding and intercepting repository method invocation in children
164+
* @param type Type of the method executed on the repository
165+
* @param instance See {@link #invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])}
166+
* @param method See {@link #invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])}
167+
* @param params See {@link #invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])}
168+
* @return See {@link #invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])}
169+
* @throws Throwable See {@link #invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])}
170+
*/
171+
protected Object invokeForMethodType(RepositoryType type, Object instance, Method method, Object[] params) throws Throwable {
159172
switch (type) {
160173
case DEFAULT -> {
161174
return unwrapInvocationTargetException(() -> method.invoke(repository(), params));
@@ -182,7 +195,7 @@ public Object invoke(Object instance, Method method, Object[] params) throws Thr
182195
return unwrapInvocationTargetException(() -> InvocationHandler.invokeDefault(instance, method, params));
183196
}
184197
case QUERY -> {
185-
return unwrapInvocationTargetException(() -> executeQuery(instance, method, params));
198+
return unwrapInvocationTargetException(() -> executeQuery(instance, method, params));
186199
}
187200
case PARAMETER_BASED -> {
188201
return unwrapInvocationTargetException(() -> executeParameterBased(instance, method, params));
@@ -229,4 +242,5 @@ protected Object unwrapInvocationTargetException(ThrowingSupplier<Object> suppli
229242
throw ex.getCause();
230243
}
231244
}
245+
232246
}

jnosql-mapping/jnosql-mapping-core/src/main/java/org/eclipse/jnosql/mapping/core/repository/DynamicReturn.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public Page<T> getPage() {
207207
/**
208208
* @return check if there is pagination
209209
*/
210-
boolean hasPagination() {
210+
public boolean hasPagination() {
211211
return pageRequest != null;
212212
}
213213

jnosql-mapping/jnosql-mapping-semistructured/src/main/java/org/eclipse/jnosql/mapping/semistructured/query/AbstractSemiStructuredRepositoryProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private Restriction<?> restriction(Object[] params) {
199199
}
200200
}
201201

202-
private static List<Sort<?>> getSorts(Method method, EntityMetadata metadata) {
202+
protected static List<Sort<?>> getSorts(Method method, EntityMetadata metadata) {
203203
return Stream.of(method.getAnnotationsByType(OrderBy.class))
204204
.map(order -> {
205205
String column = metadata.columnField(order.value());

jnosql-mapping/jnosql-mapping-semistructured/src/main/java/org/eclipse/jnosql/mapping/semistructured/query/SemiStructuredRepositoryProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public SemiStructuredRepositoryProxy(SemiStructuredTemplate template,
6868
this.entitiesMetadata = entities;
6969
}
7070

71-
SemiStructuredRepositoryProxy(SemiStructuredTemplate template,
71+
protected SemiStructuredRepositoryProxy(SemiStructuredTemplate template,
7272
EntityMetadata metadata, Class<?> typeClass,
7373
Converters converters,
7474
EntitiesMetadata entities) {

0 commit comments

Comments
 (0)