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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
protected static <T extends Collection>
TnullIfEmpty
(T list) void
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 void
Removes the source location value from this list of elements element.void
setSourceLocation
(Object sourceLocation) abstract String
toGroovy()
Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static <T extends ModelASTMarkerInterface>
StringTranslates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static String
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 String
toGroovyBlock
(String name, ModelASTMarkerInterface item) Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static String
Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.abstract Object
toJSON()
Translates this element and any children it may have into JSON conforming to the schema.protected static Object
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 Object
protected static <T extends ModelASTMarkerInterface>
net.sf.json.JSONObjecttoJSONObject
(String key, Collection<T> list) toString()
void
validate
(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 void
validate
(ModelValidator validator, ModelASTMarkerInterface... items)
-
Method Details
-
getSourceLocation
-
setSourceLocation
-
toJSON
Translates this element and any children it may have into JSON conforming to the schema.- Specified by:
toJSON
in interfaceModelASTMarkerInterface
- Returns:
- Generally a
JSONObject
orJSONArray
but for some leaf nodes, may be aString
or other simple class.
-
toJSON
-
toJSONCheckEmpty
-
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
-
toGroovy
Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.- Specified by:
toGroovy
in interfaceModelASTMarkerInterface
- Returns:
- A simple
String
of Groovy code for this element and its children.
-
toGroovy
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
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
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
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
Called to do whatever validation is necessary for this element. Overridden in most cases.- Specified by:
validate
in interfaceModelASTMarkerInterface
- Parameters:
validator
- AModelValidator
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 interfaceModelASTMarkerInterface
-
removeSourceLocationsFrom
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
-
equals
-
hashCode
public int hashCode()
-