Class ValueRef

java.lang.Object
io.sundr.model.ValueRef
All Implemented Interfaces:
Expression, Node, Renderable, WithReferences

public class ValueRef extends Object implements Expression
  • Field Details

  • Constructor Details

    • ValueRef

      public ValueRef(Object value)
  • Method Details

    • from

      public static <T> ValueRef from(T[] value)
    • from

      public static <T> ValueRef from(T value, T... rest)
    • toExpression

      public static Expression toExpression(Object value)
      Converts a value to an Expression, wrapping literals in a ValueRef. Values that are already expressions are returned as is.
      Parameters:
      value - the value to convert, may be a literal or an expression
      Returns:
      the value as an expression
    • toExpressions

      public static Expression[] toExpressions(Object... values)
      Converts an array of values to expressions, wrapping literals in a ValueRef.
      Parameters:
      values - the values to convert, each may be a literal or an expression
      Returns:
      the values as expressions
    • getValue

      public Object getValue()
    • toString

      public static String toString(Object value)
    • render

      public String render()
      Description copied from interface: Renderable
      Render the type into a String for the purpose of code generation. This is slightly different from the `toString()` method as `toString()` is mostly needed for logging / debugging and should be idempotent. Regarding idempotency this method may yield different result based on the context it is used even if the internal state of the object does not change. An example of such case, is a reference to class that may change based on the package from which it's refenced.
      Specified by:
      render in interface Renderable
      Returns:
      the String representation of the object as it's meant to appear in the generated code.