Skip to content

Commit 802e8dc

Browse files
committed
Drop deprecated methods.
1 parent 4b4b132 commit 802e8dc

7 files changed

Lines changed: 6 additions & 306 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
subprojects {
1616
group = 'org.httprpc'
17-
version = '5.3.6'
17+
version = '5.4'
1818

1919
repositories {
2020
mavenCentral()

kilo-client/src/main/java/org/httprpc/kilo/beans/BeanAdapter.java

Lines changed: 0 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -668,129 +668,6 @@ public static <T> T coerce(Object value, Class<T> type) {
668668
return (T)coerceGeneric(value, type);
669669
}
670670

671-
/**
672-
* Coerces a collection to a list.
673-
*
674-
* @param <E>
675-
* The target element type.
676-
*
677-
* @param collection
678-
* The collection to coerce.
679-
*
680-
* @param elementType
681-
* The target element type.
682-
*
683-
* @return
684-
* The coerced list.
685-
*
686-
* @deprecated
687-
* This method will be removed in a future release. Use streams instead.
688-
*/
689-
@Deprecated
690-
@SuppressWarnings("unchecked")
691-
public static <E> List<E> coerceList(Collection<?> collection, Class<E> elementType) {
692-
return (List<E>)coerceGeneric(collection, new ParameterizedType() {
693-
@Override
694-
public Type[] getActualTypeArguments() {
695-
return new Type[] {elementType};
696-
}
697-
698-
@Override
699-
public Type getRawType() {
700-
return List.class;
701-
}
702-
703-
@Override
704-
public Type getOwnerType() {
705-
return null;
706-
}
707-
});
708-
}
709-
710-
/**
711-
* Coerces a map to a given type.
712-
*
713-
* @param <K>
714-
* The target key type.
715-
*
716-
* @param <V>
717-
* The target value type.
718-
*
719-
* @param map
720-
* The map to coerce.
721-
*
722-
* @param keyType
723-
* The target key type.
724-
*
725-
* @param valueType
726-
* The target value type.
727-
*
728-
* @return
729-
* The coerced map.
730-
*
731-
* @deprecated
732-
* This method will be removed in a future release. Use streams instead.
733-
*/
734-
@Deprecated
735-
@SuppressWarnings("unchecked")
736-
public static <K, V> Map<K, V> coerceMap(Map<?, ?> map, Class<K> keyType, Class<V> valueType) {
737-
return (Map<K, V>)coerceGeneric(map, new ParameterizedType() {
738-
@Override
739-
public Type[] getActualTypeArguments() {
740-
return new Type[] {keyType, valueType};
741-
}
742-
743-
@Override
744-
public Type getRawType() {
745-
return Map.class;
746-
}
747-
748-
@Override
749-
public Type getOwnerType() {
750-
return null;
751-
}
752-
});
753-
}
754-
755-
/**
756-
* Coerces a collection to a set.
757-
*
758-
* @param <E>
759-
* The target element type.
760-
*
761-
* @param collection
762-
* The collection to coerce.
763-
*
764-
* @param elementType
765-
* The target element type.
766-
*
767-
* @return
768-
* The coerced set.
769-
*
770-
* @deprecated
771-
* This method will be removed in a future release. Use streams instead.
772-
*/
773-
@Deprecated
774-
@SuppressWarnings("unchecked")
775-
public static <E> Set<E> coerceSet(Collection<?> collection, Class<E> elementType) {
776-
return (Set<E>)coerceGeneric(collection, new ParameterizedType() {
777-
@Override
778-
public Type[] getActualTypeArguments() {
779-
return new Type[] {elementType};
780-
}
781-
782-
@Override
783-
public Type getRawType() {
784-
return Set.class;
785-
}
786-
787-
@Override
788-
public Type getOwnerType() {
789-
return null;
790-
}
791-
});
792-
}
793-
794671
/**
795672
* Converts a value to a generic type.
796673
*

kilo-client/src/main/java/org/httprpc/kilo/sql/QueryBuilder.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -406,26 +406,6 @@ private static Function<Object, Object> getReadTransform(Method accessor) {
406406
}
407407
}
408408

409-
/**
410-
* Appends a "join" clause linking the most recently joined type to another
411-
* type.
412-
*
413-
* @param parentType
414-
* The type representing both the table to join and the table that defines
415-
* the primary key.
416-
*
417-
* @return
418-
* The {@link QueryBuilder} instance.
419-
*
420-
* @deprecated
421-
* This method will be removed in a future release. Use
422-
* {@link #join(Class, Class)} instead.
423-
*/
424-
@Deprecated
425-
public QueryBuilder join(Class<?> parentType) {
426-
return join(parentType, parentType);
427-
}
428-
429409
/**
430410
* Appends a "join" clause linking the most recently joined type to another
431411
* type.

kilo-client/src/main/java/org/httprpc/kilo/sql/ResultSetAdapter.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import java.util.Map;
2323
import java.util.NoSuchElementException;
2424
import java.util.function.Function;
25-
import java.util.stream.Stream;
26-
import java.util.stream.StreamSupport;
2725

2826
/**
2927
* Provides access to the contents of a JDBC result set via the
@@ -148,25 +146,4 @@ public Iterator<Map<String, Object>> iterator() {
148146
public void close() throws SQLException {
149147
resultSet.close();
150148
}
151-
152-
/**
153-
* Returns a stream over the results.
154-
*
155-
* @return
156-
* A stream over the results.
157-
*
158-
* @deprecated
159-
* This method will be removed in a future release. Use
160-
* {@link org.httprpc.kilo.util.stream.Streams#streamOf(Iterable)} instead.
161-
*/
162-
@Deprecated
163-
public Stream<Map<String, Object>> stream() {
164-
return StreamSupport.stream(spliterator(), false).onClose(() -> {
165-
try {
166-
close();
167-
} catch (SQLException exception) {
168-
throw new RuntimeException(exception);
169-
}
170-
});
171-
}
172149
}

kilo-client/src/test/java/org/httprpc/kilo/beans/BeanAdapterTest.java

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929
import java.time.LocalDateTime;
3030
import java.time.LocalTime;
3131
import java.time.Period;
32-
import java.util.ArrayList;
3332
import java.util.Date;
3433
import java.util.HashMap;
35-
import java.util.HashSet;
3634
import java.util.List;
3735
import java.util.Map;
3836
import java.util.Set;
@@ -279,151 +277,23 @@ public void testPathCoercion() {
279277
}
280278

281279
@Test
282-
@SuppressWarnings("deprecation")
283280
public void testListCoercion() {
284-
assertEquals(listOf(
285-
1,
286-
2,
287-
3
288-
), BeanAdapter.coerceList(listOf(
289-
"1",
290-
"2",
291-
"3"
292-
), Integer.class));
293-
294-
assertNull(BeanAdapter.coerceList(null, Object.class));
295-
296281
assertInstanceOf(List.class, BeanAdapter.coerce(listOf(), List.class));
297282
assertThrows(IllegalArgumentException.class, () -> BeanAdapter.coerce(123, List.class));
298283
}
299284

300285
@Test
301-
@SuppressWarnings("deprecation")
302286
public void testMapCoercion() {
303-
assertEquals(mapOf(
304-
entry("a", 1.0),
305-
entry("b", 2.0),
306-
entry("c", 3.0)
307-
), BeanAdapter.coerceMap(mapOf(
308-
entry("a", "1.0"),
309-
entry("b", "2.0"),
310-
entry("c", "3.0")
311-
), String.class, Double.class));
312-
313-
assertEquals(mapOf(
314-
entry(1, 1.0),
315-
entry(2, 2.0),
316-
entry(3, 3.0)
317-
), BeanAdapter.coerceMap(mapOf(
318-
entry("1", "1.0"),
319-
entry("2", "2.0"),
320-
entry("3", "3.0")
321-
), Integer.class, Double.class));
322-
323-
assertNull(BeanAdapter.coerceMap(null, Object.class, Object.class));
324-
325287
assertInstanceOf(Map.class, BeanAdapter.coerce(mapOf(), Map.class));
326288
assertThrows(IllegalArgumentException.class, () -> BeanAdapter.coerce(123, Map.class));
327289
}
328290

329291
@Test
330-
@SuppressWarnings("deprecation")
331292
public void testSetCoercion() {
332-
assertEquals(setOf(
333-
1,
334-
2,
335-
3
336-
), BeanAdapter.coerceSet(setOf(
337-
"1",
338-
"2",
339-
"3"
340-
), Integer.class));
341-
342-
assertNull(BeanAdapter.coerceSet(null, Object.class));
343-
344293
assertInstanceOf(Set.class, BeanAdapter.coerce(setOf(), Set.class));
345294
assertThrows(IllegalArgumentException.class, () -> BeanAdapter.coerce(123, Set.class));
346295
}
347296

348-
@Test
349-
@SuppressWarnings("deprecation")
350-
public void testMutableListCoercion() {
351-
var strings = new ArrayList<String>();
352-
353-
strings.add("1");
354-
strings.add("2");
355-
strings.add("3");
356-
strings.add(null);
357-
358-
var integers = BeanAdapter.coerceList(strings, Integer.class);
359-
360-
assertEquals(listOf(1, 2, 3, null), integers);
361-
362-
integers.set(1, 4);
363-
364-
assertEquals(listOf(1, 4, 3, null), integers);
365-
366-
integers.remove(1);
367-
368-
assertEquals(listOf(1, 3, null), integers);
369-
}
370-
371-
@Test
372-
@SuppressWarnings("deprecation")
373-
public void testMutableMapCoercion() {
374-
var strings = new HashMap<Integer, String>();
375-
376-
strings.put(1, "1.0");
377-
strings.put(2, "2.0");
378-
strings.put(3, "3.0");
379-
strings.put(4, null);
380-
381-
var doubles = BeanAdapter.coerceMap(strings, Integer.class, Double.class);
382-
383-
assertEquals(mapOf(
384-
entry(1, 1.0),
385-
entry(2, 2.0),
386-
entry(3, 3.0),
387-
entry(4, null)
388-
), doubles);
389-
390-
doubles.put(2, 4.0);
391-
392-
assertEquals(mapOf(
393-
entry(1, 1.0),
394-
entry(2, 4.0),
395-
entry(3, 3.0),
396-
entry(4, null)
397-
), doubles);
398-
399-
doubles.remove(2);
400-
401-
assertEquals(mapOf(
402-
entry(1, 1.0),
403-
entry(3, 3.0),
404-
entry(4, null)
405-
), doubles);
406-
}
407-
408-
@Test
409-
@SuppressWarnings("deprecation")
410-
public void testMutableSetCoercion() {
411-
var strings = new HashSet<>();
412-
413-
strings.add("1");
414-
strings.add("2");
415-
strings.add("3");
416-
strings.add(null);
417-
418-
var integers = BeanAdapter.coerceSet(strings, Integer.class);
419-
420-
assertEquals(setOf(1, 2, 3, null), integers);
421-
422-
integers.remove(2);
423-
424-
assertEquals(setOf(1, 3, null), integers);
425-
}
426-
427297
@Test
428298
public void testInterfaceCoercion() {
429299
var map = new HashMap<String, Object>();

kilo-client/src/test/java/org/httprpc/kilo/sql/QueryBuilderTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,10 @@ public void testSelectDtoA() {
335335
}
336336

337337
@Test
338-
@SuppressWarnings("deprecation")
339338
public void testSelectIHGF() {
340339
var queryBuilder = QueryBuilder.select(I.class, H.class, G.class)
341-
.join(H.class)
342-
.join(G.class)
340+
.join(H.class, H.class)
341+
.join(G.class, G.class)
343342
.filterByForeignKey(G.class, F.class, "f")
344343
.ordered(true);
345344

0 commit comments

Comments
 (0)