Package com.hubspot.jinjava.util
Class EagerExpressionResolver.EagerExpressionResult
- java.lang.Object
-
- com.hubspot.jinjava.util.EagerExpressionResolver.EagerExpressionResult
-
- Enclosing class:
- EagerExpressionResolver
public static class EagerExpressionResolver.EagerExpressionResult extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EagerExpressionResolver.EagerExpressionResult.ResolutionState
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EagerExpressionResolver.EagerExpressionResult
fromString(String resolvedString)
Method to wrap a string value in the EagerExpressionResult class.static EagerExpressionResolver.EagerExpressionResult
fromString(String resolvedString, EagerExpressionResolver.EagerExpressionResult.ResolutionState resolutionState)
Method to wrap a string value in the EagerExpressionResult class.static EagerExpressionResolver.EagerExpressionResult
fromSupplier(Supplier<String> stringSupplier, JinjavaInterpreter interpreter)
Method to supply a string value to the EagerExpressionResult class.Set<String>
getDeferredWords()
EagerExpressionResolver.EagerExpressionResult.ResolutionState
getResolutionState()
boolean
isFullyResolved()
List<?>
toList()
String
toString()
Returns a string representation of the resolved expression.String
toString(boolean forOutput)
When forOutput is true, the result will always be unquoted.
-
-
-
Method Detail
-
toString
public String 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
public String toString(boolean forOutput)
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
public List<?> toList()
-
getResolutionState
public EagerExpressionResolver.EagerExpressionResult.ResolutionState getResolutionState()
-
isFullyResolved
public boolean isFullyResolved()
-
fromString
public static EagerExpressionResolver.EagerExpressionResult fromString(String resolvedString)
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.
-
-