All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.aemds.guide.utils.CustomJSONWriter Maven / Gradle / Ivy

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2014 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

package com.adobe.aemds.guide.utils;

import com.adobe.aemds.guide.service.GuideException;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.io.JSONWriter;

import java.io.StringWriter;
import java.io.Writer;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Stack;

/**
 * Extending JSONReader, just to get rid of annoying CheckedException
 * Should not be exported.
 * @pad.exclude Exclude from Published API.
 */

public class CustomJSONWriter extends JSONWriter {

    public Stack objectStack;

    public CustomJSONWriter(Writer w) {
        super(w);
        objectStack = new Stack();
    }

    public CustomJSONWriter array() {
        try{
            return (CustomJSONWriter)super.array();
        }catch (Exception e){
            throw new GuideException(e);
        }
    }

    public CustomJSONWriter endArray() {
        try{
            return (CustomJSONWriter)super.endArray();
        }catch (Exception e){
            throw new GuideException(e);
        }
    }

    public CustomJSONWriter endObject()  {
        try{
            return (CustomJSONWriter)super.endObject();
        }catch (Exception e){
            throw new GuideException(e);
        }
    }

    public CustomJSONWriter key(String s) {
        try{
            return (CustomJSONWriter)super.key(s);
        }catch (Exception e){
            throw new GuideException(e);
        }
    }

    public CustomJSONWriter object() {
        try{
            return (CustomJSONWriter)super.object();
        }catch (Exception e){
            throw new GuideException(e);
        }
    }

    public CustomJSONWriter value(boolean b) {
        try{
            return (CustomJSONWriter)super.value(b);
        }catch (Exception e){
            throw new GuideException(e);
        }
    }

    public CustomJSONWriter value(double d) {
        try{
            return (CustomJSONWriter)super.value(d);
        }catch (Exception e){
            throw new GuideException(e);
        }
    }

    public CustomJSONWriter value(long l) {
        try{
            return (CustomJSONWriter)super.value(l);
        }catch (Exception e){
            throw new GuideException(e);
        }
    }

    public CustomJSONWriter value(Object o)  {
        try{
            return (CustomJSONWriter)super.value(o);
        }catch (Exception e){
            throw new GuideException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy