Class JsonConditionalNode
java.lang.Object
com.northconcepts.datapipeline.json.builder.JsonNode
com.northconcepts.datapipeline.json.builder.JsonFragment
com.northconcepts.datapipeline.json.builder.JsonConditionalNode
A fragment of a
JsonTemplate whose nodes are written only when its logical expression is true; created by
when(String).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarray()Adds an anonymous array element and returns it; only arrays (and the template root) accept one.Adds an array-valued field and returns the new array; only valid on object nodes.protected DataExceptionWraps the throwable in aDataExceptionwith this node's type, class and children; subclasses add their own details.Adds a scalar field whose name and value are computed by the given expressions; only valid on object nodes.getNodes(ExpressionContext context) Returns this node's children; a conditional node returns null when its condition is false in the given context.booleanhasNodes(ExpressionContext context) Returns true if this node has children to write in the given context; a conditional node also requires its condition.object()Adds an anonymous object element and returns it; only arrays (and the template root) accept one.Adds an object-valued field and returns the new object; only valid on object nodes.Adds a scalar element whose value is computed by the given expression; only valid on array nodes.Methods inherited from class com.northconcepts.datapipeline.json.builder.JsonFragment
detail, getParentNode, getType, when, writeEndImpl, writeStartImplMethods inherited from class com.northconcepts.datapipeline.json.builder.JsonNode
add, assertType, isMarker, writeEnd, writeStart
-
Constructor Details
-
JsonConditionalNode
-
-
Method Details
-
getCondition
-
hasNodes
public boolean hasNodes(ExpressionContext context) Description copied from class:JsonNodeReturns true if this node has children to write in the given context; a conditional node also requires its condition. -
getNodes
Description copied from class:JsonNodeReturns this node's children; a conditional node returns null when its condition is false in the given context. -
object
Description copied from class:JsonNodeAdds an object-valued field and returns the new object; only valid on object nodes. -
array
Description copied from class:JsonNodeAdds an array-valued field and returns the new array; only valid on object nodes. -
field
Description copied from class:JsonNodeAdds a scalar field whose name and value are computed by the given expressions; only valid on object nodes. -
object
Description copied from class:JsonNodeAdds an anonymous object element and returns it; only arrays (and the template root) accept one. -
array
Description copied from class:JsonNodeAdds an anonymous array element and returns it; only arrays (and the template root) accept one. -
value
Description copied from class:JsonNodeAdds a scalar element whose value is computed by the given expression; only valid on array nodes. -
exception
Description copied from class:JsonNodeWraps the throwable in aDataExceptionwith this node's type, class and children; subclasses add their own details.- Overrides:
exceptionin classJsonFragment
-