Skip to content

Commit

Permalink
Improve some javadocs (#683)
Browse files Browse the repository at this point in the history
* Document more PebbleEngine.Builder() defaults

* Improve Loader javadoc

* Document AttributeResolver
  • Loading branch information
bannmann authored Sep 8, 2024
1 parent 82ad7fc commit 180780a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
10 changes: 6 additions & 4 deletions pebble/src/main/java/io/pebbletemplates/pebble/PebbleEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,10 @@ public Builder tagCache(PebbleCache<CacheKey, Object> tagCache) {
}

/**
* Sets whether or not escaping should be performed automatically.
* Sets whether or not escaping should be performed automatically. The default value of this
* setting is "true".
*
* @param autoEscaping The auto escaping setting
* @param autoEscaping The auto escaping setting.
* @return This builder object
*/
public Builder autoEscaping(boolean autoEscaping) {
Expand All @@ -453,7 +454,8 @@ public Builder autoEscaping(boolean autoEscaping) {
}

/**
* Sets whether or not core operators overrides should be allowed.
* Sets whether or not core operators overrides should be allowed. The default value of this
* setting is "false".
*
* @param allowOverrideCoreOperators Whether or not core operators overrides should be allowed.
* @return This builder object
Expand Down Expand Up @@ -488,7 +490,7 @@ public Builder addEscapingStrategy(String name, EscapingStrategy strategy) {

/**
* Enable/disable all caches, i.e. cache used by the engine to store compiled PebbleTemplate
* instances and tags cache
* instances and tags cache. The default value of this setting is "true".
*
* @param cacheActive toggle to enable/disable all caches
* @return This builder object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,25 @@
import io.pebbletemplates.pebble.node.ArgumentsNode;
import io.pebbletemplates.pebble.template.EvaluationContextImpl;

/**
* Resolves instance attributes
*/
public interface AttributeResolver {

/**
* Attempts to resolve an attribute of the given instance. If this method returns {@code null},
* Pebble asks the next attribute resolver in the list.
*
* @param instance The object which is being accessed
* @param attributeNameValue The name of the attribute to resolve
* @param argumentValues fully evaluated positional arguments
* @param args The arguments
* @param context The evaluation context
* @param filename Filename of the template
* @param lineNumber the line number on which the expression is defined on.
* @return a {@link ResolvedAttribute} wrapping the attribute value, or {@code null} if the
* attribute could not be resolved
*/
ResolvedAttribute resolve(Object instance,
Object attributeNameValue,
Object[] argumentValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface Loader<T> {
* The reader which will be used by Pebble to read the contents of the template.
*
* @param cacheKey the cache key to use to load create the reader.
* @return A reader object
* @return A reader object, or {@code null} if the template does not exist
*/
Reader getReader(T cacheKey);

Expand Down

0 comments on commit 180780a

Please sign in to comment.