Package org.joda.time

Examples of org.joda.time.LocalTime


  @Override
  public LocalTime parseObject(String str, ParsePosition pos) {
    DateTime dt = formatter().parseDateTime(str);
    pos.setIndex(str.length());
    LocalTime lt = new LocalTime(dt);
    return lt;
  }
View Full Code Here


        if(level <= debugLevel) {
            System.out.println(preOutput + output);
        }
        if(debugOut != null && level == ERROR) {
            LocalTime time = new LocalTime();

            try {
                debugOut.write("["+time.getHourOfDay()+":"+
                        time.getMinuteOfHour()+":"+time.getSecondOfMinute()+"]");
                debugOut.write("["+boardName+"] ");
                debugOut.write(output + '\n');
                debugOut.flush();
            } catch(IOException e) {
                System.err.println("WARN: Cannot write to debug file");
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

      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

        fmt = ISODateTimeFormat.date();
        LocalDate localDate = fmt.parseLocalDate(constant.toString());
        return StandardConverters.convertToBytes(localDate);
      } else if (info.getClassType().getName().equals("org.joda.time.LocalTime")) {
        fmt = ISODateTimeFormat.time();
        LocalTime localTime = fmt.parseLocalTime(constant.toString());
        return StandardConverters.convertToBytes(localTime);
      }
    }
    return info.convertToStorage2(constant);
  }
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

                    jp.nextToken(); // END_ARRAY?
                }
                if (jp.getCurrentToken() != JsonToken.END_ARRAY) {
                    throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "after LocalTime ints");
                }
                return new LocalTime(hour, minute, second, millis);
            }
            break;
        case VALUE_NUMBER_INT:
            return new LocalTime(jp.getLongValue());           
        case VALUE_STRING:
            String str = jp.getText().trim();
            if (str.length() == 0) { // [JACKSON-360]
                return null;
            }
View Full Code Here

        fmt = ISODateTimeFormat.date();
        LocalDate localDate = fmt.parseLocalDate(constant.toString());
        return StandardConverters.convertToBytes(localDate);
      } else if (info.getClassType().getName().equals("org.joda.time.LocalTime")) {
        fmt = ISODateTimeFormat.time();
        LocalTime localTime = fmt.parseLocalTime(constant.toString());
        return StandardConverters.convertToBytes(localTime);
      }
    }
    return info.convertToStorage2(constant);
  }
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.