java.lang.Object
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTElement
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTValue
All Implemented Interfaces:
ModelASTEnvironmentValue, ModelASTMarkerInterface, ModelASTMethodArg

public abstract class ModelASTValue extends ModelASTElement implements ModelASTMethodArg, ModelASTEnvironmentValue
Represents the value in a key/value pair, as used in ModelASTEnvironment, ModelASTNamedArgumentList and elsewhere.
Author:
Andrew Bayer, Kohsuke Kawaguchi
  • Method Details

    • isLiteral

      public abstract boolean isLiteral()
      If the value can be determined without side-effect at AST parsing time, this method returns true, and getValue() returns its value.
      Returns:
      true if the value can be determined without side-effects at AST parsing time.
    • getValue

      public Object getValue()
      Returns a value or an expression that represents this value. This model is used at the compile time, so it's not always possible to obtain the actual value. Imagine something like secret('12345') or even pow(2,10). In case the value is an expression, this method returns a string represntation suitable for the editor. For example, if the value is foobar(x), we want the editor to show "${foobar(x)}"
      Returns:
      returens the value or an expression that represents this value.
    • validate

      public void validate(@NonNull ModelValidator validator)
      Description copied from class: ModelASTElement
      Called to do whatever validation is necessary for this element. Overridden in most cases.
      Specified by:
      validate in interface ModelASTMarkerInterface
      Overrides:
      validate in class ModelASTElement
      Parameters:
      validator - A ModelValidator to use for more complicated validation.
    • toJSON

      @NonNull public net.sf.json.JSONObject toJSON()
      Description copied from class: ModelASTElement
      Translates this element and any children it may have into JSON conforming to the schema.
      Specified by:
      toJSON in interface ModelASTMarkerInterface
      Specified by:
      toJSON in class ModelASTElement
      Returns:
      Generally a JSONObject or JSONArray but for some leaf nodes, may be a String or other simple class.
    • equals

      public boolean equals(Object o)
      Description copied from class: ModelASTElement
      Overrides:
      equals in class ModelASTElement
    • hashCode

      public int hashCode()
      Description copied from class: ModelASTElement
      Overrides:
      hashCode in class ModelASTElement
    • toString

      public String toString()
      Description copied from class: ModelASTElement
      Overrides:
      toString in class ModelASTElement
    • fromConstant

      public static ModelASTValue fromConstant(Object o, Object sourceLocation)
    • fromGString

      public static ModelASTValue fromGString(String gstring, Object sourceLocation)