AdxPeriod { public static String serialize( Period period ) { return DateUtils.getMediumDateString( period.getStartDate() ) + "/" + period.getPeriodType().getIso8601Duration(); }  static Period parse( String periodString ); static String serialize( Period period );  }
@Test public void testSerialize() { period = PeriodType.getPeriodFromIsoString( "2015" ); assertEquals( "2015-01-01/P1Y", AdxPeriod.serialize( period ) ); period = PeriodType.getPeriodFromIsoString( "201503" ); assertEquals( "2015-03-01/P1M", AdxPeriod.serialize( period ) ); period = PeriodType.getPeriodFromIsoString( "2015W1" ); assertEquals( "2014-12-29/P7D", AdxPeriod.serialize( period ) ); period = PeriodType.getPeriodFromIsoString( "2015Q2" ); assertEquals( "2015-04-01/P3M", AdxPeriod.serialize( period ) ); period = PeriodType.getPeriodFromIsoString( "2015April" ); assertEquals( "2015-04-01/P1Y", AdxPeriod.serialize( period ) ); period = PeriodType.getPeriodFromIsoString( "2015S2" ); assertEquals( "2015-07-01/P6M", AdxPeriod.serialize( period ) ); period = PeriodType.getPeriodFromIsoString( "2015AprilS2" ); assertEquals( "2015-10-01/P6M", AdxPeriod.serialize( period ) ); }