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


Java YearMonth.parse方法代码示例

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


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

示例1: ExpirationDate

import org.threeten.bp.YearMonth; //导入方法依赖的package包/类
/**
 * Expiration date parsed from raw track data.
 *
 * @param rawExpirationDate
 *        Raw track data for expiration date.
 */
public ExpirationDate(final String rawExpirationDate)
{
  super(rawExpirationDate);
  final String expirationDateString = non_digit
    .matcher(trimToEmpty(rawExpirationDate)).replaceAll("");
  YearMonth expirationDate;
  try
  {
    expirationDate = YearMonth.parse(expirationDateString, formatter);
  }
  catch (final Exception e)
  {
    expirationDate = null;
  }
  this.expirationDate = expirationDate;
}
 
开发者ID:sualeh,项目名称:credit_card_number,代码行数:23,代码来源:ExpirationDate.java

示例2: factory_parse_fail

import org.threeten.bp.YearMonth; //导入方法依赖的package包/类
@Test(dataProvider="badParseData", expectedExceptions=DateTimeParseException.class)
public void factory_parse_fail(String text, int pos) {
    try {
        YearMonth.parse(text);
        fail(String.format("Parse should have failed for %s at position %d", text, pos));
    } catch (DateTimeParseException ex) {
        assertEquals(ex.getParsedString(), text);
        assertEquals(ex.getErrorIndex(), pos);
        throw ex;
    }
}
 
开发者ID:ThreeTen,项目名称:threetenbp,代码行数:12,代码来源:TestYearMonth.java

示例3: factory_parse_success

import org.threeten.bp.YearMonth; //导入方法依赖的package包/类
@Test(dataProvider="goodParseData")
public void factory_parse_success(String text, YearMonth expected) {
    YearMonth yearMonth = YearMonth.parse(text);
    assertEquals(yearMonth, expected);
}
 
开发者ID:ThreeTen,项目名称:threetenbp,代码行数:6,代码来源:TestYearMonth.java

示例4: factory_parse_illegalValue_Month

import org.threeten.bp.YearMonth; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeParseException.class)
public void factory_parse_illegalValue_Month() {
    YearMonth.parse("2008-13");
}
 
开发者ID:ThreeTen,项目名称:threetenbp,代码行数:5,代码来源:TestYearMonth.java

示例5: factory_parse_nullText

import org.threeten.bp.YearMonth; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void factory_parse_nullText() {
    YearMonth.parse(null);
}
 
开发者ID:ThreeTen,项目名称:threetenbp,代码行数:5,代码来源:TestYearMonth.java

示例6: factory_parse_formatter

import org.threeten.bp.YearMonth; //导入方法依赖的package包/类
@Test
public void factory_parse_formatter() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("u M");
    YearMonth test = YearMonth.parse("2010 12", f);
    assertEquals(test, YearMonth.of(2010, 12));
}
 
开发者ID:ThreeTen,项目名称:threetenbp,代码行数:7,代码来源:TestYearMonth.java

示例7: factory_parse_formatter_nullText

import org.threeten.bp.YearMonth; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void factory_parse_formatter_nullText() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("u M");
    YearMonth.parse((String) null, f);
}
 
开发者ID:ThreeTen,项目名称:threetenbp,代码行数:6,代码来源:TestYearMonth.java

示例8: factory_parse_formatter_nullFormatter

import org.threeten.bp.YearMonth; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void factory_parse_formatter_nullFormatter() {
    YearMonth.parse("ANY", null);
}
 
开发者ID:ThreeTen,项目名称:threetenbp,代码行数:5,代码来源:TestYearMonth.java


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