/** * Static factory method: create a duration value from a supplied string, in * ISO 8601 format [-]PnYnMnDTnHnMnS * * @param s a string in the lexical space of xs:duration * @return the constructed xs:duration value, or a {@link ValidationFailure} if the * supplied string is lexically invalid. */ /*@NotNull*/ public static ConversionResult makeDuration(CharSequence s) { return makeDuration(s, true, true); }
public ConversionResult convertString( CharSequence input) { return DurationValue.makeDuration(input); } }
public ConversionResult convertString( CharSequence input) { return DurationValue.makeDuration(input); } }
/** * Static factory method: create a duration value from a supplied string, in * ISO 8601 format [-]PnYnMnDTnHnMnS * * @param s a string in the lexical space of xs:duration * @return the constructed xs:duration value, or a {@link ValidationFailure} if the * supplied string is lexically invalid. */ /*@NotNull*/ public static ConversionResult makeDuration(CharSequence s) { return makeDuration(s, true, true); }
/** * Factory method: create a duration value from a supplied string, in * ISO 8601 format {@code [-]PnDTnHnMnS} * * @param s the lexical representation of the xs:dayTimeDuration value * @return a {@code DayTimeDurationValue} if the format is correct, or a {@link ValidationFailure} if not */ public static ConversionResult makeDayTimeDurationValue(CharSequence s) { ConversionResult d = DurationValue.makeDuration(s, false, true); if (d instanceof ValidationFailure) { return d; } DurationValue dv = (DurationValue) d; return Converter.DurationToDayTimeDuration.INSTANCE.convert(dv); }
/** * Factory method: create a duration value from a supplied string, in * ISO 8601 format {@code [-]PnDTnHnMnS} * * @param s the lexical representation of the xs:dayTimeDuration value * @return a {@code DayTimeDurationValue} if the format is correct, or a {@link ValidationFailure} if not */ public static ConversionResult makeDayTimeDurationValue(CharSequence s) { ConversionResult d = DurationValue.makeDuration(s, false, true); if (d instanceof ValidationFailure) { return d; } DurationValue dv = (DurationValue) d; return Converter.DurationToDayTimeDuration.INSTANCE.convert(dv); }
/** * Static factory: create a year-month duration value from a supplied string, in * ISO 8601 format [+|-]PnYnM * * @param s a string in the lexical space of xs:yearMonthDuration. * @return either a YearMonthDurationValue, or a ValidationFailure if the string was * not in the lexical space of xs:yearMonthDuration. */ public static ConversionResult makeYearMonthDurationValue(CharSequence s) { ConversionResult d = DurationValue.makeDuration(s, true, false); if (d instanceof ValidationFailure) { return d; } DurationValue dv = (DurationValue) d; return YearMonthDurationValue.fromMonths((dv.getYears() * 12 + dv.getMonths()) * dv.signum()); }
/** * Static factory: create a year-month duration value from a supplied string, in * ISO 8601 format [+|-]PnYnM * * @param s a string in the lexical space of xs:yearMonthDuration. * @return either a YearMonthDurationValue, or a ValidationFailure if the string was * not in the lexical space of xs:yearMonthDuration. */ public static ConversionResult makeYearMonthDurationValue(CharSequence s) { ConversionResult d = DurationValue.makeDuration(s, true, false); if (d instanceof ValidationFailure) { return d; } DurationValue dv = (DurationValue) d; return YearMonthDurationValue.fromMonths((dv.getYears() * 12 + dv.getMonths()) * dv.signum()); }
return GDayValue.makeGDayValue(value); case StandardNames.XS_DURATION: return DurationValue.makeDuration(value); case StandardNames.XS_YEAR_MONTH_DURATION: return YearMonthDurationValue.makeYearMonthDurationValue(value);
return GDayValue.makeGDayValue(value); case StandardNames.XS_DURATION: return DurationValue.makeDuration(value); case StandardNames.XS_YEAR_MONTH_DURATION: return YearMonthDurationValue.makeYearMonthDurationValue(value);