/** * Converts a value to plain text {@link String}, even if the {@link TemplateValueFormat} involved normally produces * markup. This should be used rarely, where the user clearly intend to use the plain text variant of the format. * * @param seqTip * Tip to display if the value type is not coercable, but it's sequence or collection. * * @return Never {@code null} */ static String coerceModelToPlainText(TemplateModel tm, Expression exp, String seqTip, Environment env) throws TemplateException { if (tm instanceof TemplateNumberModel) { return assertFormatResultNotNull(env.formatNumberToPlainText((TemplateNumberModel) tm, exp, false)); } else if (tm instanceof TemplateDateModel) { return assertFormatResultNotNull(env.formatDateToPlainText((TemplateDateModel) tm, exp, false)); } else { return coerceModelToTextualCommon(tm, exp, seqTip, false, false, env); } }
return tm; } else { return coerceModelToTextualCommon(tm, exp, seqTip, true, returnNullOnNonCoercableType, env);
return coerceModelToTextualCommon(tm, exp, seqTip, false, false, env);
/** * Converts a value to plain text {@link String}, even if the {@link TemplateValueFormat} involved normally produces * markup. This should be used rarely, where the user clearly intend to use the plain text variant of the format. * * @param seqTip * Tip to display if the value type is not coercable, but it's sequence or collection. * * @return Never {@code null} */ static String coerceModelToPlainText(TemplateModel tm, Expression exp, String seqTip, Environment env) throws TemplateException { if (tm instanceof TemplateNumberModel) { return assertFormatResultNotNull(env.formatNumberToPlainText((TemplateNumberModel) tm, exp, false)); } else if (tm instanceof TemplateDateModel) { return assertFormatResultNotNull(env.formatDateToPlainText((TemplateDateModel) tm, exp, false)); } else { return coerceModelToTextualCommon(tm, exp, seqTip, false, false, env); } }
/** * Converts a value to plain text {@link String}, even if the {@link TemplateValueFormat} involved normally produces * markup. This should be used rarely, where the user clearly intend to use the plain text variant of the format. * * @param seqTip * Tip to display if the value type is not coercable, but it's sequence or collection. * * @return Never {@code null} */ static String coerceModelToPlainText(TemplateModel tm, Expression exp, String seqTip, Environment env) throws TemplateException { if (tm instanceof TemplateNumberModel) { return assertFormatResultNotNull(env.formatNumberToPlainText((TemplateNumberModel) tm, exp, false)); } else if (tm instanceof TemplateDateModel) { return assertFormatResultNotNull(env.formatDateToPlainText((TemplateDateModel) tm, exp, false)); } else { return coerceModelToTextualCommon(tm, exp, seqTip, false, false, env); } }
return coerceModelToTextualCommon(tm, exp, seqTip, false, false, env);
return tm; } else { return coerceModelToTextualCommon(tm, exp, seqTip, true, returnNullOnNonCoercableType, env);
return coerceModelToTextualCommon(tm, exp, seqTip, false, false, env);
return tm; } else { return coerceModelToTextualCommon(tm, exp, seqTip, true, returnNullOnNonCoercableType, env);