
com.adobe.aemds.guide.xfa.XFAJSONWriter 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.xfa;
import com.adobe.aemds.guide.service.GuideException;
import com.adobe.aemds.guide.utils.CustomJSONWriter;
import java.io.Writer;
import java.util.Enumeration;
import java.util.Hashtable;
/**
* @pad.exclude Exclude from Published API.
*/
public class XFAJSONWriter extends CustomJSONWriter {
public XFAJSONWriter(Writer w) {
super(w);
}
public XFAJSONWriter startObject(String key) throws GuideException {
if(key != null) {
key(key);
} else {
key = "null";
}
objectStack.push(key);
return (XFAJSONWriter)object();
}
public XFAJSONWriter completeObject(String key) throws GuideException {
if(key == null) {
key = "null";
}
String top = objectStack.pop();
if(!key.equals(top)) {
throw new GuideException("ending object which was not started " + key);
}
return (XFAJSONWriter)endObject();
}
public XFAJSONWriter writeArray(String[] arr) throws GuideException{
for(int i =0;i props) {
Enumeration propEnum = props.keys();
while(propEnum.hasMoreElements()) {
String prop = propEnum.nextElement();
Object value = props.get(prop);
if(value instanceof String[]) {
((XFAJSONWriter)key(prop).array())
.writeArray((String[]) value)
.endArray();
} else {
key(prop).value(value);
}
}
return (XFAJSONWriter)this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy