org.eclipse.jet.core.parser
Class AbstractTemplateResolver
java.lang.Object
org.eclipse.jet.core.parser.AbstractTemplateResolver
-
All Implemented Interfaces:
-
ITemplateResolver
-
Direct Known Subclasses:
-
DefaultTemplateResolver
-
public abstract class AbstractTemplateResolver
- extends java.lang.Object
- implements
ITemplateResolver
Abstract implementatino of
ITemplateResolver
. Extenders must only implement
the following methods.
Constructor Summary
|
protected
|
AbstractTemplateResolver
(java.net.URI baseLocation)
Create a template resolver taking templates from a single base location. |
protected
|
AbstractTemplateResolver
(java.net.URI[] baseLocations)
Create a template resolver taking templates from one or more base locations |
Method Summary
|
protected abstract
ITemplateInput
|
createTemplateInput
(java.net.URI baseLocation,
java.lang.String templatePath)
Create a Template Input from the give base location and templatePath |
java.net.URI[]
|
getBaseLocations
()
Return the base locations from which the template resolver will load templates |
ITemplateInput
|
getIncludedInput
(java.lang.String includePath,
ITemplateInput[] activeInputs)
Return the appropriate template input, given a template path, and the current stack of
template inputs. |
ITemplateInput
|
getInput
(java.lang.String templatePath)
Return the template input given a template path. |
protected abstract boolean
|
inputExists
(java.net.URI baseLocation,
java.lang.String templatePath)
Test whether the template input exists. |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
AbstractTemplateResolver
protected AbstractTemplateResolver(java.net.URI[] baseLocations)
- Create a template resolver taking templates from one or more base locations
-
Parameters:
-
baseLocations
- an array of template URIs.
AbstractTemplateResolver
protected AbstractTemplateResolver(java.net.URI baseLocation)
- Create a template resolver taking templates from a single base location.
-
Parameters:
-
baseLocation
- a base location URI
getBaseLocations
public final java.net.URI[] getBaseLocations()
-
Description copied from interface:
ITemplateResolver
- Return the base locations from which the template resolver will load templates
-
-
Specified by:
-
getBaseLocations
in interface
ITemplateResolver
-
-
Returns:
- a non-empty array of base location URIs.
getIncludedInput
public final
ITemplateInput getIncludedInput(java.lang.String includePath,
ITemplateInput[] activeInputs)
throws
RecursiveIncludeException
-
Description copied from interface:
ITemplateResolver
- Return the appropriate template input, given a template path, and the current stack of
template inputs.
The activeInputs argument is order from initial input to most recently included input.
-
-
Specified by:
-
getIncludedInput
in interface
ITemplateResolver
-
-
Parameters:
-
includePath
- the JET template path -
activeInputs
- the input stack.
-
Returns:
- the template input, or
null
-
Throws:
-
RecursiveIncludeException
- if including templatePath would result in a recursive loop
getInput
public final
ITemplateInput getInput(java.lang.String templatePath)
-
Description copied from interface:
ITemplateResolver
- Return the template input given a template path.
-
-
Specified by:
-
getInput
in interface
ITemplateResolver
-
-
Parameters:
-
templatePath
- the JET template path
-
Returns:
- the template input, or
null
inputExists
protected abstract boolean inputExists(java.net.URI baseLocation,
java.lang.String templatePath)
- Test whether the template input exists. The default implementation opens in input
stream to confirme the existance
-
-
-
Parameters:
-
baseLocation
- the baseLocation -
templatePath
- the template path
-
Returns:
-
true
if
createTemplateInput(URI, String)
} will succeed, false
otherwise.
createTemplateInput
protected abstract
ITemplateInput createTemplateInput(java.net.URI baseLocation,
java.lang.String templatePath)
- Create a Template Input from the give base location and templatePath
-
-
-
Parameters:
-
baseLocation
- a base loction -
templatePath
- a templatePath
-
Returns:
- the template input.