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 boolean
equals(Object o)
Object
getSourceLocation()
int
hashCode()
protected static <T extends Collection>
TnullIfEmpty(T list)
void
removeSourceLocation()
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
removeSourceLocationsFrom(ModelASTMarkerInterface... items)
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>
StringtoGroovy(List<T> list)
Translates this element and any children it may have into Pipeline Config-formatted Groovy, without any indentations.protected static String
toGroovy(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 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
toGroovyCheckEmpty(ModelASTElementContainer item)
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
toJSON(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 Object
toJSONCheckEmpty(ModelASTElementContainer item)
protected static <T extends ModelASTMarkerInterface>
net.sf.json.JSONObjecttoJSONObject(String key, Collection<T> list)
String
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 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:
toJSON
in interfaceModelASTMarkerInterface
- Returns:
- Generally a
JSONObject
orJSONArray
but for some leaf nodes, may be aString
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 interfaceModelASTMarkerInterface
- 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 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
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.
-
-