@@ -534,41 +534,11 @@ private TypeInformation<?> getTypeArgument(Class<?> bound, int index) {
534
534
}
535
535
536
536
protected boolean isMapBaseType () {
537
- return isBaseType (MAP_TYPES );
538
- }
539
-
540
- private boolean isBaseType (Class <?>[] candidates ) {
541
-
542
- Class <S > type = getType ();
543
-
544
- for (Class <?> candidate : candidates ) {
545
- if (candidate .equals (type )) {
546
- return true ;
547
- }
548
- }
549
-
550
- return false ;
537
+ return isOneOf (MAP_TYPES );
551
538
}
552
539
553
540
protected Class <?> getMapBaseType () {
554
- return getBaseType (MAP_TYPES );
555
- }
556
-
557
- private Class <?> getBaseType (Class <?>[] candidates ) {
558
-
559
- Class <S > type = getType ();
560
-
561
- for (Class <?> candidate : candidates ) {
562
- if (candidate .isAssignableFrom (type )) {
563
- return candidate ;
564
- }
565
- }
566
-
567
- throw new IllegalArgumentException (String .format ("Type %s not contained in candidates %s!" , type , candidates ));
568
- }
569
-
570
- private boolean isNullableWrapper () {
571
- return NullableWrapperConverters .supports (getType ());
541
+ return getSuperTypeWithin (MAP_TYPES );
572
542
}
573
543
574
544
/*
@@ -630,6 +600,52 @@ private boolean isCollection() {
630
600
return false ;
631
601
}
632
602
603
+ /**
604
+ * Returns whether the current's raw type is one of the given ones.
605
+ *
606
+ * @param candidates must not be {@literal null}.
607
+ * @return
608
+ */
609
+ private boolean isOneOf (Class <?>[] candidates ) {
610
+
611
+ Assert .notNull (candidates , "Candidates must not be null!" );
612
+
613
+ Class <S > type = getType ();
614
+
615
+ for (Class <?> candidate : candidates ) {
616
+ if (candidate .equals (type )) {
617
+ return true ;
618
+ }
619
+ }
620
+
621
+ return false ;
622
+ }
623
+
624
+ /**
625
+ * Returns the super type of the current raw type from the given candidates.
626
+ *
627
+ * @param candidates must not be {@literal null}.
628
+ * @return
629
+ */
630
+ private Class <?> getSuperTypeWithin (Class <?>[] candidates ) {
631
+
632
+ Assert .notNull (candidates , "Candidates must not be null!" );
633
+
634
+ Class <S > type = getType ();
635
+
636
+ for (Class <?> candidate : candidates ) {
637
+ if (candidate .isAssignableFrom (type )) {
638
+ return candidate ;
639
+ }
640
+ }
641
+
642
+ throw new IllegalArgumentException (String .format ("Type %s not contained in candidates %s!" , type , candidates ));
643
+ }
644
+
645
+ private boolean isNullableWrapper () {
646
+ return NullableWrapperConverters .supports (getType ());
647
+ }
648
+
633
649
/**
634
650
* A synthetic {@link ParameterizedType}.
635
651
*
0 commit comments