org.mule.module.json.JsonNodeExpressionEvaluator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mule-module-json Show documentation
Show all versions of mule-module-json Show documentation
Implementation of JSON transformers for Mule
The newest version!
/*
* Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/
package org.mule.module.json;
import org.mule.routing.AbstractSplitter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.node.ArrayNode;
import org.codehaus.jackson.node.ValueNode;
/**
* An JSON expression evaluator that returns {@link JsonNode}'s instead of strings.
* Arrays are still returned as a {@link List} rather than as an {@link ArrayNode} to
* enable splitting using the {@link AbstractSplitter}
*
* @see org.mule.module.json.JsonData
* @see JsonExpressionEvaluator
*/
public class JsonNodeExpressionEvaluator extends JsonExpressionEvaluator
{
@Override
protected Object extractResultFromNode(JsonNode result)
{
if (result instanceof ValueNode)
{
return result.asText();
}
if (result instanceof ArrayNode)
{
List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy