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 inModelASTEnvironment,ModelASTNamedArgumentListand elsewhere.- Author:
- Andrew Bayer, Kohsuke Kawaguchi
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static ModelASTValuefromConstant(Object o, Object sourceLocation)static ModelASTValuefromGString(String gstring, Object sourceLocation)ObjectgetValue()Returns a value or an expression that represents this value.inthashCode()abstract booleanisLiteral()If 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.StringtoString()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, 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 Detail
-
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
public Object 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
public void validate(@NonNull ModelValidator validator)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
public boolean equals(Object o)
Description copied from class:ModelASTElement- Overrides:
equalsin classModelASTElement
-
hashCode
public int hashCode()
Description copied from class:ModelASTElement- Overrides:
hashCodein classModelASTElement
-
toString
public String toString()
Description copied from class:ModelASTElement- Overrides:
toStringin classModelASTElement
-
fromConstant
public static ModelASTValue fromConstant(Object o, Object sourceLocation)
-
fromGString
public static ModelASTValue fromGString(String gstring, Object sourceLocation)
-
-