Subversion Repository Public Repository

litesoft

Diff Revisions 862 vs 864 for /trunk/Java/core/Anywhere/src/org/litesoft/core/util/TypeConverter.java

Diff revisions: vs.
  @@ -391,10 +391,6 @@
391 391 {
392 392 return (CalendarY) pObject;
393 393 }
394 - if ( pObject instanceof CalendarAccessorY )
395 - {
396 - return new CalendarY( (CalendarAccessorY) pObject );
397 - }
398 394 RuntimeException zProblem = null;
399 395 try
400 396 {
  @@ -480,71 +476,27 @@
480 476 {
481 477 return null;
482 478 }
483 - // TODO: XXX
484 - // if ( pObject instanceof Date )
485 - // {
486 - // return new CalendarY( (Date) pObject );
487 - // }
488 - // if ( pObject instanceof Number )
489 - // {
490 - // return new CalendarY( new Date( ((Number) pObject).longValue() ) );
491 - // }
492 - // String s = pObject.toString();
493 - // try
494 - // {
495 - // return new CalendarY( new Date( Long.parseLong( s ) ) );
496 - // }
497 - // catch ( NumberFormatException e )
498 - // {
499 - // // Ignore
500 - // }
501 - // try
502 - // {
503 - // return new CalendarY( UtilDateAdaptor.fromUtilDateToString( s ) );
504 - // }
505 - // catch ( IllegalArgumentException e )
506 - // {
507 - // // Ignore
508 - // }
509 - // try
510 - // {
511 - // return new CalendarY( java.sql.Date.valueOf( s ) );
512 - // }
513 - // catch ( IllegalArgumentException e )
514 - // {
515 - // // Ignore
516 - // }
517 - // try
518 - // {
519 - // return CalendarY.fromY( s );
520 - // }
521 - // catch ( IllegalArgumentException e )
522 - // {
523 - // // Ignore
524 - // }
525 - // try
526 - // {
527 - // return new CalendarY( SimpleTimestamp.fromString( s ) );
528 - // }
529 - // catch ( IllegalArgumentException e )
530 - // {
531 - // // Ignore
532 - // }
533 - // TemporalParser zParser = TemporalParser.YMD;
534 - // String zCurrentUserDateFieldOrder = pDateRes.getDateFormat().getFieldOrder();
535 - // if ( !zParser.getFieldOrder().equals( zCurrentUserDateFieldOrder ) )
536 - // {
537 - // try
538 - // {
539 - // return zParser.parseDate( s, pDateRes, null ); // Try YMD first
540 - // }
541 - // catch ( IllegalArgumentException e )
542 - // {
543 - // // Ignore
544 - // }
545 - // zParser = new TemporalParser( zCurrentUserDateFieldOrder ); // Then User's Current Field Order
546 - // }
547 - // return zParser.parseDate( s, pDateRes, null );
548 - return null;
479 + if ( pObject instanceof CalendarAccessorY )
480 + {
481 + return pObject;
482 + }
483 + if ( pObject instanceof Date )
484 + {
485 + return new UtilDateAdaptor( (Date) pObject );
486 + }
487 + String s = Strings.noEmpty( pObject.toString() );
488 + if ( s == null )
489 + {
490 + return null;
491 + }
492 + try
493 + {
494 + return UtilDateAdaptor.fromUtilDateToString( s );
495 + }
496 + catch ( IllegalArgumentException e )
497 + {
498 + // Ignore
499 + }
500 + return TemporalParser.YMD.parse( s );
549 501 }
550 502 }