/** * parse a String and convert it into a java.lang.Object * * @param str the string to parse * @return the java.lang.Object represented by the string * @throws ParseException a parse exception is thrown if the string to parse does not follow the * rigth format (see the description of this class) */ public static Object parse(String str) throws ParseException { return parseTimeDuration(str); }
/** * parse a String and convert it into a java.lang.Object * @param str the string to parse * @return the java.lang.Object represented by the string * @throws ParseException a parse exception is thrown if the string to parse * does not follow the rigth format (see the description * of this class) */ public static Object parse(String str) throws ParseException { return parseTimeDuration(str); }
/** * set the duration facet for this recurringDuration * * @param duration the period to set * @throws UnsupportedOperationException this exception is thrown when changing the value of the * duration facet is not allowed */ public void setDuration(String duration) throws UnsupportedOperationException { try { _duration = TimeDuration.parseTimeDuration(duration); } catch (ParseException e) { String err = "RecurringDuration, setDuration: " + e; throw new IllegalArgumentException(err); } }
/** * set the duration facet for this recurringDuration * * @param duration * the period to set * @throws UnsupportedOperationException * this exception is thrown when changing the value of the * duration facet is not allowed */ public void setDuration(String duration) throws UnsupportedOperationException { try { _duration = TimeDuration.parseTimeDuration(duration); } catch (ParseException e) { String err = "RecurringDuration, setDuration: " + e; throw new IllegalArgumentException(err); } }
/** * set the period facet for this recurringDuration * * @param period the period to set * @throws UnsupportedOperationException this exception is thrown when changing the value of the * period facet is not allowed */ public void setPeriod(String period) throws UnsupportedOperationException { try { setPeriodInternal(TimeDuration.parseTimeDuration(period)); } catch (ParseException e) { String err = "RecurringDuration, setPeriod: " + e; throw new IllegalArgumentException(err); } }
/** * returns a recurringDurationBase with the facets duration and period set up * * @param duration the String representing the duration facet * @param period the String reprensenting the period facet * @throws IllegalArgumentException this exception is thrown when the parameter strings are not * corresponding to valid TimeDuration */ protected RecurringDurationBase(String duration, String period) throws IllegalArgumentException { try { this.setDuration(TimeDuration.parseTimeDuration(duration)); this.setPeriodInternal(TimeDuration.parseTimeDuration(period)); } catch (Exception e) { String err = "In RecurringDurationBase: " + e; throw new IllegalArgumentException(err); } }
/** * set the period facet for this recurringDuration * * @param period * the period to set * @throws UnsupportedOperationException * this exception is thrown when changing the value of the * period facet is not allowed */ public void setPeriod (String period) throws UnsupportedOperationException { try { setPeriodInternal(TimeDuration.parseTimeDuration(period)); } catch (ParseException e) { String err = "RecurringDuration, setPeriod: " + e; throw new IllegalArgumentException(err); } }
/** * returns a recurringDurationBase with the facets duration and period set * up * * @param duration * the String representing the duration facet * @param period * the String reprensenting the period facet * @throws IllegalArgumentException * this exception is thrown when the parameter strings are not * corresponding to valid TimeDuration */ protected RecurringDurationBase(String duration, String period) throws IllegalArgumentException { try { this.setDuration(TimeDuration.parseTimeDuration(duration)); this.setPeriodInternal(TimeDuration.parseTimeDuration(period)); } catch (Exception e) { String err = "In RecurringDurationBase: " + e; throw new IllegalArgumentException(err); } }
/** * Sets the value of the field associated with this descriptor. * * @param target * the object in which to set the value * @param value * the value of the field */ public void setValue(Object target, Object value) throws java.lang.IllegalStateException { if (! (target instanceof TimeDuration) ) { //-- throw exception } TimeDuration time = (TimeDuration) target; if (value == null) { /// do something } //-- update current instance of time with new time try { TimeDuration temp = TimeDuration.parseTimeDuration(value.toString()) ; time.setYear(temp.getYear()); time.setMonth(temp.getMonth()); time.setDay(temp.getDay()); time.setHour(temp.getHour()); time.setMinute(temp.getMinute()); time.setSeconds(temp.getSeconds()); } catch (java.text.ParseException ex) { //-- ignore for now } } //-- setValue
/** * Sets the value of the field associated with this descriptor. * * @param target the object in which to set the value * @param value the value of the field */ public void setValue(Object target, Object value) throws java.lang.IllegalStateException { if (!(target instanceof TimeDuration)) { // -- throw exception } TimeDuration time = (TimeDuration) target; if (value == null) { /// do something } // -- update current instance of time with new time try { TimeDuration temp = TimeDuration.parseTimeDuration(value.toString()); time.setYear(temp.getYear()); time.setMonth(temp.getMonth()); time.setDay(temp.getDay()); time.setHour(temp.getHour()); time.setMinute(temp.getMinute()); time.setSeconds(temp.getSeconds()); } catch (java.text.ParseException ex) { // -- ignore for now } } // -- setValue