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

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

本文整理了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

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

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

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

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. @Override
  2. public YearMonth deserialize(final JsonParser p, final DeserializationContext ctxt) throws IOException
  3. {
  4. JsonToken t = p.getCurrentToken();
  5. if (t == JsonToken.VALUE_STRING) {
  6. String str = p.getText().trim();
  7. if (str.isEmpty()) {
  8. return null;
  9. }
  10. return YearMonth.parse(str, _format.createParser(ctxt));
  11. }
  12. return (YearMonth) ctxt.handleUnexpectedToken(handledType(), p.getCurrentToken(), p,
  13. "expected JSON String");
  14. }
  15. }

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

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

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

  1. @Override
  2. public YearMonth fromNonNullValue(String s) {
  3. return YearMonth.parse(s);
  4. }

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

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

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

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

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

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

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

  1. @DataProvider(name="string2ym")
  2. Object[][] string2ymData(){
  3. return new Object[][] {
  4. {"2014-10", YearMonth.parse("2014-10")},
  5. {"201410", YearMonth.parse("2014-10")},
  6. };
  7. }
  8. //@formatter:on

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

  1. /**
  2. * Parses a {@code YearMonth} from the specified string.
  3. * <p>
  4. * This uses {@link ISODateTimeFormat#localDateParser()}.
  5. *
  6. * @param str the string to parse, not null
  7. * @since 2.0
  8. */
  9. @FromString
  10. public static YearMonth parse(String str) {
  11. return parse(str, ISODateTimeFormat.localDateParser());
  12. }

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

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

相关文章