Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.jolokia.service.serializer.json;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Stack;
import javax.management.AttributeNotFoundException;
import org.jolokia.server.core.service.serializer.ValueFaultHandler;
import org.jolokia.service.serializer.object.StringToObjectConverter;
import org.json.simple.JSONObject;
/*
* Copyright 2009-2013 Roland Huss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Extractor for Maps (which turns {@link Map} into {@link JSONObject})
*
* @author roland
* @since Apr 19, 2009
*/
public class MapExtractor implements Extractor {
private static final int MAX_STRING_LENGTH = 400;
/** {@inheritDoc} */
public Class getType() {
return Map.class;
}
/**
* Convert a Map to JSON (if jsonify is true). If a path is used, the
* path is interpreted as a key into the map. The key in the path is a string and is compared agains
* all keys in the map against their string representation.
*
* @param pConverter the global converter in order to be able do dispatch for
* serializing inner data types
* @param pValue the value to convert which must be a {@link Map}
* @param pPathParts extra argument stack which on top must be a key into the map
* @param jsonify whether to convert to a JSON object/list or whether the plain object
* should be returned. The later is required for writing an inner value
* @return the extracted object
* @throws AttributeNotFoundException
*/
public Object extractObject(ObjectToJsonConverter pConverter, Object pValue,
Stack pPathParts,boolean jsonify) throws AttributeNotFoundException {
Map