public class Template extends Script
Script.ScriptField, Script.ScriptParseException
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
DEFAULT_TYPE
EMPTY_PARAMS
Constructor and Description |
---|
Template() |
Template(String template)
Constructor for simple inline template.
|
Template(String template,
ScriptService.ScriptType type,
String lang,
XContentType xContentType,
Map<String,Object> params)
Constructor for Template.
|
getLang, getParams, getScript, getType, readFrom, readScript, toString, toXContent, writeTo
public Template()
public Template(String template)
template
- The inline template.public Template(String template, ScriptService.ScriptType type, @Nullable String lang, @Nullable XContentType xContentType, @Nullable Map<String,Object> params)
template
- The cache key of the template to be compiled/executed. For
inline templates this is the actual templates source code. For
indexed templates this is the id used in the request. For on
file templates this is the file name.type
- The type of template -- dynamic, indexed, or file.lang
- The language of the template to be compiled/executed.xContentType
- The XContentType
of the template.params
- The map of parameters the template will be executed with.public XContentType getContentType()
XContentType
of the template.XContentType
of the template.protected void doReadFrom(StreamInput in) throws IOException
doReadFrom
in class Script
IOException
protected void doWriteTo(StreamOutput out) throws IOException
doWriteTo
in class Script
IOException
protected XContentBuilder scriptFieldToXContent(String template, ScriptService.ScriptType type, XContentBuilder builder, ToXContent.Params builderParams) throws IOException
scriptFieldToXContent
in class Script
IOException
public static Template readTemplate(StreamInput in) throws IOException
IOException
public static Script parse(Map<String,Object> config, boolean removeMatchedEntries, ParseFieldMatcher parseFieldMatcher)
public static Template parse(XContentParser parser, ParseFieldMatcher parseFieldMatcher) throws IOException
IOException
@Deprecated public static Template parse(XContentParser parser, Map<String,ScriptService.ScriptType> additionalTemplateFieldNames, ParseFieldMatcher parseFieldMatcher) throws IOException
IOException
@Deprecated public static Template parse(XContentParser parser, Map<String,ScriptService.ScriptType> additionalTemplateFieldNames, String defaultLang, ParseFieldMatcher parseFieldMatcher) throws IOException
IOException
Copyright © 2009–2016. All rights reserved.