Class ModelASTElement
- 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 Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)ObjectgetSourceLocation()inthashCode()protected static <T extends Collection>
TnullIfEmpty(T list)voidremoveSourceLocation()Removes the source location value from this element.protected static <T extends ModelASTMarkerInterface>
voidremoveSourceLocationsFrom(Collection<T> list)Removes the source location value from this list of elements.protected static <T extends ModelASTMarkerInterface>
voidremoveSourceLocationsFrom(Collection<T> list, ModelASTMarkerInterface... items)Removes the source location value from this list of elements.protected static <K extends ModelASTMarkerInterface,V extends ModelASTMarkerInterface>
voidremoveSourceLocationsFrom(Map<K,V> map, ModelASTMarkerInterface... items)Removes the source location value from this map of elements.protected static voidremoveSourceLocationsFrom(ModelASTMarkerInterface... items)Removes the source location value from this list of elements element.voidsetSourceLocation(Object sourceLocation)abstract StringtoGroovy()Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static <T extends ModelASTMarkerInterface>
StringtoGroovy(List<T> list)Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static StringtoGroovy(ModelASTMarkerInterface item)Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static <T extends ModelASTMarkerInterface>
StringtoGroovyArgList(Collection<T> list)Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static <K extends ModelASTMarkerInterface,V extends ModelASTMarkerInterface>
StringtoGroovyArgList(Map<K,V> map, String separator)Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static <T extends ModelASTMarkerInterface>
StringtoGroovyBlock(String name, List<T> list)Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static <K extends ModelASTMarkerInterface,V extends ModelASTMarkerInterface>
StringtoGroovyBlock(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.protected static StringtoGroovyBlock(String name, ModelASTMarkerInterface item)Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static StringtoGroovyCheckEmpty(ModelASTElementContainer item)Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.abstract ObjecttoJSON()Translates this element and any children it may have into JSON conforming to the schema.protected static ObjecttoJSON(ModelASTMarkerInterface item)protected static <T extends ModelASTMarkerInterface>
net.sf.json.JSONArraytoJSONArray(Collection<T> list)protected static <K extends ModelASTMarkerInterface,V extends ModelASTMarkerInterface>
net.sf.json.JSONArraytoJSONArray(Map<K,V> map)protected static ObjecttoJSONCheckEmpty(ModelASTElementContainer item)protected static <T extends ModelASTMarkerInterface>
net.sf.json.JSONObjecttoJSONObject(String key, Collection<T> list)StringtoString()voidvalidate(ModelValidator validator)Called to do whatever validation is necessary for this element.protected static <T extends ModelASTMarkerInterface>
voidvalidate(ModelValidator validator, List<T> list, ModelASTMarkerInterface... items)protected static <K extends ModelASTMarkerInterface,V extends ModelASTMarkerInterface>
voidvalidate(ModelValidator validator, Map<K,V> map, ModelASTMarkerInterface... items)protected static voidvalidate(ModelValidator validator, ModelASTMarkerInterface... items)
-
-
-
Method Detail
-
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:
toJSONin interfaceModelASTMarkerInterface- Returns:
- Generally a
JSONObjectorJSONArraybut for some leaf nodes, may be aStringor 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:
toGroovyin interfaceModelASTMarkerInterface- Returns:
- A simple
Stringof 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
Stringof 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
Stringof 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
Stringof 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
Stringof 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
Stringof 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
Stringof 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
Stringof 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
Stringof 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:
validatein interfaceModelASTMarkerInterface- Parameters:
validator- AModelValidatorto 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:
removeSourceLocationin interfaceModelASTMarkerInterface
-
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.
-
-