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

x33g5p2x  于2022-02-05 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(127)

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

YearMonth.parse介绍

[英]Parses a YearMonth from the specified string.

This uses ISODateTimeFormat#localDateParser().
[中]

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public YearMonth parse(String text, Locale locale) throws ParseException {
  return YearMonth.parse(text);
}

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

@Override
public YearMonth parse(String text, Locale locale) throws ParseException {
  return YearMonth.parse(text);
}

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

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

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

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-joda

@Override
  public YearMonth deserialize(final JsonParser p, final DeserializationContext ctxt) throws IOException
  {
    JsonToken t = p.getCurrentToken();
    if (t == JsonToken.VALUE_STRING) {
      String str = p.getText().trim();
      if (str.isEmpty()) {
        return null;
      }
      return YearMonth.parse(str, _format.createParser(ctxt));
    }
    return (YearMonth) ctxt.handleUnexpectedToken(handledType(), p.getCurrentToken(), p,
        "expected JSON String");
  }
}

代码示例来源:origin: astamuse/asta4d

@Override
protected YearMonth convert2Target(DateTimeFormatter formatter, String obj) {
  return YearMonth.parse(obj, formatter);
}

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

@Override
public YearMonth fromNonNullValue(String s) {
  return YearMonth.parse(s);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public YearMonth parse(String text, Locale locale) throws ParseException {
  return YearMonth.parse(text);
}

代码示例来源:origin: net.thucydides/thucydides-jbehave

private YearMonth parseWithSlash(String value) {
  if (value.trim().substring(2,3).equals("/")) {
    return YearMonth.parse(value, MONTH_YEAR_FORMAT_WITH_SLASH);
  } else {
    return YearMonth.parse(value, YEAR_MONTH_FORMAT_WITH_SLASH);
  }
}

代码示例来源:origin: net.thucydides/thucydides-jbehave

private YearMonth parseWithDash(String value) {
  if (value.trim().substring(2,3).equals("-")) {
    return YearMonth.parse(value, MONTH_YEAR_FORMAT_WITH_DASH);
  } else {
    return YearMonth.parse(value, YEAR_MONTH_FORMAT_WITH_DASH);
  }
}

代码示例来源:origin: astamuse/asta4d

@DataProvider(name="string2ym")
Object[][] string2ymData(){
  return new Object[][] { 
    {"2014-10", YearMonth.parse("2014-10")},
    {"201410", YearMonth.parse("2014-10")},
  };
}
//@formatter:on

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: Nextdoor/bender

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Parses a {@code YearMonth} from the specified string.
 * <p>
 * This uses {@link ISODateTimeFormat#localDateParser()}.
 * 
 * @param str  the string to parse, not null
 * @since 2.0
 */
@FromString
public static YearMonth parse(String str) {
  return parse(str, ISODateTimeFormat.localDateParser());
}

代码示例来源:origin: net.serenity-bdd/serenity-jbehave

@Override
public YearMonth convertValue(String value, Type type) {
  DateTimeFormatter formatter = hasDash(value) ? getFormatterWithDash(value) : getFormatterWithSlash(value);
  return YearMonth.parse(value, formatter);
}

相关文章