/** * @param tdmSourceExpr * The blamed expression if an error occurs; only used for error messages. */ String formatDateToPlainText(TemplateDateModel tdm, Expression tdmSourceExpr, boolean useTempModelExc) throws TemplateException { TemplateDateFormat format = getTemplateDateFormat(tdm, tdmSourceExpr, useTempModelExc); try { return EvalUtil.assertFormatResultNotNull(format.formatToPlainText(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, tdmSourceExpr, e, useTempModelExc); } }
/** * @param blamedDateSourceExp * The blamed expression if an error occurs; only used for error messages. * @param blamedFormatterExp * The blamed expression if an error occurs; only used for error messages. */ String formatDateToPlainText(TemplateDateModel tdm, String formatString, Expression blamedDateSourceExp, Expression blamedFormatterExp, boolean useTempModelExc) throws TemplateException { Date date = EvalUtil.modelToDate(tdm, blamedDateSourceExp); TemplateDateFormat format = getTemplateDateFormat( formatString, tdm.getDateType(), date.getClass(), blamedDateSourceExp, blamedFormatterExp, useTempModelExc); try { return EvalUtil.assertFormatResultNotNull(format.formatToPlainText(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, blamedDateSourceExp, e, useTempModelExc); } }
public String getAsString() throws TemplateModelException { if (cachedValue == null) { if (defaultFormat == null) { if (dateModel.getDateType() == TemplateDateModel.UNKNOWN) { throw _MessageUtil.newCantFormatUnknownTypeDateException(target, null); } else { throw new BugException(); } } try { cachedValue = EvalUtil.assertFormatResultNotNull(defaultFormat.formatToPlainText(dateModel)); } catch (TemplateValueFormatException e) { try { throw _MessageUtil.newCantFormatDateException(defaultFormat, target, e, true); } catch (TemplateException e2) { // `e` should always be a TemplateModelException here, but to be sure: throw _CoreAPI.ensureIsTemplateModelException("Failed to format date/time/datetime", e2); } } } return cachedValue; }
return assertFormatResultNotNull(format.format(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, exp, e, false);
return ensureFormatResultString(format.format(tdm), exp, env); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, exp, e, false);
/** * @param tdmSourceExpr * The blamed expression if an error occurs; only used for error messages. */ String formatDateToPlainText(TemplateDateModel tdm, Expression tdmSourceExpr, boolean useTempModelExc) throws TemplateException { TemplateDateFormat format = getTemplateDateFormat(tdm, tdmSourceExpr, useTempModelExc); try { return EvalUtil.assertFormatResultNotNull(format.formatToPlainText(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, tdmSourceExpr, e, useTempModelExc); } }
/** * @param tdmSourceExpr * The blamed expression if an error occurs; only used for error messages. */ String formatDateToPlainText(TemplateDateModel tdm, Expression tdmSourceExpr, boolean useTempModelExc) throws TemplateException { TemplateDateFormat format = getTemplateDateFormat(tdm, tdmSourceExpr, useTempModelExc); try { return EvalUtil.assertFormatResultNotNull(format.formatToPlainText(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, tdmSourceExpr, e, useTempModelExc); } }
/** * @param blamedDateSourceExp * The blamed expression if an error occurs; only used for error messages. * @param blamedFormatterExp * The blamed expression if an error occurs; only used for error messages. */ String formatDateToPlainText(TemplateDateModel tdm, String formatString, Expression blamedDateSourceExp, Expression blamedFormatterExp, boolean useTempModelExc) throws TemplateException { Date date = EvalUtil.modelToDate(tdm, blamedDateSourceExp); TemplateDateFormat format = getTemplateDateFormat( formatString, tdm.getDateType(), date.getClass(), blamedDateSourceExp, blamedFormatterExp, useTempModelExc); try { return EvalUtil.assertFormatResultNotNull(format.formatToPlainText(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, blamedDateSourceExp, e, useTempModelExc); } }
/** * @param blamedDateSourceExp * The blamed expression if an error occurs; only used for error messages. * @param blamedFormatterExp * The blamed expression if an error occurs; only used for error messages. */ String formatDateToPlainText(TemplateDateModel tdm, String formatString, Expression blamedDateSourceExp, Expression blamedFormatterExp, boolean useTempModelExc) throws TemplateException { Date date = EvalUtil.modelToDate(tdm, blamedDateSourceExp); TemplateDateFormat format = getTemplateDateFormat( formatString, tdm.getDateType(), date.getClass(), blamedDateSourceExp, blamedFormatterExp, useTempModelExc); try { return EvalUtil.assertFormatResultNotNull(format.formatToPlainText(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, blamedDateSourceExp, e, useTempModelExc); } }
public String getAsString() throws TemplateModelException { if (cachedValue == null) { if (defaultFormat == null) { if (dateModel.getDateType() == TemplateDateModel.UNKNOWN) { throw _MessageUtil.newCantFormatUnknownTypeDateException(target, null); } else { throw new BugException(); } } try { cachedValue = EvalUtil.assertFormatResultNotNull(defaultFormat.formatToPlainText(dateModel)); } catch (TemplateValueFormatException e) { try { throw _MessageUtil.newCantFormatDateException(defaultFormat, target, e, true); } catch (TemplateException e2) { // `e` should always be a TemplateModelException here, but to be sure: throw _CoreAPI.ensureIsTemplateModelException("Failed to format date/time/datetime", e2); } } } return cachedValue; }
public String getAsString() throws TemplateModelException { if (cachedValue == null) { if (defaultFormat == null) { if (dateModel.getDateType() == TemplateDateModel.UNKNOWN) { throw _MessageUtil.newCantFormatUnknownTypeDateException(target, null); } else { throw new BugException(); } } try { cachedValue = EvalUtil.assertFormatResultNotNull(defaultFormat.formatToPlainText(dateModel)); } catch (TemplateValueFormatException e) { try { throw _MessageUtil.newCantFormatDateException(defaultFormat, target, e, true); } catch (TemplateException e2) { // `e` should always be a TemplateModelException here, but to be sure: throw _CoreAPI.ensureIsTemplateModelException("Failed to format date/time/datetime", e2); } } } return cachedValue; }
return ensureFormatResultString(format.format(tdm), exp, env); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, exp, e, false);
return assertFormatResultNotNull(format.format(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, exp, e, false);
return assertFormatResultNotNull(format.format(tdm)); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, exp, e, false);
return ensureFormatResultString(format.format(tdm), exp, env); } catch (TemplateValueFormatException e) { throw _MessageUtil.newCantFormatDateException(format, exp, e, false);