Package org.joda.time

Examples of org.joda.time.LocalDateTime


  }

  @Override
  public LocalDateTime toBeanType(Object value) {
    if (value instanceof java.util.Date) {
      return new LocalDateTime(((java.util.Date) value).getTime());
    }
    return (LocalDateTime) value;
  }
View Full Code Here


    return (LocalDateTime) value;
  }

  @Override
  public LocalDateTime parseDateTime(long systemTimeMillis) {
    return new LocalDateTime(systemTimeMillis);
  }
View Full Code Here

            }

            if (paramType == DateTime.class) {
                return new DateTime(millis);
            } else if (paramType == LocalDateTime.class) {
                return new LocalDateTime(new Date(millis));
            } else {
                throw new ConversionException(paramType);
            }
        }
        catch (ConversionException ex) {
View Full Code Here

        if (data instanceof DateTime) {
            DateTime dateTime = (DateTime) data;
            milliSeconds = dateTime.getMillis();
        } else if (data instanceof LocalDateTime) {
            LocalDateTime date = (LocalDateTime) data;
            milliSeconds = date.toDateTime().toDate().getTime();
        } else {
            throw new ConversionException(data.getClass());
        }
        return new NonNestedOutboundVariable("new Date(" + milliSeconds + ")");
    }
View Full Code Here

        fmt = ISODateTimeFormat.dateTime();
        DateTime dateTime = fmt.parseDateTime(constant.toString());
        return StandardConverters.convertToBytes(dateTime);
      } else if (info.getClassType().getName().equals("org.joda.time.LocalDateTime")) {
        fmt = ISODateTimeFormat.dateTime();
        LocalDateTime localDateTime = fmt.parseLocalDateTime(constant.toString());
        return StandardConverters.convertToBytes(localDateTime);
      } else if (info.getClassType().getName().equals("org.joda.time.LocalDate")) {
        fmt = ISODateTimeFormat.date();
        LocalDate localDate = fmt.parseLocalDate(constant.toString());
        return StandardConverters.convertToBytes(localDate);
View Full Code Here

  public static class LocalDateTimeConverter extends BaseConverter {
    private DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
   
    @Override
    public byte[] convertToNoSqlImpl(Object value) {
      LocalDateTime dt = (LocalDateTime) value;
      long milliseconds = dt.toDate().getTime();
      return StandardConverters.convertToBytes(milliseconds);
    }
View Full Code Here

    }

    @Override
    public Object convertFromNoSqlImpl(byte[] value) {
      Long time = StandardConverters.convertFromBytes(Long.class, value);
      LocalDateTime dt = new LocalDateTime(time);
      return dt;
    }
View Full Code Here

      return dt;
    }

    @Override
    protected Object convertToType(String value) {
      LocalDateTime dt = fmt.parseLocalDateTime(value);
      return dt;
    }
View Full Code Here

      return dt;
    }

    @Override
    protected String convertToString(Object value) {
      LocalDateTime dt = (LocalDateTime) value;
      return fmt.print(dt);
    }
View Full Code Here

  }
 
  @Test
  public void testLocalDateTimeKey() {
    EntityWithDateTimeKey k = new EntityWithDateTimeKey();
    k.setId(new LocalDateTime());
    k.setSomething("qwer");
   
    mgr.put(k);
    mgr.flush();
   
View Full Code Here

TOP

Related Classes of org.joda.time.LocalDateTime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.