Examples of ReadablePeriod


Examples of org.joda.time.ReadablePeriod

  }

  public void testDeserializeDays() throws Exception
  {
    ObjectMapper objectMapper = jodaMapper();
    ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"days\"},\"days\":2,\"periodType\":{\"name\":\"Days\"}}", ReadablePeriod.class );
    assertNotNull( readablePeriod );
    assertEquals( Days.days( 2 ), readablePeriod );
  }
View Full Code Here

Examples of org.joda.time.ReadablePeriod

  }
 
  public void testDeserializeWeeks() throws Exception
  {
    ObjectMapper objectMapper = jodaMapper();
    ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"weeks\"},\"weeks\":2,\"periodType\":{\"name\":\"Weeks\"}}", ReadablePeriod.class );
    assertNotNull( readablePeriod );
    assertEquals( Weeks.weeks( 2 ), readablePeriod );
  }
View Full Code Here

Examples of org.joda.time.ReadablePeriod

  }
 
  public void testDeserializeMonths() throws Exception
  {
    ObjectMapper objectMapper = jodaMapper();
    ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"months\"},\"months\":2,\"periodType\":{\"name\":\"Months\"}}", ReadablePeriod.class );
    assertNotNull( readablePeriod );
    assertEquals( Months.months( 2 ), readablePeriod );
  }
View Full Code Here

Examples of org.joda.time.ReadablePeriod

  }

  public void testDeserializeYears() throws Exception
  {
    ObjectMapper objectMapper = jodaMapper();
    ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"years\"},\"years\":2,\"periodType\":{\"name\":\"Years\"}}", ReadablePeriod.class );
    assertNotNull( readablePeriod );
    assertEquals( Years.years( 2 ), readablePeriod );
  }
View Full Code Here

Examples of org.joda.time.ReadablePeriod

    if (format == null) {
      format = new PeriodFormatterBuilder().printZeroRarelyLast().appendDays().appendSuffix("d").appendHours().appendSuffix("h")
          .appendMinutes().appendSuffix("m").appendSecondsWithOptionalMillis().appendSuffix("s").toFormatter();
    }

    ReadablePeriod p = null;

    if (value instanceof ReadableInterval) {
      p = ((ReadableInterval) value).toPeriod();
    } else if (value instanceof ReadableDuration) {
      p = ((ReadableDuration) value).toPeriod();
View Full Code Here

Examples of org.joda.time.ReadablePeriod

            return true;
        }
        if (period instanceof ReadablePeriod == false) {
            return false;
        }
        ReadablePeriod other = (ReadablePeriod) period;
        if (size() != other.size()) {
            return false;
        }
        for (int i = 0, isize = size(); i < isize; i++) {
            if (getValue(i) != other.getValue(i) || getFieldType(i) != other.getFieldType(i)) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

Examples of org.joda.time.ReadablePeriod

            return true;
        }
        if (period instanceof ReadablePeriod == false) {
            return false;
        }
        ReadablePeriod other = (ReadablePeriod) period;
        return (other.getPeriodType() == getPeriodType() && other.getValue(0) == getValue());
    }
View Full Code Here

Examples of org.joda.time.ReadablePeriod

     * @return the period type from the readable duration
     * @throws NullPointerException if the object is null
     * @throws ClassCastException if the object is an invalid type
     */
    public PeriodType getPeriodType(Object object) {
        ReadablePeriod period = (ReadablePeriod) object;
        return period.getPeriodType();
    }
View Full Code Here

Examples of org.joda.time.ReadablePeriod

      }
      if (timezone != null) {
        dateTime = dateTime.withZoneRetainFields(DateTimeZone.forID(timezone));
      }

        ReadablePeriod period = null;
      if (recurrence != null) {
        period = parsePeriodString(id, recurrence);
      }

      ScheduledJob scheduledJob = new ScheduledJob(id, dateTime, period, dependency);
View Full Code Here

Examples of org.joda.time.ReadablePeriod

      return object;
    }
   
    private ReadablePeriod parsePeriodString(String jobname, String periodStr)
    {
        ReadablePeriod period;
        char periodUnit = periodStr.charAt(periodStr.length() - 1);
        if (periodUnit == 'n') {
            return null;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.