当前位置: 首页>>代码示例>>Java>>正文


Java Instant.parse方法代码示例

本文整理汇总了Java中org.threeten.bp.Instant.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Instant.parse方法的具体用法?Java Instant.parse怎么用?Java Instant.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.threeten.bp.Instant的用法示例。


在下文中一共展示了Instant.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: marketAllTypeForFudgeMessage

import org.threeten.bp.Instant; //导入方法依赖的package包/类
private Object marketAllTypeForFudgeMessage(Map<String, String> currentRow) {
  Object output = null;
  String input = currentRow.get(SnapshotColumns.MARKET_VALUE.get());

  if (input != null) {
    if (NumberUtils.isNumber(input)) {
      output = NumberUtils.createDouble(input);
    } else if (isValidInstant(input)) {
      output = Instant.parse(input);
    } else if (isValidLocalDate(input)) {
      output = LocalDate.parse(input);
    } else {
      output = input;
    }
  }
  return output;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:18,代码来源:CsvSnapshotReader.java

示例2: buildYieldCurveData

import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
 * Build yield curve data from xls data, made up of a key/value block of details and a key/value-pair block of values
 * built by getManageableUnstructuredMarketDataSnapshot, each block separated by a empty row
 */
private void buildYieldCurveData() {
  _yieldCurveSheet = new XlsSheetReader(_workbook, SnapshotType.YIELD_CURVE.get());
  while (true) {
    Map<String, String> details = _yieldCurveSheet.readKeyValueBlock(_yieldCurveSheet.getCurrentRowIndex(), 0);
    if (details.isEmpty() || details == null) {
      break;
    }
    YieldCurveKey key = YieldCurveKey.of(Currency.of(details.get(SnapshotColumns.YIELD_CURVE_CURRENCY.get())),
                                         details.get(SnapshotColumns.NAME.get()));
    Instant instant = Instant.parse(details.get(SnapshotColumns.INSTANT.get()));
    ManageableUnstructuredMarketDataSnapshot snapshot = getManageableUnstructuredMarketDataSnapshot(_yieldCurveSheet);
    ManageableYieldCurveSnapshot curve = ManageableYieldCurveSnapshot.of(instant, snapshot);
    _yieldCurve.put(key, curve);
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:20,代码来源:XlsSnapshotReader.java

示例3: buildCurveData

import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
 * Build curve data from xls data, made up of a key/value block of details and a key/value-pair block of values
 * built by getManageableUnstructuredMarketDataSnapshot, each block separated by a empty row
 */
private void buildCurveData() {
  _curveSheet = new XlsSheetReader(_workbook, SnapshotType.CURVE.get());
  while (true) {
    Map<String, String> details = _curveSheet.readKeyValueBlock(_curveSheet.getCurrentRowIndex(), 0);
    if (details.isEmpty() || details == null) {
      break;
    }
    ManageableCurveSnapshot curve = new ManageableCurveSnapshot();
    ManageableUnstructuredMarketDataSnapshot snapshot =  getManageableUnstructuredMarketDataSnapshot(_curveSheet);
    Instant instant = Instant.parse(details.get(SnapshotColumns.INSTANT.get()));
    curve.setValuationTime(instant);
    curve.setValues(snapshot);
    _curves.put(CurveKey.of(details.get(SnapshotColumns.NAME.get())), curve);
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:20,代码来源:XlsSnapshotReader.java

示例4: provideClock

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@Provides
@Singleton
public Clock provideClock() {
  Instant instant = Instant.parse("2016-05-06T10:15:30.00Z");
  ZoneId zoneId = ZoneId.of(DEFAULT_TIME_ZONE_STRING);
  return Clock.fixed(instant, zoneId);
}
 
开发者ID:xmartlabs,项目名称:bigbang,代码行数:8,代码来源:MockClockModule.java

示例5: buildCurve

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@POST
@Path("builder/{valuationTime}/{date}")
public Response buildCurve(
    @PathParam("valuationTime") String valuationTimeStr,
    @PathParam("date") String curveDateStr,
    CurveDefinition definition) {
  final Instant valuationTime = Instant.parse(valuationTimeStr);
  final LocalDate curveDate = LocalDate.parse(curveDateStr);
  CurveSpecification result = getCurveSpecificationBuilder().buildCurve(valuationTime, curveDate, definition);
  return responseOkObject(result);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:12,代码来源:DataCurveSpecificationBuilderResource.java

示例6: getTraceWithValuationTime

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@Test
public void getTraceWithValuationTime() {
  //input
  String valuationTimeStr = "2013-06-24T12:18:01.094Z";

  //expected arg
  Instant valuationTime = Instant.parse(valuationTimeStr);
  Instant originalVT = _resource.getProperties().getValuationTime();

  DependencyGraphTraceProviderResource newResource = _resource.setValuationTime(valuationTimeStr);

  assertEquals(valuationTime, newResource.getProperties().getValuationTime());
  assertEquals(originalVT, _resource.getProperties().getValuationTime());

}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:16,代码来源:DependencyGraphTraceProviderResourceTest.java

示例7: uriValuationTime

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@Test
public void uriValuationTime() throws UnsupportedEncodingException {
  String instantStr = "2013-06-24T12:18:01.094Z";
  Instant instant = Instant.parse(instantStr);
  URI uri = DependencyGraphTraceProviderResource.uriValuationTime(_baseUri, instant);
  String url = decode(uri);
  assertEquals(s_testUrl + "valuationTime/" + instantStr, url);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:9,代码来源:DependencyGraphTraceProviderResourceTest.java

示例8: parseInstantString

import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
 * Parses a version-correction {@code Instant} from a standard string representation.
 * <p>
 * The string representation must be either {@code LATEST} for null,
 * or the ISO-8601 representation of the desired {@code Instant}.
 * 
 * @param instantStr the instant string, null treated as latest
 * @return the instant, not null
 */
private static Instant parseInstantString(String instantStr) {
  if (instantStr == null || instantStr.equals("LATEST")) {
    return null;
  } else {
    try {
      return Instant.parse(instantStr);
    } catch (DateTimeException ex) {
      throw new IllegalArgumentException(ex);
    }
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:21,代码来源:VersionCorrection.java

示例9: extractTimeSeriesInstants

import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
 * Extracts the instants from the unique identifier.
 *
 * @param uniqueId  the unique identifier, not null
 * @return the instants, version, correction, not null
 */
protected VersionCorrection extractTimeSeriesInstants(UniqueId uniqueId) {
  try {
    int pos = uniqueId.getVersion().indexOf('P');
    String verStr = uniqueId.getVersion().substring(0, pos);
    String corrStr = uniqueId.getVersion().substring(pos);
    Instant ver = Instant.parse(verStr);
    Instant corr = ver.plus(Duration.parse(corrStr));
    return VersionCorrection.of(ver, corr);
  } catch (RuntimeException ex) {
    throw new IllegalArgumentException("UniqueId is not from this master (invalid version): " + uniqueId, ex);
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:19,代码来源:DbHistoricalTimeSeriesMaster.java

示例10: isValidInstant

import org.threeten.bp.Instant; //导入方法依赖的package包/类
private Boolean isValidInstant(String input) {
  try {
    Instant.parse(input);
  } catch (DateTimeParseException e) {
    return false;
  }
  return true;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:9,代码来源:CsvSnapshotReader.java

示例11: parseInstant

import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
 * @param instantString An ISO-8601 string representing an instant or null
 * @return The parsed string or null if the input is null
 */
private static Instant parseInstant(String instantString) {
  if (instantString == null) {
    return null;
  } else {
    return Instant.parse(instantString);
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:12,代码来源:WebUiResource.java

示例12: search

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@GET
@Path("functioncosts")
public Response search(@QueryParam("configurationName") String configurationName, @QueryParam("functionId") String functionId, @QueryParam("versionAsOf") String versionAsOfStr) {
  Instant versionAsOf = (versionAsOfStr != null ? Instant.parse(versionAsOfStr) : null);
  FunctionCostsDocument result = getFunctionCostsMaster().load(configurationName, functionId, versionAsOf);
  return responseOkObject(result);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:DataFunctionCostsMasterResource.java

示例13: testSerialization

import org.threeten.bp.Instant; //导入方法依赖的package包/类
@Test
public void testSerialization() {
    Instant instant = Instant.parse("2010-08-20T00:01:00Z");

    String json = gson.toJson(instant);

    assertEquals(json, "\"2010-08-20T00:01:00Z\"");
}
 
开发者ID:aaronhe42,项目名称:ThreeTen-Backport-Gson-Adapter,代码行数:9,代码来源:InstantConverterTest.java

示例14: testSerialisation

import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
 * Tests that serialising to JSON works.
 */
@Test
public void testSerialisation() throws Exception
{
  final Gson gson = registerInstant(new GsonBuilder()).create();

  final Instant now = Instant.parse("1969-07-21T02:56:00Z");
  final String json = gson.toJson(now);

  assertThat(json, is("\"1969-07-21T02:56:00Z\""));
}
 
开发者ID:gkopff,项目名称:gson-threeten-serialisers,代码行数:14,代码来源:InstantConverterTest.java

示例15: mockedClock

import org.threeten.bp.Instant; //导入方法依赖的package包/类
private static Clock mockedClock() {
  Instant instant = Instant.parse("2016-10-16T10:15:30.00Z");
  ZoneId zoneId = ZoneId.of("GMT-03:00");
  return Clock.fixed(instant, zoneId);
}
 
开发者ID:xmartlabs,项目名称:XLMaterialCalendarView,代码行数:6,代码来源:MainActivity.java


注:本文中的org.threeten.bp.Instant.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。