java.lang.Object
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTElement
All Implemented Interfaces:
ModelASTMarkerInterface
Direct Known Subclasses:
ModelASTAgent, ModelASTArgumentList, ModelASTAxis, ModelASTAxisContainer, ModelASTBranch, ModelASTBuildCondition, ModelASTBuildConditionsContainer, ModelASTBuildParameters, ModelASTClosureMap, ModelASTEnvironment, ModelASTExclude, ModelASTExcludes, ModelASTInternalFunctionCall, ModelASTKey, ModelASTKeyValueOrMethodCallPair, ModelASTLibraries, ModelASTMethodCall, ModelASTOptions, ModelASTPipelineDef, ModelASTStageBase, ModelASTStageInput, ModelASTStages, ModelASTStep, ModelASTTools, ModelASTTriggers, ModelASTValue, ModelASTWhen, ModelASTWhenCondition

public abstract class ModelASTElement extends Object implements ModelASTMarkerInterface
  • Method Details

    • getSourceLocation

      public Object getSourceLocation()
    • setSourceLocation

      public void setSourceLocation(Object sourceLocation)
    • toJSON

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

      @CheckForNull protected static Object toJSON(@CheckForNull ModelASTMarkerInterface item)
    • toJSONCheckEmpty

      @CheckForNull protected static Object toJSONCheckEmpty(@CheckForNull ModelASTElementContainer item)
    • toJSONArray

      @NonNull protected static <T extends ModelASTMarkerInterface> net.sf.json.JSONArray toJSONArray(@CheckForNull Collection<T> list)
    • toJSONArray

      @NonNull protected static <K extends ModelASTMarkerInterface, V extends ModelASTMarkerInterface> net.sf.json.JSONArray toJSONArray(@CheckForNull Map<K,V> map)
    • toJSONObject

      @NonNull protected static <T extends ModelASTMarkerInterface> net.sf.json.JSONObject toJSONObject(@NonNull String key, @CheckForNull Collection<T> list)
    • nullIfEmpty

      @CheckForNull protected static <T extends Collection> T nullIfEmpty(@CheckForNull T list)
    • toGroovy

      @NonNull public abstract String toGroovy()
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Specified by:
      toGroovy in interface ModelASTMarkerInterface
      Returns:
      A simple String of Groovy code for this element and its children.
    • toGroovy

      @NonNull protected static String toGroovy(@CheckForNull ModelASTMarkerInterface item)
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Returns:
      A simple String of Groovy code for this element and its children.
    • toGroovyCheckEmpty

      @NonNull protected static String toGroovyCheckEmpty(@CheckForNull ModelASTElementContainer item)
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Returns:
      A simple String of Groovy code for this element and its children.
    • toGroovy

      @NonNull protected static <T extends ModelASTMarkerInterface> String toGroovy(List<T> list)
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Returns:
      A simple String of Groovy code for this element and its children.
    • toGroovyArgList

      @NonNull protected static <T extends ModelASTMarkerInterface> String toGroovyArgList(Collection<T> list)
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Returns:
      A simple String of Groovy code for this element and its children.
    • toGroovyArgList

      @NonNull protected static <K extends ModelASTMarkerInterface, V extends ModelASTMarkerInterface> String toGroovyArgList(Map<K,V> map, String separator)
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Returns:
      A simple String of Groovy code for this element and its children.
    • toGroovyBlock

      @NonNull protected static String toGroovyBlock(String name, ModelASTMarkerInterface item)
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Returns:
      A simple String of Groovy code for this element and its children.
    • toGroovyBlock

      @NonNull protected static <T extends ModelASTMarkerInterface> String toGroovyBlock(String name, List<T> list)
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Returns:
      A simple String of Groovy code for this element and its children.
    • toGroovyBlock

      @NonNull protected static <K extends ModelASTMarkerInterface, V extends ModelASTMarkerInterface> String toGroovyBlock(String name, Map<K,V> map, String separator)
      Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.
      Returns:
      A simple String of Groovy code for this element and its children.
    • validate

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

      protected static void validate(@NonNull ModelValidator validator, @CheckForNull ModelASTMarkerInterface... items)
    • validate

      protected static <T extends ModelASTMarkerInterface> void validate(@NonNull ModelValidator validator, @CheckForNull List<T> list, @CheckForNull ModelASTMarkerInterface... items)
    • validate

      protected static <K extends ModelASTMarkerInterface, V extends ModelASTMarkerInterface> void validate(@NonNull ModelValidator validator, @CheckForNull Map<K,V> map, @CheckForNull ModelASTMarkerInterface... items)
    • removeSourceLocation

      public void removeSourceLocation()
      Removes the source location value from this element.
      Specified by:
      removeSourceLocation in interface ModelASTMarkerInterface
    • removeSourceLocationsFrom

      protected static void removeSourceLocationsFrom(@CheckForNull ModelASTMarkerInterface... items)
      Removes the source location value from this list of elements element.
    • removeSourceLocationsFrom

      protected static <T extends ModelASTMarkerInterface> void removeSourceLocationsFrom(@CheckForNull Collection<T> list)
      Removes the source location value from this list of elements.
    • removeSourceLocationsFrom

      protected static <T extends ModelASTMarkerInterface> void removeSourceLocationsFrom(@CheckForNull Collection<T> list, @CheckForNull ModelASTMarkerInterface... items)
      Removes the source location value from this list of elements.
    • removeSourceLocationsFrom

      protected static <K extends ModelASTMarkerInterface, V extends ModelASTMarkerInterface> void removeSourceLocationsFrom(@CheckForNull Map<K,V> map, @CheckForNull ModelASTMarkerInterface... items)
      Removes the source location value from this map of elements.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object