Skip to content

Commit e2f3adc

Browse files
committed
remove deprecated methods made obsolete by Map.of()
1 parent dd858e3 commit e2f3adc

File tree

4 files changed

+2
-66
lines changed

4 files changed

+2
-66
lines changed

hibernate-core/src/main/java/org/hibernate/NaturalIdLoadAccess.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,6 @@ default NaturalIdLoadAccess<T> withLoadGraph(RootGraph<T> graph) {
138138
*/
139139
NaturalIdLoadAccess<T> using(Map<String,?> mappings);
140140

141-
/**
142-
* Set multiple {@link org.hibernate.annotations.NaturalId @NaturalId}
143-
* attribute values at once. An even number of arguments is expected,
144-
* with each attribute name followed by its value, for example:
145-
* <pre>
146-
* Book book =
147-
* session.byNaturalId(Book.class)
148-
* .using(Book_.ISBN, isbn, Book_.PRINTING, printing)
149-
* .load();
150-
* </pre>
151-
*
152-
* @return {@code this}, for method chaining
153-
*
154-
* @deprecated use {@link #using(Map)} with {@link Map#of}, which is
155-
* slightly more typesafe
156-
*/
157-
@Deprecated(since = "6.3", forRemoval = true)
158-
NaturalIdLoadAccess<T> using(Object... mappings);
159-
160141
/**
161142
* Determines if cached natural id cross-references are synchronized
162143
* before query execution with unflushed modifications made in memory

hibernate-core/src/main/java/org/hibernate/NaturalIdMultiLoadAccess.java

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
*/
55
package org.hibernate;
66

7-
import java.util.HashMap;
8-
import java.util.List;
9-
import java.util.Map;
10-
117
import org.hibernate.graph.GraphSemantic;
128
import org.hibernate.graph.RootGraph;
13-
import org.hibernate.internal.util.collections.CollectionHelper;
9+
10+
import java.util.List;
1411

1512
/**
1613
* Loads multiple instances of a given entity type at once, by
@@ -174,27 +171,4 @@ default NaturalIdMultiLoadAccess<T> with(RootGraph<T> graph) {
174171
* @return The managed entities.
175172
*/
176173
List<T> multiLoad(List<?> ids);
177-
178-
/**
179-
* Helper for creating a {@link Map} that represents the value of a
180-
* composite natural id. An even number of arguments is expected,
181-
* with each attribute name followed by its value.
182-
*
183-
* @see NaturalIdLoadAccess#using(Object...)
184-
*
185-
* @deprecated use {@link Map#of} instead
186-
*/
187-
@Deprecated(since = "6.3", forRemoval = true)
188-
static Map<String,?> compoundValue(Object... elements) {
189-
assert elements != null;
190-
assert elements.length % 2 == 0;
191-
192-
final HashMap<String, Object> map = new HashMap<>();
193-
CollectionHelper.collectMapEntries( map::put, elements );
194-
for ( int i = 0; i < elements.length; i += 2 ) {
195-
map.put( (String) elements[ i ], (Object) elements[ i+1 ] );
196-
}
197-
198-
return map;
199-
}
200174
}

hibernate-core/src/main/java/org/hibernate/internal/util/collections/CollectionHelper.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import java.util.Properties;
1717
import java.util.Set;
1818
import java.util.concurrent.ConcurrentHashMap;
19-
import java.util.function.BiConsumer;
2019
import java.util.function.Function;
2120

2221
import static java.util.Arrays.asList;
@@ -377,17 +376,6 @@ public static <V> List<V> toSmallList(ArrayList<V> arrayList) {
377376
}
378377
}
379378

380-
@Deprecated(forRemoval = true)
381-
@SuppressWarnings( "unchecked" )
382-
public static <K,V> void collectMapEntries(BiConsumer<K, V> mapEntryConsumer, Object[] mappings) {
383-
// even numbered
384-
assert mappings.length % 2 == 0;
385-
386-
for ( int i = 0; i < mappings.length; i += 2 ) {
387-
mapEntryConsumer.accept( (K) mappings[i], (V) mappings[i+1] );
388-
}
389-
}
390-
391379
public static <O> List<O> combine(List<O> list1, List<O> list2) {
392380
final ArrayList<O> combined = arrayList( list1.size() + list2.size() );
393381
combined.addAll( list1 );

hibernate-core/src/main/java/org/hibernate/loader/internal/NaturalIdLoadAccessImpl.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.hibernate.NaturalIdLoadAccess;
1414
import org.hibernate.graph.GraphSemantic;
1515
import org.hibernate.graph.RootGraph;
16-
import org.hibernate.internal.util.collections.CollectionHelper;
1716
import org.hibernate.metamodel.mapping.EntityMappingType;
1817

1918
/**
@@ -49,12 +48,6 @@ public NaturalIdLoadAccess<T> using(Map<String, ?> mappings) {
4948
return this;
5049
}
5150

52-
@Override @Deprecated(forRemoval = true)
53-
public NaturalIdLoadAccess<T> using(Object... mappings) {
54-
CollectionHelper.collectMapEntries( naturalIdParameters::put, mappings );
55-
return this;
56-
}
57-
5851
@Override
5952
public NaturalIdLoadAccessImpl<T> setSynchronizationEnabled(boolean synchronizationEnabled) {
6053
super.synchronizationEnabled( synchronizationEnabled );

0 commit comments

Comments
 (0)