Revision 45540
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java | ||
---|---|---|
359 | 359 |
} |
360 | 360 |
|
361 | 361 |
@Override |
362 |
public boolean getBooleanOrDefault(String name, boolean defaultValue) { |
|
363 |
int index = this.data.getType().getIndex(name); |
|
364 |
if( index < 0 ) { |
|
365 |
return defaultValue; |
|
366 |
} |
|
367 |
try { |
|
368 |
return this.getBoolean(index); |
|
369 |
} catch(Throwable th) { |
|
370 |
return defaultValue; |
|
371 |
} |
|
372 |
} |
|
373 |
|
|
374 |
@Override |
|
362 | 375 |
public int getIntOrDefault(String name, int defaultValue) { |
363 | 376 |
int index = this.data.getType().getIndex(name); |
364 | 377 |
if( index < 0 ) { |
365 | 378 |
return defaultValue; |
366 | 379 |
} |
367 | 380 |
try { |
368 |
return (int) this.get(index);
|
|
381 |
return this.getInt(index);
|
|
369 | 382 |
} catch(Throwable th) { |
370 | 383 |
return defaultValue; |
371 | 384 |
} |
... | ... | |
378 | 391 |
return defaultValue; |
379 | 392 |
} |
380 | 393 |
try { |
381 |
return (long) this.get(index);
|
|
394 |
return this.getLong(index);
|
|
382 | 395 |
} catch(Throwable th) { |
383 | 396 |
return defaultValue; |
384 | 397 |
} |
... | ... | |
391 | 404 |
return defaultValue; |
392 | 405 |
} |
393 | 406 |
try { |
394 |
return (float) this.get(index);
|
|
407 |
return this.getFloat(index);
|
|
395 | 408 |
} catch(Throwable th) { |
396 | 409 |
return defaultValue; |
397 | 410 |
} |
... | ... | |
404 | 417 |
return defaultValue; |
405 | 418 |
} |
406 | 419 |
try { |
407 |
return (double) this.get(index);
|
|
420 |
return this.getDouble(index);
|
|
408 | 421 |
} catch(Throwable th) { |
409 | 422 |
return defaultValue; |
410 | 423 |
} |
... | ... | |
417 | 430 |
return defaultValue; |
418 | 431 |
} |
419 | 432 |
try { |
420 |
return (BigDecimal) this.get(index);
|
|
433 |
return this.getDecimal(index);
|
|
421 | 434 |
} catch(Throwable th) { |
422 | 435 |
return defaultValue; |
423 | 436 |
} |
... | ... | |
430 | 443 |
return defaultValue; |
431 | 444 |
} |
432 | 445 |
try { |
433 |
return (Date) this.get(index);
|
|
446 |
return this.getDate(index);
|
|
434 | 447 |
} catch(Throwable th) { |
435 | 448 |
return defaultValue; |
436 | 449 |
} |
... | ... | |
454 | 467 |
return defaultValue; |
455 | 468 |
} |
456 | 469 |
try { |
457 |
return (String) this.get(index);
|
|
470 |
return this.getString(index);
|
|
458 | 471 |
} catch(Throwable th) { |
459 | 472 |
return defaultValue; |
460 | 473 |
} |
461 | 474 |
} |
462 | 475 |
|
463 | 476 |
@Override |
477 |
public boolean getBooleanOrDefault(int index, boolean defaultValue) { |
|
478 |
if( index < 0 || index >= this.data.getType().size() ) { |
|
479 |
return defaultValue; |
|
480 |
} |
|
481 |
try { |
|
482 |
return this.getBoolean(index); |
|
483 |
} catch(Throwable th) { |
|
484 |
return defaultValue; |
|
485 |
} |
|
486 |
} |
|
487 |
|
|
488 |
|
|
489 |
@Override |
|
464 | 490 |
public int getIntOrDefault(int index, int defaultValue) { |
465 | 491 |
if( index < 0 || index >= this.data.getType().size() ) { |
466 | 492 |
return defaultValue; |
467 | 493 |
} |
468 | 494 |
try { |
469 |
return (int) this.get(index);
|
|
495 |
return this.getInt(index);
|
|
470 | 496 |
} catch(Throwable th) { |
471 | 497 |
return defaultValue; |
472 | 498 |
} |
... | ... | |
478 | 504 |
return defaultValue; |
479 | 505 |
} |
480 | 506 |
try { |
481 |
return (long) this.get(index);
|
|
507 |
return this.getLong(index);
|
|
482 | 508 |
} catch(Throwable th) { |
483 | 509 |
return defaultValue; |
484 | 510 |
} |
... | ... | |
490 | 516 |
return defaultValue; |
491 | 517 |
} |
492 | 518 |
try { |
493 |
return (float) this.get(index);
|
|
519 |
return this.getFloat(index);
|
|
494 | 520 |
} catch(Throwable th) { |
495 | 521 |
return defaultValue; |
496 | 522 |
} |
... | ... | |
502 | 528 |
return defaultValue; |
503 | 529 |
} |
504 | 530 |
try { |
505 |
return (double) this.get(index);
|
|
531 |
return this.getDouble(index);
|
|
506 | 532 |
} catch(Throwable th) { |
507 | 533 |
return defaultValue; |
508 | 534 |
} |
... | ... | |
514 | 540 |
return defaultValue; |
515 | 541 |
} |
516 | 542 |
try { |
517 |
return (BigDecimal) this.get(index);
|
|
543 |
return this.getDecimal(index);
|
|
518 | 544 |
} catch(Throwable th) { |
519 | 545 |
return defaultValue; |
520 | 546 |
} |
... | ... | |
526 | 552 |
return defaultValue; |
527 | 553 |
} |
528 | 554 |
try { |
529 |
return (Date) this.get(index);
|
|
555 |
return this.getDate(index);
|
|
530 | 556 |
} catch(Throwable th) { |
531 | 557 |
return defaultValue; |
532 | 558 |
} |
... | ... | |
881 | 907 |
} |
882 | 908 |
|
883 | 909 |
@Override |
884 |
public double getDoubleOrDefault(String name, double defaultValue) { |
|
885 |
int index = this.data.getType().getIndex(name); |
|
886 |
if( index < 0 ) { |
|
887 |
return defaultValue; |
|
888 |
} |
|
889 |
try { |
|
890 |
return (double) this.get(index); |
|
891 |
} catch(Throwable th) { |
|
892 |
return defaultValue; |
|
893 |
} |
|
894 |
} |
|
895 |
|
|
896 |
@Override |
|
897 | 910 |
public byte getByte(String name) { |
898 | 911 |
return this.getByte(this.data.getType().getIndex(name)); |
899 | 912 |
} |
Also available in: Unified diff