Skip to content

Commit

Permalink
Fixed javadoc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mbosecke committed Mar 29, 2015
1 parent 5c39e79 commit 2aca405
Show file tree
Hide file tree
Showing 22 changed files with 106 additions and 82 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/mitchellbosecke/pebble/PebbleEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ public interface Extension {
/**
* Use this method to provide variables available to all templates
*
* @return Map<String,Object> global variables available to all templates
* @return Map of global variables available to all templates
*/
public Map<String, Object> getGlobalVariables();

/**
* Node visitors will travel the AST tree during the compilation phase.
*
* @return
* @return a list of node visitors
*/
public List<NodeVisitor> getNodeVisitors();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=
* {@link com.mitchellbosecke.pebble.extension.Function#execute} or
* {@link com.mitchellbosecke.pebble.extension.Test#apply}. See <a href=
* "http://www.mitchellbosecke.com/pebble/documentation/guide/extending-pebble"
* >the guide on extending pebble</a> for more information.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public List<NodeVisitor> getNodeVisitors() {
/**
* Sets the default escaping strategy.
*
* @param strategy
* @param strategy Escaping strategy
*/
public void setDefaultStrategy(String strategy) {
filter.setDefaultStrategy(strategy);
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/com/mitchellbosecke/pebble/lexer/LexerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class LexerImpl implements Lexer {
private Pattern regexVerbatimStart;

private Pattern regexVerbatimEnd;

/**
* Regular expression to find operators
*/
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/com/mitchellbosecke/pebble/lexer/TokenStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -136,7 +140,7 @@ public String getFilename() {
/**
* used for testing purposes
*
* @return
* @return List of tokens
*/
public ArrayList<Token> getTokens() {
return tokens;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Loader> loaders) {
this.loaders.addAll(loaders);
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/mitchellbosecke/pebble/loader/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ 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;

/**
* 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);

Expand All @@ -44,13 +47,15 @@ public interface Loader {
* "database_schema."
*
* @param prefix
* Prefix to help find templates
*/
public void setPrefix(String prefix);

/**
* Optional suffix to help find templates, ex ".html", ".peb"
*
* @param suffix
* Suffix to attach to template names
*/
public void setSuffix(String suffix);

Expand Down
13 changes: 9 additions & 4 deletions src/main/java/com/mitchellbosecke/pebble/node/ArgumentsNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ public List<PositionalArgumentNode> 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<String, Object> getArgumentMap(PebbleTemplateImpl self, EvaluationContext context,
NamedArguments invocableWithNamedArguments) throws PebbleException {
Expand All @@ -65,11 +70,11 @@ public Map<String, Object> 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++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, BinaryOperator> binaryOperators,
Map<String, UnaryOperator> unaryOperators) {
Expand All @@ -75,6 +79,7 @@ public ExpressionParser(Parser parser, Map<String, BinaryOperator> 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);
Expand All @@ -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 {

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 {

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/mitchellbosecke/pebble/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
*
* @author Mitchell
*
* @param <T>
* The type of arguments. Usually "List<Object>" in order to receive
* multiple arguments.
*/
public interface StoppingCondition {

Expand Down
Loading

0 comments on commit 2aca405

Please sign in to comment.