Package org.opencastproject.util.doc
Class DocUtil
- java.lang.Object
-
- org.opencastproject.util.doc.DocUtil
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
generate(DocData data, String template)
Use this method to generate the documentation using passed in document data, allows the user to specify the template that is usedstatic String
loadTemplate(String path)
Loads a template based on the given pathstatic String
processTextTemplate(String templateName, String textTemplate, Map<String,Object> data)
Handles the replacement of the variable strings within textual templates and also allows the setting of variables for the control of logical branching within the text template as well
Uses and expects freemarker (http://freemarker.org/) style templates (that is using ${name} as the marker for a replacement)
NOTE: These should be compatible with Velocity (http://velocity.apache.org/) templates if you use the formal notation (formal: ${variable}, shorthand: $variable)static void
reset()
-
-
-
Method Detail
-
reset
public static void reset()
-
processTextTemplate
public static String processTextTemplate(String templateName, String textTemplate, Map<String,Object> data)
Handles the replacement of the variable strings within textual templates and also allows the setting of variables for the control of logical branching within the text template as well
Uses and expects freemarker (http://freemarker.org/) style templates (that is using ${name} as the marker for a replacement)
NOTE: These should be compatible with Velocity (http://velocity.apache.org/) templates if you use the formal notation (formal: ${variable}, shorthand: $variable)- Parameters:
templateName
- this is the key to cache the template undertextTemplate
- a freemarker/velocity style text template, cannot be null or empty stringdata
- a set of replacement values which are in the map like so:
key => value (String => Object)
"username" => "aaronz"- Returns:
- the processed template
-
generate
public static String generate(DocData data, String template)
Use this method to generate the documentation using passed in document data, allows the user to specify the template that is used- Parameters:
data
- any populated DocData objecttemplate
- any freemarker template which works with the DocData data structure- Returns:
- the documentation (e.g. REST html) as a string
- Throws:
IllegalArgumentException
- if the input data is invalid in some way- See Also:
DocData
-
-