本文整理了Java中freemarker.template.Configuration.getOutputFormat()
方法的一些代码示例,展示了Configuration.getOutputFormat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getOutputFormat()
方法的具体详情如下:
包路径:freemarker.template.Configuration
类名称:Configuration
方法名:getOutputFormat
[英]Getter pair of #setOutputFormat(OutputFormat)
[中]#setOutputFormat(OutputFormat)的Getter对
代码示例来源:origin: org.freemarker/freemarker
private MarkupOutputFormat getMarkupOutputFormatForCombined(String outerName)
throws UnregisteredOutputFormatException {
OutputFormat of = getOutputFormat(outerName);
if (!(of instanceof MarkupOutputFormat)) {
throw new IllegalArgumentException("The \"" + outerName + "\" output format can't be used in "
+ "...{...} expression, because it's not a markup format.");
}
MarkupOutputFormat outerOF = (MarkupOutputFormat) of;
return outerOF;
}
代码示例来源:origin: org.freemarker/freemarker
/**
* The getter pair of {@link #setOutputFormat(OutputFormat)}.
*/
public OutputFormat getOutputFormat() {
return outputFormat != null ? outputFormat : getNonNullParentConfiguration().getOutputFormat();
}
代码示例来源:origin: org.freemarker/freemarker
private OutputFormat getFormatFromStdFileExt() {
String sourceName = template.getSourceName();
if (sourceName == null) {
return null; // Not possible anyway...
}
int ln = sourceName.length();
if (ln < 5) return null;
char c = sourceName.charAt(ln - 5);
if (c != '.') return null;
c = sourceName.charAt(ln - 4);
if (c != 'f' && c != 'F') return null;
c = sourceName.charAt(ln - 3);
if (c != 't' && c != 'T') return null;
c = sourceName.charAt(ln - 2);
if (c != 'l' && c != 'L') return null;
c = sourceName.charAt(ln - 1);
try {
// Note: We get the output formats by name, so that custom overrides take effect.
if (c == 'h' || c == 'H') {
return template.getConfiguration().getOutputFormat(HTMLOutputFormat.INSTANCE.getName());
}
if (c == 'x' || c == 'X') {
return template.getConfiguration().getOutputFormat(XMLOutputFormat.INSTANCE.getName());
}
} catch (UnregisteredOutputFormatException e) {
throw new BugException("Unregistered std format", e);
}
return null;
}
代码示例来源:origin: org.freemarker/freemarker
"You may meant: " + UndefinedOutputFormat.class.getSimpleName() + ".INSTANCE");
OutputFormat prevOutputFormat = getOutputFormat();
this.outputFormat = outputFormat;
outputFormatExplicitlySet = true;
代码示例来源:origin: org.freemarker/freemarker
outputFormat = template.getConfiguration().getOutputFormat(vs);
} catch (IllegalArgumentException e) {
{if (true) throw new ParseException("Invalid format name: " + e.getMessage(), exp, e.getCause());}
代码示例来源:origin: org.freemarker/freemarker
template, start);}
OutputFormat innerOutputFormat = template.getConfiguration().getOutputFormat(
paramStr.substring(1, paramStr.length() - 1));
if (!(innerOutputFormat instanceof MarkupOutputFormat)) {
(MarkupOutputFormat) outputFormat, (MarkupOutputFormat) innerOutputFormat);
} else {
outputFormat = template.getConfiguration().getOutputFormat(paramStr);
代码示例来源:origin: net.sourceforge.fmpp/fmpp
/**
* Resolves an FreeMarker "output format" name to an {@link OutputFormat} object.
*
* @see Configuration#getOutputFormat(String)
*
* @since 0.9.16
*/
public OutputFormat getOutputFormat(String name) throws UnregisteredOutputFormatException {
return fmCfg.getOutputFormat(name);
}
代码示例来源:origin: net.sourceforge.fmpp/fmpp
/**
* Getter pair of {@link #setOutputFormat(OutputFormat)}.
*
* @return Not {@code null}.
*
* @since 0.9.16
*/
public OutputFormat getOutputFormat() {
return fmCfg.getOutputFormat();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
private MarkupOutputFormat getMarkupOutputFormatForCombined(String outerName)
throws UnregisteredOutputFormatException {
OutputFormat of = getOutputFormat(outerName);
if (!(of instanceof MarkupOutputFormat)) {
throw new IllegalArgumentException("The \"" + outerName + "\" output format can't be used in "
+ "...{...} expression, because it's not a markup format.");
}
MarkupOutputFormat outerOF = (MarkupOutputFormat) of;
return outerOF;
}
代码示例来源:origin: org.freemarker/freemarker-gae
private MarkupOutputFormat getMarkupOutputFormatForCombined(String outerName)
throws UnregisteredOutputFormatException {
OutputFormat of = getOutputFormat(outerName);
if (!(of instanceof MarkupOutputFormat)) {
throw new IllegalArgumentException("The \"" + outerName + "\" output format can't be used in "
+ "...{...} expression, because it's not a markup format.");
}
MarkupOutputFormat outerOF = (MarkupOutputFormat) of;
return outerOF;
}
代码示例来源:origin: sanluan/PublicCMS
private static void copyConfig(Configuration source, Configuration target) {
target.setNewBuiltinClassResolver(source.getNewBuiltinClassResolver());
target.setTemplateUpdateDelayMilliseconds(source.getTemplateUpdateDelayMilliseconds());
target.setDefaultEncoding(source.getDefaultEncoding());
target.setLocale(source.getLocale());
target.setBooleanFormat(source.getBooleanFormat());
target.setDateTimeFormat(source.getDateTimeFormat());
target.setDateFormat(source.getDateFormat());
target.setTimeFormat(source.getTimeFormat());
target.setNumberFormat(source.getNumberFormat());
target.setOutputFormat(source.getOutputFormat());
target.setURLEscapingCharset(source.getURLEscapingCharset());
target.setLazyAutoImports(source.getLazyAutoImports());
target.setTemplateExceptionHandler(source.getTemplateExceptionHandler());
}
代码示例来源:origin: sanluan/PublicCMS
private static void copyConfig(Configuration source, Configuration target) {
target.setNewBuiltinClassResolver(source.getNewBuiltinClassResolver());
target.setTemplateUpdateDelayMilliseconds(source.getTemplateUpdateDelayMilliseconds());
target.setDefaultEncoding(source.getDefaultEncoding());
target.setLocale(source.getLocale());
target.setBooleanFormat(source.getBooleanFormat());
target.setDateTimeFormat(source.getDateTimeFormat());
target.setDateFormat(source.getDateFormat());
target.setTimeFormat(source.getTimeFormat());
target.setNumberFormat(source.getNumberFormat());
target.setOutputFormat(source.getOutputFormat());
target.setURLEscapingCharset(source.getURLEscapingCharset());
target.setLazyAutoImports(source.getLazyAutoImports());
target.setTemplateExceptionHandler(source.getTemplateExceptionHandler());
}
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* The getter pair of {@link #setOutputFormat(OutputFormat)}.
*/
public OutputFormat getOutputFormat() {
return outputFormat != null ? outputFormat : getNonNullParentConfiguration().getOutputFormat();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* The getter pair of {@link #setOutputFormat(OutputFormat)}.
*/
public OutputFormat getOutputFormat() {
return outputFormat != null ? outputFormat : getNonNullParentConfiguration().getOutputFormat();
}
代码示例来源:origin: net.sourceforge.fmpp/fmpp
/**
* Don't invoke until {@link #fmCfg} is configured.
*/
FMPPTemplateConfigurationFactory() {
try {
// We get the OutputFormats by name, rather than using HTMLOutputFormat.INSTANCE and such, because
// FreeMarker supports redefining these output formats with custom implementations.
htmlTC = new TemplateConfiguration();
htmlTC.setOutputFormat(fmCfg.getOutputFormat("HTML"));
xhtmlTC = new TemplateConfiguration();
xhtmlTC.setOutputFormat(fmCfg.getOutputFormat("XHTML"));
xmlTC = new TemplateConfiguration();
xmlTC.setOutputFormat(fmCfg.getOutputFormat("XML"));
rtfTC = new TemplateConfiguration();
rtfTC.setOutputFormat(fmCfg.getOutputFormat("RTF"));
} catch (UnregisteredOutputFormatException e) {
throw new IllegalStateException(e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
private OutputFormat getFormatFromStdFileExt() {
String sourceName = template.getSourceName();
if (sourceName == null) {
return null; // Not possible anyway...
}
int ln = sourceName.length();
if (ln < 5) return null;
char c = sourceName.charAt(ln - 5);
if (c != '.') return null;
c = sourceName.charAt(ln - 4);
if (c != 'f' && c != 'F') return null;
c = sourceName.charAt(ln - 3);
if (c != 't' && c != 'T') return null;
c = sourceName.charAt(ln - 2);
if (c != 'l' && c != 'L') return null;
c = sourceName.charAt(ln - 1);
try {
// Note: We get the output formats by name, so that custom overrides take effect.
if (c == 'h' || c == 'H') {
return template.getConfiguration().getOutputFormat(HTMLOutputFormat.INSTANCE.getName());
}
if (c == 'x' || c == 'X') {
return template.getConfiguration().getOutputFormat(XMLOutputFormat.INSTANCE.getName());
}
} catch (UnregisteredOutputFormatException e) {
throw new BugException("Unregistered std format", e);
}
return null;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
"You may meant: " + UndefinedOutputFormat.class.getSimpleName() + ".INSTANCE");
OutputFormat prevOutputFormat = getOutputFormat();
this.outputFormat = outputFormat;
outputFormatExplicitlySet = true;
代码示例来源:origin: org.freemarker/freemarker-gae
private OutputFormat getFormatFromStdFileExt() {
String sourceName = template.getSourceName();
if (sourceName == null) {
return null; // Not possible anyway...
}
int ln = sourceName.length();
if (ln < 5) return null;
char c = sourceName.charAt(ln - 5);
if (c != '.') return null;
c = sourceName.charAt(ln - 4);
if (c != 'f' && c != 'F') return null;
c = sourceName.charAt(ln - 3);
if (c != 't' && c != 'T') return null;
c = sourceName.charAt(ln - 2);
if (c != 'l' && c != 'L') return null;
c = sourceName.charAt(ln - 1);
try {
// Note: We get the output formats by name, so that custom overrides take effect.
if (c == 'h' || c == 'H') {
return template.getConfiguration().getOutputFormat(HTMLOutputFormat.INSTANCE.getName());
}
if (c == 'x' || c == 'X') {
return template.getConfiguration().getOutputFormat(XMLOutputFormat.INSTANCE.getName());
}
} catch (UnregisteredOutputFormatException e) {
throw new BugException("Unregistered std format", e);
}
return null;
}
代码示例来源:origin: org.freemarker/freemarker-gae
"You may meant: " + UndefinedOutputFormat.class.getSimpleName() + ".INSTANCE");
OutputFormat prevOutputFormat = getOutputFormat();
this.outputFormat = outputFormat;
outputFormatExplicitlySet = true;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
template, start);}
OutputFormat innerOutputFormat = template.getConfiguration().getOutputFormat(
paramStr.substring(1, paramStr.length() - 1));
if (!(innerOutputFormat instanceof MarkupOutputFormat)) {
(MarkupOutputFormat) outputFormat, (MarkupOutputFormat) innerOutputFormat);
} else {
outputFormat = template.getConfiguration().getOutputFormat(paramStr);
内容来源于网络,如有侵权,请联系作者删除!