org.joda.time.LocalTime.getMillisOfDay()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(281)

本文整理了Java中org.joda.time.LocalTime.getMillisOfDay()方法的一些代码示例,展示了LocalTime.getMillisOfDay()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalTime.getMillisOfDay()方法的具体详情如下:
包路径:org.joda.time.LocalTime
类名称:LocalTime
方法名:getMillisOfDay

LocalTime.getMillisOfDay介绍

[英]Get the millis of day field value.
[中]获取天的毫秒字段值。

代码示例

代码示例来源:origin: apache/flink

@Override
public void write(Kryo kryo, Output output, LocalTime object) {
  final int time = object.getMillisOfDay();
  output.writeInt(time, true);
  final Chronology chronology = object.getChronology();
  if (chronology != null && chronology != ISOChronology.getInstanceUTC()) {
    throw new RuntimeException("Unsupported chronology: " + chronology);
  }
}

代码示例来源:origin: prestodb/presto

@Override
public long getLong(int field)
{
  checkState(row != null, "No current row");
  Column column = columns.get(field);
  if (column.getType().getBase() == ColumnType.Base.DATE) {
    return Days.daysBetween(new LocalDate(0), LocalDate.parse(row.get(column.getPosition()))).getDays();
  }
  if (column.getType().getBase() == ColumnType.Base.TIME) {
    return LocalTime.parse(row.get(column.getPosition())).getMillisOfDay();
  }
  if (column.getType().getBase() == ColumnType.Base.INTEGER) {
    return parseInt(row.get(column.getPosition()));
  }
  if (column.getType().getBase() == ColumnType.Base.DECIMAL) {
    DecimalParseResult decimalParseResult = Decimals.parse(row.get(column.getPosition()));
    return rescale((Long) decimalParseResult.getObject(), decimalParseResult.getType().getScale(), ((DecimalType) columnTypes.get(field)).getScale());
  }
  return parseLong(row.get(column.getPosition()));
}

代码示例来源:origin: ebean-orm/ebean

@Override
public Object toJdbcType(Object value) {
 if (value instanceof LocalTime) {
  return new Time(((LocalTime) value).getMillisOfDay());
 }
 return BasicTypeConverter.toTime(value);
}

代码示例来源:origin: ebean-orm/ebean

@Override
public void bind(DataBind b, LocalTime value) throws SQLException {
 if (value == null) {
  b.setNull(Types.TIME);
 } else {
  Time sqlTime = new Time(value.getMillisOfDay());
  b.setTime(sqlTime);
 }
}

代码示例来源:origin: org.springframework.data/spring-data-cassandra

@Override
  public Long convert(LocalTime source) {
    return (long) source.getMillisOfDay();
  }
}

代码示例来源:origin: org.jadira.usertype/usertype.core

@Override
  public Long toNonNullValue(LocalTime value) {
    return Long.valueOf(value.getMillisOfDay() * 1000000L);
  }
}

代码示例来源:origin: org.jadira.usertype/usertype.jodatime

@Override
  public Long toNonNullValue(TimeOfDay value) {
    return Long.valueOf((value.toLocalTime().getMillisOfDay()) * 1000000L);
  }
}

代码示例来源:origin: io.ebean/ebean

@Override
public Object toJdbcType(Object value) {
 if (value instanceof LocalTime) {
  return new Time(((LocalTime) value).getMillisOfDay());
 }
 return BasicTypeConverter.toTime(value);
}

代码示例来源:origin: net.s-jr.utils.converterutils/joda-converter-utils

@Contract("null -> null; !null -> !null")
public static @Nullable Time jodaTimeToSqlTime(final @Nullable LocalTime value) {
  if (value == null) {
    return null;
  }
  return new Time(value.getMillisOfDay());
}

代码示例来源:origin: joda-time/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.INTEGER.nullSafeSet(preparedStatement, null, index);
  } else {
    LocalTime lt = ((LocalTime) value);
    StandardBasicTypes.INTEGER.nullSafeSet(preparedStatement, new Integer(lt.getMillisOfDay()), index);
  }
}

代码示例来源:origin: joda-time/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, null,
        index);
  } else {
    LocalTime lt = ((LocalTime) value);
    Timestamp timestamp = new Timestamp(lt.getMillisOfDay());
    StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement,
        timestamp, index);
  }
}

代码示例来源:origin: joda-time/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.TIME.nullSafeSet(preparedStatement, null, index);
  } else {
    LocalTime lt = ((LocalTime) value);
    Time time = new Time(lt.getMillisOfDay());
    StandardBasicTypes.TIME.nullSafeSet(preparedStatement, time, index);
  }
}

代码示例来源:origin: org.avaje.ebean/ebean

@Override
public void bind(DataBind b, LocalTime value) throws SQLException {
 if (value == null) {
  b.setNull(Types.TIME);
 } else {
  Time sqlTime = new Time(value.getMillisOfDay());
  b.setTime(sqlTime);
 }
}

代码示例来源:origin: com.alibaba.blink/flink-avro

@Override
public void write(Kryo kryo, Output output, LocalTime object) {
  final int time = object.getMillisOfDay();
  output.writeInt(time, true);
  final Chronology chronology = object.getChronology();
  if (chronology != null && chronology != ISOChronology.getInstanceUTC()) {
    throw new RuntimeException("Unsupported chronology: " + chronology);
  }
}

代码示例来源:origin: dremio/dremio-oss

@Override
public void set(ValueVector v, int index) {
 if(obj != null){
  ((TimeMilliVector) v).setSafe(index, (int) obj.getMillisOfDay());
 }
}

代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-applib

private java.util.Date getTime(final String path, final JsonNode node) {
  if (representsNull(node)) {
    return null;
  }
  checkValue(path, node, "a time");
  if (!node.isTextual()) {
    throw new IllegalArgumentException(formatExMsg(path, "is not a time"));
  }
  final String textValue = node.getTextValue();
  final LocalTime localTime = _HHmmss.parseLocalTime(textValue + "Z");
  return new java.util.Date(localTime.getMillisOfDay());
}

代码示例来源:origin: com.synaptix.toast/toast-tk-adapters

public static Duration parseDurationFromTime(String time) {
  if (StringUtils.isEmpty(time)) {
    return null;
  }
  return Duration.millis(LocalTime.parse(time, new DateTimeFormatterBuilder().appendPattern(TimePattern).toFormatter()).getMillisOfDay());
}

代码示例来源:origin: de.javakaffee/kryo-serializers

@Override
public void write(Kryo kryo, Output output, LocalTime object) {
  final int time = object.getMillisOfDay();
  output.writeInt(time, true);
  //LocalTime always converts the internal DateTimeZone to UTC so there is no need to serialize it.
  final String chronologyId = IdentifiableChronology.getChronologyId(object.getChronology());
  output.writeString(chronologyId);
}

代码示例来源:origin: magro/kryo-serializers

@Override
public void write(Kryo kryo, Output output, LocalTime object) {
  final int time = object.getMillisOfDay();
  output.writeInt(time, true);
  //LocalTime always converts the internal DateTimeZone to UTC so there is no need to serialize it.
  final String chronologyId = IdentifiableChronology.getChronologyId(object.getChronology());
  output.writeString(chronologyId);
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

@Test
public void testLocalTime()
    throws Exception
{
  long millis = new LocalTime(session.getStartTime(), DATE_TIME_ZONE).getMillisOfDay();
  functionAssertions.assertFunction("LOCALTIME", TimeType.TIME, toTime(millis));
}

相关文章