Class ContextRef

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

public class ContextRef extends Object implements Expression
Represents a context reference that needs to be resolved later. This is used during parsing when we encounter names that could be: - Local variables - Method parameters - Class fields - Class names (for static method calls) - Imported types Once the actual type is known, this ContextRef should be replaced entirely with the appropriate Expression (PropertyRef, ClassRef, etc.).
  • Constructor Details

    • ContextRef

      public ContextRef(String name)
  • Method Details

    • getName

      public String getName()
    • getReferences

      public Set<ClassRef> getReferences()
      Specified by:
      getReferences in interface WithReferences
    • 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.
    • renderExpression

      public String renderExpression()
      Specified by:
      renderExpression in interface Expression
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object