|
|
@ -5,6 +5,10 @@ import com.jayway.jsonpath.internal.EvaluationContext; |
|
|
|
import com.jayway.jsonpath.internal.PathRef; |
|
|
|
import com.jayway.jsonpath.internal.PathRef; |
|
|
|
import net.minidev.json.JSONArray; |
|
|
|
import net.minidev.json.JSONArray; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Provides the length of a JSONArray Object |
|
|
|
* Provides the length of a JSONArray Object |
|
|
|
* |
|
|
|
* |
|
|
@ -18,6 +22,9 @@ public class Length implements Function { |
|
|
|
JSONArray array = (JSONArray)model; |
|
|
|
JSONArray array = (JSONArray)model; |
|
|
|
return Integer.valueOf(array.size()); |
|
|
|
return Integer.valueOf(array.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (model instanceof Map) { |
|
|
|
|
|
|
|
return Integer.valueOf(((Map) model).size()); |
|
|
|
|
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |