@@ -1388,20 +1388,10 @@ default <T> T get(Class<T> type, int pos) {
1388
1388
throw new IllegalArgumentException ("Accessor type can not be null" );
1389
1389
}
1390
1390
Object value = getValue (pos );
1391
- if (value . getClass () == type ) {
1391
+ if (value != null && type . isAssignableFrom ( value . getClass ()) ) {
1392
1392
return type .cast (value );
1393
- } else {
1394
- try {
1395
- if (value instanceof Buffer ) {
1396
- return type .cast (value );
1397
- } else if (value instanceof Temporal ) {
1398
- return type .cast (value );
1399
- }
1400
- } catch (ClassCastException e ) {
1401
- throw new IllegalArgumentException ("mismatched type [" + type .getName () + "] for the value of type [" + value .getClass ().getName () + "]" );
1402
- }
1403
- throw new IllegalArgumentException ("mismatched type [" + type .getName () + "] for the value of type [" + value .getClass ().getName () + "]" );
1404
1393
}
1394
+ return null ;
1405
1395
}
1406
1396
1407
1397
@ GenIgnore
@@ -1410,11 +1400,10 @@ default <T> T[] getValues(Class<T> type, int pos) {
1410
1400
throw new IllegalArgumentException ("Accessor type can not be null" );
1411
1401
}
1412
1402
Object value = getValue (pos );
1413
- if (value .getClass ().isArray () && value .getClass ().getComponentType () == type ) {
1403
+ if (value != null && value .getClass ().isArray () && type . isAssignableFrom ( value .getClass ().getComponentType ()) ) {
1414
1404
return (T []) value ;
1415
- } else {
1416
- throw new IllegalArgumentException ("mismatched array element type [" + type .getName () + "] for the value of type [" + value .getClass ().getName () + "]" );
1417
1405
}
1406
+ return null ;
1418
1407
}
1419
1408
1420
1409
@ GenIgnore
@@ -1428,7 +1417,7 @@ default <T> Tuple addValues(T[] value) {
1428
1417
int size ();
1429
1418
1430
1419
void clear ();
1431
-
1420
+
1432
1421
/**
1433
1422
* @return A String containing the {@link Object#toString} value of each element,
1434
1423
* separated by a comma (,) character
0 commit comments