Package org.joda.time

Examples of org.joda.time.LocalTime


        valueAndType.add(Pair.of(new java.util.Date(),new UtilDateType()));

        valueAndType.add(Pair.of(new DateTime(),      new DateTimeType()));
        valueAndType.add(Pair.of(new LocalDateTime(), new LocalDateTimeType()));
        valueAndType.add(Pair.of(new LocalDate(),     new LocalDateType()));
        valueAndType.add(Pair.of(new LocalTime(),     new LocalTimeType()));

        valueAndType.add(Pair.of(Gender.MALE,         new EnumByNameType<Gender>(Gender.class)));
        valueAndType.add(Pair.of(Gender.MALE,         new EnumByOrdinalType<Gender>(Gender.class)));

        valueAndType.add(Pair.of(EasyMock.createNiceMock(Blob.class), new BlobType()));
View Full Code Here


        data.add(new LocalDateTime(tsDate));
        data.add(new LocalDateTime(2014, 3, 30, 2, 0));
        data.add(new LocalDate(2010, 1, 1));
        data.add(new LocalDate(ts));
        data.add(new LocalDate(tsDate));
        data.add(new LocalTime(0, 0, 0));
        data.add(new LocalTime(12, 30, 0));
        data.add(new LocalTime(23, 59, 59));
        data.add(new LocalTime(ts));
        data.add(new LocalTime(tsTime));

        Map<Object, Object> failures = Maps.newIdentityHashMap();
        for (Object dt : data) {
            Object dt2 = query().singleResult(new ConstantImpl(dt));
            if (!dt.equals(dt2)) {
View Full Code Here

    @Test
    public void AsLiteral_JodaTime() {
        SQLTemplates templates = SQLTemplates.DEFAULT;
        Configuration conf = new Configuration(templates);
        assertMatches(DATE, conf.asLiteral(new LocalDate(0)));
        assertMatches(TIME, conf.asLiteral(new LocalTime(0)));
        assertMatches(DATETIME, conf.asLiteral(new DateTime(0)));
    }
View Full Code Here

                    case "bound_double":
                        return 12.34;
                    case "bound_date":
                        return new LocalDate(2001, 8, 22).toDateMidnight(DateTimeZone.UTC).getMillis();
                    case "bound_time":
                        return new LocalTime(3, 4, 5, 321).toDateTime(new DateTime(0, DateTimeZone.UTC)).getMillis();
                    case "bound_timestamp":
                        return new DateTime(2001, 8, 22, 3, 4, 5, 321, DateTimeZone.UTC).getMillis();
                    case "bound_pattern":
                        return Slices.wrappedBuffer("%el%".getBytes(UTF_8));
                }
View Full Code Here

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

    }

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

      return dt;
    }

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

      return dt;
    }

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

  public static class LocalTimeConverter extends BaseConverter {
    private DateTimeFormatter fmt = ISODateTimeFormat.time();
   
    @Override
    public byte[] convertToNoSqlImpl(Object value) {
      LocalTime dt = (LocalTime) value;
      long milliseconds = dt.getMillisOfDay();
      return StandardConverters.convertToBytes(milliseconds);
    }
View Full Code Here

    }

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

TOP

Related Classes of org.joda.time.LocalTime

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.