Class ModelASTValue
java.lang.Object
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTElement
org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTValue
- All Implemented Interfaces:
ModelASTEnvironmentValue
,ModelASTMarkerInterface
,ModelASTMethodArg
public abstract class ModelASTValue
extends ModelASTElement
implements ModelASTMethodArg, ModelASTEnvironmentValue
Represents the value in a key/value pair, as used in
ModelASTEnvironment
, ModelASTNamedArgumentList
and elsewhere.- Author:
- Andrew Bayer, Kohsuke Kawaguchi
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static ModelASTValue
fromConstant
(Object o, Object sourceLocation) static ModelASTValue
fromGString
(String gstring, Object sourceLocation) getValue()
Returns a value or an expression that represents this value.int
hashCode()
abstract boolean
If the value can be determined without side-effect at AST parsing time, this method returns true, andgetValue()
returns its value.net.sf.json.JSONObject
toJSON()
Translates this element and any children it may have into JSON conforming to the schema.toString()
void
validate
(ModelValidator validator) Called to do whatever validation is necessary for this element.Methods inherited from class org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTElement
getSourceLocation, nullIfEmpty, removeSourceLocation, removeSourceLocationsFrom, removeSourceLocationsFrom, removeSourceLocationsFrom, removeSourceLocationsFrom, setSourceLocation, toGroovy, toGroovy, toGroovy, toGroovyArgList, toGroovyArgList, toGroovyBlock, toGroovyBlock, toGroovyBlock, toGroovyCheckEmpty, toJSON, toJSONArray, toJSONArray, toJSONCheckEmpty, toJSONObject, validate, validate, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTMarkerInterface
removeSourceLocation, toGroovy
-
Method Details
-
isLiteral
public abstract boolean isLiteral()If the value can be determined without side-effect at AST parsing time, this method returns true, andgetValue()
returns its value.- Returns:
true
if the value can be determined without side-effects at AST parsing time.
-
getValue
Returns a value or an expression that represents this value. This model is used at the compile time, so it's not always possible to obtain the actual value. Imagine something likesecret('12345')
or evenpow(2,10)
. In case the value is an expression, this method returns a string represntation suitable for the editor. For example, if the value isfoobar(x)
, we want the editor to show "${foobar(x)}"- Returns:
- returens the value or an expression that represents this value.
-
validate
Description copied from class:ModelASTElement
Called to do whatever validation is necessary for this element. Overridden in most cases.- Specified by:
validate
in interfaceModelASTMarkerInterface
- Overrides:
validate
in classModelASTElement
- Parameters:
validator
- AModelValidator
to use for more complicated validation.
-
toJSON
@NonNull public net.sf.json.JSONObject toJSON()Description copied from class:ModelASTElement
Translates this element and any children it may have into JSON conforming to the schema.- Specified by:
toJSON
in interfaceModelASTMarkerInterface
- Specified by:
toJSON
in classModelASTElement
- Returns:
- Generally a
JSONObject
orJSONArray
but for some leaf nodes, may be aString
or other simple class.
-
equals
Description copied from class:ModelASTElement
- Overrides:
equals
in classModelASTElement
-
hashCode
public int hashCode()Description copied from class:ModelASTElement
- Overrides:
hashCode
in classModelASTElement
-
toString
Description copied from class:ModelASTElement
- Overrides:
toString
in classModelASTElement
-
fromConstant
-
fromGString
-