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 TypeMethodDescriptionbooleanstatic ModelASTValuefromConstant(Object o, Object sourceLocation) static ModelASTValuefromGString(String gstring, Object sourceLocation) getValue()Returns a value or an expression that represents this value.inthashCode()abstract booleanIf the value can be determined without side-effect at AST parsing time, this method returns true, andgetValue()returns its value.net.sf.json.JSONObjecttoJSON()Translates this element and any children it may have into JSON conforming to the schema.toString()voidvalidate(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, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
trueif 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:ModelASTElementCalled to do whatever validation is necessary for this element. Overridden in most cases.- Specified by:
validatein interfaceModelASTMarkerInterface- Overrides:
validatein classModelASTElement- Parameters:
validator- AModelValidatorto use for more complicated validation.
-
toJSON
@NonNull public net.sf.json.JSONObject toJSON()Description copied from class:ModelASTElementTranslates this element and any children it may have into JSON conforming to the schema.- Specified by:
toJSONin interfaceModelASTMarkerInterface- Specified by:
toJSONin classModelASTElement- Returns:
- Generally a
JSONObjectorJSONArraybut for some leaf nodes, may be aStringor other simple class.
-
equals
Description copied from class:ModelASTElement- Overrides:
equalsin classModelASTElement
-
hashCode
public int hashCode()Description copied from class:ModelASTElement- Overrides:
hashCodein classModelASTElement
-
toString
Description copied from class:ModelASTElement- Overrides:
toStringin classModelASTElement
-
fromConstant
-
fromGString
-