diff --git a/src/main/java/com/mitchellbosecke/pebble/PebbleEngine.java b/src/main/java/com/mitchellbosecke/pebble/PebbleEngine.java index bc1ac13a9..a20497b5c 100644 --- a/src/main/java/com/mitchellbosecke/pebble/PebbleEngine.java +++ b/src/main/java/com/mitchellbosecke/pebble/PebbleEngine.java @@ -150,8 +150,10 @@ public PebbleEngine(Loader loader) { * and returns this instance. * * @param templateName - * @return PebbleTemplate + * The name of the template + * @return PebbleTemplate The compiled version of the template * @throws PebbleException + * Thrown if an error occurs while parsing the template. */ public PebbleTemplate getTemplate(final String templateName) throws PebbleException { @@ -363,7 +365,7 @@ public boolean isStrictVariables() { * become much more null-safe and type issues are handled in a much more * graceful manner. * - * @param strictVariables + * @param strictVariables Whether or not strict variables is used */ public void setStrictVariables(boolean strictVariables) { this.strictVariables = strictVariables; diff --git a/src/main/java/com/mitchellbosecke/pebble/error/CompilationException.java b/src/main/java/com/mitchellbosecke/pebble/error/CompilationException.java index 92c22ba44..29b870824 100644 --- a/src/main/java/com/mitchellbosecke/pebble/error/CompilationException.java +++ b/src/main/java/com/mitchellbosecke/pebble/error/CompilationException.java @@ -10,23 +10,10 @@ public class CompilationException extends PebbleException { - /** - * Syntax exception - * - * @param message - * Message to display - * @param lineNumber - * Line number of where the exception occurred - * @param filename - * Filename of the file in which the exception occurred - */ public CompilationException(Throwable cause, String message) { super(cause, message); } - /** - * - */ private static final long serialVersionUID = -3712498518512126529L; } diff --git a/src/main/java/com/mitchellbosecke/pebble/error/ParserException.java b/src/main/java/com/mitchellbosecke/pebble/error/ParserException.java index 2bf763734..c880b86b5 100644 --- a/src/main/java/com/mitchellbosecke/pebble/error/ParserException.java +++ b/src/main/java/com/mitchellbosecke/pebble/error/ParserException.java @@ -12,16 +12,6 @@ public class ParserException extends PebbleException { private static final long serialVersionUID = -3712498518512126529L; - /** - * Parser exception - * - * @param message - * Message to display - * @param lineNumber - * Line number of where the exception occurred - * @param filename - * Filename of the file in which the exception occurred - */ public ParserException(Throwable cause, String message, int lineNumber, String filename) { super(cause, message, lineNumber, filename); } diff --git a/src/main/java/com/mitchellbosecke/pebble/extension/Extension.java b/src/main/java/com/mitchellbosecke/pebble/extension/Extension.java index f956fbc76..01931aacb 100644 --- a/src/main/java/com/mitchellbosecke/pebble/extension/Extension.java +++ b/src/main/java/com/mitchellbosecke/pebble/extension/Extension.java @@ -65,14 +65,14 @@ public interface Extension { /** * Use this method to provide variables available to all templates * - * @return Map global variables available to all templates + * @return Map of global variables available to all templates */ public Map getGlobalVariables(); /** * Node visitors will travel the AST tree during the compilation phase. * - * @return + * @return a list of node visitors */ public List getNodeVisitors(); } diff --git a/src/main/java/com/mitchellbosecke/pebble/extension/LocaleAware.java b/src/main/java/com/mitchellbosecke/pebble/extension/LocaleAware.java index 56d4efa2a..dae2ed61a 100644 --- a/src/main/java/com/mitchellbosecke/pebble/extension/LocaleAware.java +++ b/src/main/java/com/mitchellbosecke/pebble/extension/LocaleAware.java @@ -20,8 +20,8 @@ * * The new and preferred manner of the function/test receiving the locale is for * the template to provide some extra variables in the arguments map directly to - * {@link com.mitchellbosecke.pebble.extension.Function#execute()} or - * {@link com.mitchellbosecke.pebble.extension.Test#apply()}. See the guide on extending pebble for more information. * diff --git a/src/main/java/com/mitchellbosecke/pebble/extension/NodeVisitor.java b/src/main/java/com/mitchellbosecke/pebble/extension/NodeVisitor.java index b0d5a3745..9a11fd2ec 100644 --- a/src/main/java/com/mitchellbosecke/pebble/extension/NodeVisitor.java +++ b/src/main/java/com/mitchellbosecke/pebble/extension/NodeVisitor.java @@ -48,7 +48,7 @@ public interface NodeVisitor { * Default method invoked with unknown nodes such as nodes provided by user * extensions. * - * @param node + * @param node Node to visit */ public abstract void visit(Node node); diff --git a/src/main/java/com/mitchellbosecke/pebble/extension/escaper/EscaperExtension.java b/src/main/java/com/mitchellbosecke/pebble/extension/escaper/EscaperExtension.java index cdf09d629..d418b46da 100644 --- a/src/main/java/com/mitchellbosecke/pebble/extension/escaper/EscaperExtension.java +++ b/src/main/java/com/mitchellbosecke/pebble/extension/escaper/EscaperExtension.java @@ -55,7 +55,7 @@ public List getNodeVisitors() { /** * Sets the default escaping strategy. * - * @param strategy + * @param strategy Escaping strategy */ public void setDefaultStrategy(String strategy) { filter.setDefaultStrategy(strategy); diff --git a/src/main/java/com/mitchellbosecke/pebble/lexer/LexerImpl.java b/src/main/java/com/mitchellbosecke/pebble/lexer/LexerImpl.java index 84d2a7cfa..cbe789c89 100644 --- a/src/main/java/com/mitchellbosecke/pebble/lexer/LexerImpl.java +++ b/src/main/java/com/mitchellbosecke/pebble/lexer/LexerImpl.java @@ -91,7 +91,7 @@ public class LexerImpl implements Lexer { private Pattern regexVerbatimStart; private Pattern regexVerbatimEnd; - + /** * Regular expression to find operators */ @@ -171,11 +171,12 @@ public LexerImpl(PebbleEngine engine) { /** * This is the main method used to tokenize the raw contents of a template. * - * @param originalSource - * The raw contents of the template + * @param reader + * The reader provided from the Loader * @param name * The name of the template (used for meaningful error messages) * @throws ParserException + * Thrown from the Reader object */ @Override public TokenStream tokenize(Reader reader, String name) throws ParserException { @@ -401,11 +402,9 @@ private void lexExpression() throws ParserException { // whitespace source.advanceThroughWhitespace(); /* - Matcher matcher = REGEX_WHITESPACE.matcher(source); - if (matcher.lookingAt()) { - source.advance(matcher.end()); - } - */ + * Matcher matcher = REGEX_WHITESPACE.matcher(source); if + * (matcher.lookingAt()) { source.advance(matcher.end()); } + */ // operators Matcher matcher = regexOperators.matcher(source); @@ -572,8 +571,8 @@ private Token pushToken(Token.Type type) { /** * Create a Token of a certain type and value and push it into the list of - * tokens that we are maintaining. - * ` + * tokens that we are maintaining. ` + * * @param type * The type of token we are creating * @param value diff --git a/src/main/java/com/mitchellbosecke/pebble/lexer/TemplateSource.java b/src/main/java/com/mitchellbosecke/pebble/lexer/TemplateSource.java index 96ef390c3..76e1a5951 100644 --- a/src/main/java/com/mitchellbosecke/pebble/lexer/TemplateSource.java +++ b/src/main/java/com/mitchellbosecke/pebble/lexer/TemplateSource.java @@ -54,8 +54,11 @@ public class TemplateSource implements CharSequence { * Constructor * * @param reader + * Reader provided by the Loader * @param filename + * Filename of the template * @throws IOException + * Exceptions thrown from the reader */ public TemplateSource(Reader reader, String filename) throws IOException { this.filename = filename; @@ -125,6 +128,9 @@ private void grow(int minCapacity) { /** * Moves the start index a certain amount. While traversing this amount we * will count how many newlines have been encountered. + * + * @param amount + * Amount of characters to advance by */ public void advance(int amount) { @@ -166,6 +172,7 @@ public void advanceThroughWhitespace() { * characters to represent one newline). * * @param index + * The index of the potential newline character * @return */ private int advanceThroughNewline(int index) { diff --git a/src/main/java/com/mitchellbosecke/pebble/lexer/TokenStream.java b/src/main/java/com/mitchellbosecke/pebble/lexer/TokenStream.java index 2dbd78a2d..dfda4257e 100644 --- a/src/main/java/com/mitchellbosecke/pebble/lexer/TokenStream.java +++ b/src/main/java/com/mitchellbosecke/pebble/lexer/TokenStream.java @@ -52,8 +52,9 @@ public Token next() { * * @param type * The type of token that we expect - * @return The current token + * @return Token The current token * @throws ParserException + * Throws exception if expectation fails */ public Token expect(Token.Type type) throws ParserException { return expect(type, null); @@ -66,8 +67,11 @@ public Token expect(Token.Type type) throws ParserException { * * @param type * The type of token that we expect - * @return The current token + * @param value + * The expected value of the token + * @return Token The current token * @throws ParserException + * Thrown if expectation fails */ public Token expect(Token.Type type, String value) throws ParserException { Token token = tokens.get(current); @@ -123,7 +127,7 @@ public String toString() { /** * Looks at the current token. Does not consume the token. * - * @return + * @return Token The current token */ public Token current() { return this.tokens.get(current); @@ -136,7 +140,7 @@ public String getFilename() { /** * used for testing purposes * - * @return + * @return List of tokens */ public ArrayList getTokens() { return tokens; diff --git a/src/main/java/com/mitchellbosecke/pebble/loader/DelegatingLoader.java b/src/main/java/com/mitchellbosecke/pebble/loader/DelegatingLoader.java index 58d94b6b0..3addd207a 100644 --- a/src/main/java/com/mitchellbosecke/pebble/loader/DelegatingLoader.java +++ b/src/main/java/com/mitchellbosecke/pebble/loader/DelegatingLoader.java @@ -42,6 +42,7 @@ public class DelegatingLoader implements Loader { * Constructor provided with a list of children loaders. * * @param loaders + * A list of loaders to delegate to */ public DelegatingLoader(List loaders) { this.loaders.addAll(loaders); diff --git a/src/main/java/com/mitchellbosecke/pebble/loader/Loader.java b/src/main/java/com/mitchellbosecke/pebble/loader/Loader.java index a1ba4bc97..13382d874 100644 --- a/src/main/java/com/mitchellbosecke/pebble/loader/Loader.java +++ b/src/main/java/com/mitchellbosecke/pebble/loader/Loader.java @@ -27,8 +27,10 @@ public interface Loader { * template. * * @param templateName - * @return + * Name of the template + * @return A reader object * @throws LoaderException + * If template can not be found */ public Reader getReader(String templateName) throws LoaderException; @@ -36,6 +38,7 @@ public interface Loader { * A method for end users to change the charset used by the loader. * * @param charset + * Character set used by the loader when building a reader object */ public void setCharset(String charset); @@ -44,6 +47,7 @@ public interface Loader { * "database_schema." * * @param prefix + * Prefix to help find templates */ public void setPrefix(String prefix); @@ -51,6 +55,7 @@ public interface Loader { * Optional suffix to help find templates, ex ".html", ".peb" * * @param suffix + * Suffix to attach to template names */ public void setSuffix(String suffix); diff --git a/src/main/java/com/mitchellbosecke/pebble/node/ArgumentsNode.java b/src/main/java/com/mitchellbosecke/pebble/node/ArgumentsNode.java index 7db27fd02..f27c626eb 100644 --- a/src/main/java/com/mitchellbosecke/pebble/node/ArgumentsNode.java +++ b/src/main/java/com/mitchellbosecke/pebble/node/ArgumentsNode.java @@ -47,10 +47,15 @@ public List getPositionalArgs() { * ArgumentMap (which holds both positional and named arguments) into a * regular Map that the filter/function/test/macro is expecting. * + * @param self + * The template implementation + * @param context + * The evaluation context * @param invocableWithNamedArguments - * @param arguments - * @return + * The named arguments object + * @return Returns a map representaion of the arguments * @throws PebbleException + * Thrown if an expected name argument does not exist */ public Map getArgumentMap(PebbleTemplateImpl self, EvaluationContext context, NamedArguments invocableWithNamedArguments) throws PebbleException { @@ -65,11 +70,11 @@ public Map getArgumentMap(PebbleTemplateImpl self, EvaluationCon result.put(String.valueOf(i), positionalArgs.get(i).getValueExpression().evaluate(self, context)); } } - } else { + } else { if (positionalArgs != null) { int nameIndex = 0; - + for (PositionalArgumentNode arg : positionalArgs) { result.put(argumentNames.get(nameIndex), arg.getValueExpression().evaluate(self, context)); nameIndex++; diff --git a/src/main/java/com/mitchellbosecke/pebble/parser/ExpressionParser.java b/src/main/java/com/mitchellbosecke/pebble/parser/ExpressionParser.java index aaca7c0b4..cd87997cb 100644 --- a/src/main/java/com/mitchellbosecke/pebble/parser/ExpressionParser.java +++ b/src/main/java/com/mitchellbosecke/pebble/parser/ExpressionParser.java @@ -62,6 +62,10 @@ public class ExpressionParser { * * @param parser * A reference to the main parser + * @param binaryOperators + * All the binary operators + * @param unaryOperators + * All the unary operators */ public ExpressionParser(Parser parser, Map binaryOperators, Map unaryOperators) { @@ -75,6 +79,7 @@ public ExpressionParser(Parser parser, Map binaryOperato * * @return NodeExpression the expression that has been parsed. * @throws ParserException + * Thrown if a parsing error occurs */ public Expression parseExpression() throws ParserException { return parseExpression(0); @@ -89,6 +94,7 @@ public Expression parseExpression() throws ParserException { * * @return The NodeExpression representing the parsed expression. * @throws ParserException + * Thrown if a parsing error occurs. */ private Expression parseExpression(int minPrecedence) throws ParserException { @@ -225,6 +231,7 @@ private boolean isBinary(Token token) { * * @return NodeExpression The expression that it found. * @throws ParserException + * Thrown if a parsing error occurs. */ private Expression subparseExpression() throws ParserException { final Token token = stream.current(); @@ -330,6 +337,7 @@ private Expression parseTernaryExpression(Expression expression) throws Pa * @return Either the original expression that was passed in or a slightly * modified version of it, depending on what was discovered. * @throws ParserException + * Thrown if a parsing error occurs. */ private Expression parsePostfixExpression(Expression node) throws ParserException { Token current; @@ -413,6 +421,7 @@ private Expression parseTestInvocationExpression() throws ParserException { * The expression parsed so far * @return NodeExpression The parsed subscript expression * @throws ParserException + * Thrown if a parsing error occurs. */ private Expression parseBeanAttributeExpression(Expression node) throws ParserException { TokenStream stream = parser.getStream(); @@ -522,8 +531,9 @@ public ArgumentsNode parseArguments(boolean isMacroDefinition) throws ParserExce * * This is used for the set tag, the for loop, and in named arguments. * - * @return + * @return A variable name * @throws ParserException + * Thrown if a parsing error occurs. */ public String parseNewVariableName() throws ParserException { diff --git a/src/main/java/com/mitchellbosecke/pebble/parser/Parser.java b/src/main/java/com/mitchellbosecke/pebble/parser/Parser.java index b46742cda..05cd839c1 100644 --- a/src/main/java/com/mitchellbosecke/pebble/parser/Parser.java +++ b/src/main/java/com/mitchellbosecke/pebble/parser/Parser.java @@ -31,9 +31,9 @@ public interface Parser { * Parses the existing TokenStream, starting at the current Token, and * ending when the stopCondition is fullfilled. * - * @param stopCondition - * @return - * @throws ParserException + * @param stopCondition The condition to stop parsing a segment of the template. + * @return A node representing the parsed section + * @throws ParserException Thrown if a parsing error occurs. */ public BodyNode subparse(StoppingCondition stopCondition) throws ParserException; diff --git a/src/main/java/com/mitchellbosecke/pebble/parser/StoppingCondition.java b/src/main/java/com/mitchellbosecke/pebble/parser/StoppingCondition.java index 66dc844cb..dc7e72652 100644 --- a/src/main/java/com/mitchellbosecke/pebble/parser/StoppingCondition.java +++ b/src/main/java/com/mitchellbosecke/pebble/parser/StoppingCondition.java @@ -19,9 +19,6 @@ * * @author Mitchell * - * @param - * The type of arguments. Usually "List" in order to receive - * multiple arguments. */ public interface StoppingCondition { diff --git a/src/main/java/com/mitchellbosecke/pebble/template/EvaluationContext.java b/src/main/java/com/mitchellbosecke/pebble/template/EvaluationContext.java index 2007af124..1cb14737d 100644 --- a/src/main/java/com/mitchellbosecke/pebble/template/EvaluationContext.java +++ b/src/main/java/com/mitchellbosecke/pebble/template/EvaluationContext.java @@ -84,14 +84,23 @@ public class EvaluationContext { * Constructor used to provide all final variables. * * @param self + * The template implementation * @param strictVariables + * Whether strict variables is to be used * @param locale + * The locale of the template * @param filters + * Available filters * @param tests + * Available tests * @param functions + * Available functions * @param executorService - * @param scopes + * The optional executor service + * @param scopeChain + * The scope chain * @param inheritanceChain + * The inheritance chain */ public EvaluationContext(PebbleTemplateImpl self, boolean strictVariables, Locale locale, Map filters, Map tests, Map functions, @@ -115,7 +124,9 @@ public EvaluationContext(PebbleTemplateImpl self, boolean strictVariables, Local * Makes an exact copy of the evaluation context EXCEPT for the inheritance * chain. This is necessary for the "include" tag. * - * @return + * @param self + * The template implementation + * @return A copy of the evaluation context */ public EvaluationContext shallowCopyWithoutInheritanceChain(PebbleTemplateImpl self) { EvaluationContext result = new EvaluationContext(self, strictVariables, locale, filters, tests, functions, @@ -129,7 +140,8 @@ public EvaluationContext shallowCopyWithoutInheritanceChain(PebbleTemplateImpl s * used for the "parallel" tag. * * @param self - * @return + * The template implementation + * @return A copy of the evaluation context */ public EvaluationContext deepCopy(PebbleTemplateImpl self) { EvaluationContext result = new EvaluationContext(self, strictVariables, locale, filters, tests, functions, @@ -143,7 +155,9 @@ public EvaluationContext deepCopy(PebbleTemplateImpl self) { * multiple threads evaluating the same template (via parallel tag). * * @param key + * Key * @param value + * Value */ public void put(String key, Object value) { scopeChain.put(key, value); @@ -154,8 +168,10 @@ public void put(String key, Object value) { * it is found. * * @param key - * @return + * Key + * @return The object, if found * @throws AttributeNotFoundException + * Thrown if the key is not found */ public Object get(String key) throws AttributeNotFoundException { return scopeChain.get(key, isStrictVariables()); diff --git a/src/main/java/com/mitchellbosecke/pebble/template/PebbleTemplateImpl.java b/src/main/java/com/mitchellbosecke/pebble/template/PebbleTemplateImpl.java index 341d477e9..a8914e6ad 100644 --- a/src/main/java/com/mitchellbosecke/pebble/template/PebbleTemplateImpl.java +++ b/src/main/java/com/mitchellbosecke/pebble/template/PebbleTemplateImpl.java @@ -95,10 +95,10 @@ public void evaluate(Writer writer, Map map, Locale locale) thro * NodeInclude will call this method on a template other than itself. * * - * @param writer - * @param context - * @throws PebbleException - * @throws IOException + * @param writer The writer used to write the final output of the template + * @param context The evaluation context + * @throws PebbleException Thrown if any sort of template error occurs + * @throws IOException Thrown from the writer object */ public void evaluate(Writer writer, EvaluationContext context) throws PebbleException, IOException { if (context.getExecutorService() != null) { @@ -111,8 +111,8 @@ public void evaluate(Writer writer, EvaluationContext context) throws PebbleExce /** * Initializes the evaluation context with settings from the engine. * - * @param locale - * @return + * @param locale The desired locale + * @return The evaluation context */ private EvaluationContext initContext(Map map, Locale locale) { locale = locale == null ? engine.getDefaultLocale() : locale; @@ -126,8 +126,9 @@ private EvaluationContext initContext(Map map, Locale locale) { /** * Imports a template. * - * @param template - * @throws PebbleException + * @param context The evaluation context + * @param name The template name + * @throws PebbleException Thrown if an error occurs while rendering the imported template */ public void importTemplate(EvaluationContext context, String name) throws PebbleException { context.addImportedTemplate((PebbleTemplateImpl) engine.getTemplate(name)); @@ -147,7 +148,7 @@ public boolean hasMacro(String macroName) { /** * Registers a block. * - * @param block + * @param block The block */ public void registerBlock(Block block) { blocks.put(block.getName(), block); @@ -168,12 +169,12 @@ public void registerMacro(Macro macro) throws PebbleException { * A typical block declaration will use this method which evaluates the * block using the regular user-provided writer. * - * @param blockName - * @param context - * @param ignoreOverriden - * @param writer - * @throws PebbleException - * @throws IOException + * @param blockName The name of the block + * @param context The evaluation context + * @param ignoreOverriden Whether or not to ignore overriden blocks + * @param writer The writer + * @throws PebbleException Thrown if an error occurs + * @throws IOException Thrown from the writer object */ public void block(Writer writer, EvaluationContext context, String blockName, boolean ignoreOverriden) throws PebbleException, IOException { diff --git a/src/main/java/com/mitchellbosecke/pebble/template/Scope.java b/src/main/java/com/mitchellbosecke/pebble/template/Scope.java index 497ae5f32..e50ce301e 100644 --- a/src/main/java/com/mitchellbosecke/pebble/template/Scope.java +++ b/src/main/java/com/mitchellbosecke/pebble/template/Scope.java @@ -35,7 +35,7 @@ public Scope(Map backingMap, boolean isLocal) { * because every new thread should have a "snapshot" of the scopes, i.e. one * thread should not affect rendering output of another. * - * @return + * @return A copy of the scope */ public Scope shallowCopy() { diff --git a/src/main/java/com/mitchellbosecke/pebble/template/ScopeChain.java b/src/main/java/com/mitchellbosecke/pebble/template/ScopeChain.java index 424743fda..96dae6852 100644 --- a/src/main/java/com/mitchellbosecke/pebble/template/ScopeChain.java +++ b/src/main/java/com/mitchellbosecke/pebble/template/ScopeChain.java @@ -34,7 +34,7 @@ public ScopeChain(Map map) { * one thread adds a new object to a scope, it should not be available to * the other threads. * - * @return + * @return A copy of the scope chain */ public ScopeChain deepCopy() { ScopeChain copy = new ScopeChain(); diff --git a/src/main/java/com/mitchellbosecke/pebble/tokenParser/TokenParser.java b/src/main/java/com/mitchellbosecke/pebble/tokenParser/TokenParser.java index 9c267a7af..320f432a5 100644 --- a/src/main/java/com/mitchellbosecke/pebble/tokenParser/TokenParser.java +++ b/src/main/java/com/mitchellbosecke/pebble/tokenParser/TokenParser.java @@ -40,6 +40,7 @@ public interface TokenParser { * require. * * @param parser + * The desired parser */ public void setParser(Parser parser); @@ -68,8 +69,10 @@ public interface TokenParser { * middle content: com.mitchellbosecke.pebble.tokenParser.BlockTokenParser * * @param token - * @return + * The token to parse + * @return A node representation of the token * @throws ParserException + * Thrown if an error occurs while parsing the token */ public RenderableNode parse(Token token) throws ParserException; diff --git a/src/main/java/com/mitchellbosecke/pebble/utils/Pair.java b/src/main/java/com/mitchellbosecke/pebble/utils/Pair.java index 1db2977b2..0f1013f30 100644 --- a/src/main/java/com/mitchellbosecke/pebble/utils/Pair.java +++ b/src/main/java/com/mitchellbosecke/pebble/utils/Pair.java @@ -12,9 +12,6 @@ * A small utility class used to pair relevant objects together. * * @author Mitchell - * - * @param - * @param */ public class Pair {