Class AbstractParser
java.lang.Object
io.jenkins.plugins.pipeline.parsers.AbstractParser
- Direct Known Subclasses:
AgentParser
,EnvironmentParser
,InputParser
,LibraryParser
,OptionsParser
,ParallelParser
,ParametersParser
,PipelineParser
,PostParser
,ScriptParser
,StageParser
,StagesParser
,StepsParser
,SubScriptParser
,ToolsParser
,TriggersParser
,WhenConditionalParser
,WhenParser
Abstract parser class which Parsers extends
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected List<EnvironmentVariableModel>
convertEnvironmentVariableModel
(List<KeyValueModel> keyValueModels) protected List<VariableModel>
convertVariableModel
(List<KeyValueModel> keyValueModels) Convert List ofKeyValueModel
to List ofVariableModel
protected List<KeyValueModel>
extractParameters
(Object parameter) protected LinkedHashMap
getChildNodeAsLinkedHashMap
(LinkedHashMap parentNode) Get child node of the parent node asLinkedHashMap
.protected List
getChildNodeAsList
(LinkedHashMap parentNode) Get child node of the parent node asList
.protected Object
getChildNodeAsObject
(LinkedHashMap parentNode) Get child node of the parent node asObject
.protected String
getChildNodeAsString
(LinkedHashMap parentNode) Get child node of the parent node asString
.protected String
getKey
(LinkedHashMap node) Get key name from Nodeprotected Object
getValue
(LinkedHashMap parentNode, String key) Get Value from aLinkedHashMap
with a given key
-
Field Details
-
yamlNodeName
-
yaml
protected org.yaml.snakeyaml.Yaml yaml
-
-
Constructor Details
-
AbstractParser
public AbstractParser()
-
-
Method Details
-
getValue
protected Object getValue(LinkedHashMap parentNode, String key) throws PipelineAsYamlKeyEmptyException Get Value from aLinkedHashMap
with a given key- Parameters:
parentNode
- Parent map to get value fromkey
- Key to get it's value- Returns:
- Value of the key
- Throws:
PipelineAsYamlKeyEmptyException
- if key is empty
-
getChildNodeAsLinkedHashMap
protected LinkedHashMap getChildNodeAsLinkedHashMap(LinkedHashMap parentNode) throws PipelineAsYamlNodeNotFoundException Get child node of the parent node asLinkedHashMap
. Key is yamlNodeName- Parameters:
parentNode
- Parent Map- Returns:
- Child node as
LinkedHashMap
retrieved with yamlNodeName - Throws:
PipelineAsYamlNodeNotFoundException
- if child node is not found in parent node
-
getChildNodeAsList
protected List getChildNodeAsList(LinkedHashMap parentNode) throws PipelineAsYamlNodeNotFoundException Get child node of the parent node asList
. Key is yamlNodeName- Parameters:
parentNode
- Parent Map- Returns:
- Child node as
List
retrieved with yamlNodeName - Throws:
PipelineAsYamlNodeNotFoundException
- if child node is not found in parent node
-
getChildNodeAsString
protected String getChildNodeAsString(LinkedHashMap parentNode) throws PipelineAsYamlNodeNotFoundException Get child node of the parent node asString
. Key is yamlNodeName- Parameters:
parentNode
- Parent Map- Returns:
- Child node as
String
retrieved with yamlNodeName - Throws:
PipelineAsYamlNodeNotFoundException
- if child node is not found in parent node
-
getChildNodeAsObject
protected Object getChildNodeAsObject(LinkedHashMap parentNode) throws PipelineAsYamlNodeNotFoundException Get child node of the parent node asObject
. Key is yamlNodeName- Parameters:
parentNode
- Parent Map- Returns:
- Child node as
Object
retrieved with yamlNodeName - Throws:
PipelineAsYamlNodeNotFoundException
- if child node is not found in parent node
-
getKey
Get key name from Node- Parameters:
node
- Node to extract key from- Returns:
- Key Name
- Throws:
PipelineAsYamlKeyEmptyException
- if key is empty
-
extractParameters
- Parameters:
parameter
- Parameter to be converted- Returns:
- List of
KeyValueModel
-
convertVariableModel
Convert List ofKeyValueModel
to List ofVariableModel
- Parameters:
keyValueModels
- List ofKeyValueModel
to be converted- Returns:
- List of
VariableModel
-
convertEnvironmentVariableModel
protected List<EnvironmentVariableModel> convertEnvironmentVariableModel(List<KeyValueModel> keyValueModels)
-