Package com.hubspot.jinjava.util
Class EagerExpressionResolver.EagerExpressionResult
java.lang.Object
com.hubspot.jinjava.util.EagerExpressionResolver.EagerExpressionResult
- Enclosing class:
EagerExpressionResolver
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
-
Method Summary
Modifier and TypeMethodDescriptionfromString
(String resolvedString) Method to wrap a string value in the EagerExpressionResult class.fromString
(String resolvedString, EagerExpressionResolver.EagerExpressionResult.ResolutionState resolutionState) Method to wrap a string value in the EagerExpressionResult class.fromSupplier
(Supplier<String> stringSupplier, JinjavaInterpreter interpreter) Method to supply a string value to the EagerExpressionResult class.boolean
List
<?> toList()
toString()
Returns a string representation of the resolved expression.toString
(boolean forOutput) When forOutput is true, the result will always be unquoted.
-
Method Details
-
toString
Returns a string representation of the resolved expression. If there are multiple, they will be separated by commas, but not surrounded with brackets. -
toString
When forOutput is true, the result will always be unquoted.- Parameters:
forOutput
- Whether the result is going to be included in the final output, such as in an expression, or not such as when reconstructing tags.- Returns:
- String representation of the result
-
toList
-
getResolutionState
-
isFullyResolved
public boolean isFullyResolved() -
getDeferredWords
-
fromString
Method to wrap a string value in the EagerExpressionResult class. It is not evaluated, rather it's allows a the class to be manually built from a partially resolved string.- Parameters:
resolvedString
- Partially resolved string to wrap.- Returns:
- A EagerExpressionResult that
toString()
returnsresolvedString
.
-
fromString
public static EagerExpressionResolver.EagerExpressionResult fromString(String resolvedString, EagerExpressionResolver.EagerExpressionResult.ResolutionState resolutionState) Method to wrap a string value in the EagerExpressionResult class. Manually provide whether the string has been fully resolved.- Parameters:
resolvedString
- Partially or fully resolved string to wrapresolutionState
- Either FULL or PARTIAL- Returns:
- A EagerExpressionResult that
toString()
returnsresolvedString
.
-
fromSupplier
public static EagerExpressionResolver.EagerExpressionResult fromSupplier(Supplier<String> stringSupplier, JinjavaInterpreter interpreter) Method to supply a string value to the EagerExpressionResult class. In the event that a DeferredValueException is thrown, the message will be the wrapped value, and the resolutionState will be NONE Manually provide whether the string has been fully resolved.- Parameters:
stringSupplier
- Supplier function to run, which could potentially throw a DeferredValueException.interpreter
- The JinjavaInterpreter- Returns:
- A EagerExpressionResult that wraps either
stringSupplier.get()
or the thrown DeferredValueException's message.
-