org.mapfish.print.wrapper.yaml.PYamlObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of print-lib Show documentation
Show all versions of print-lib Show documentation
Library for generating PDFs and images from online webmapping services
package org.mapfish.print.wrapper.yaml;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.mapfish.print.ExceptionUtils;
import org.mapfish.print.wrapper.PAbstractObject;
import org.mapfish.print.wrapper.PArray;
import org.mapfish.print.wrapper.PElement;
import org.mapfish.print.wrapper.PObject;
import org.mapfish.print.wrapper.json.PJsonObject;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Object wrapper for Yaml parsing.
*/
public class PYamlObject extends PAbstractObject {
private final Map obj;
/**
* Constructor.
*
* @param obj the internal json element
* @param contextName the field name of this element in the parent.
*/
public PYamlObject(final Map obj, final String contextName) {
this(null, obj, contextName);
}
/**
* Constructor.
*
* @param parent the parent element
* @param obj the internal json element
* @param contextName the field name of this element in the parent.
*/
public PYamlObject(final PElement parent, final Map obj, final String contextName) {
super(parent, contextName);
this.obj = obj;
}
@SuppressWarnings("unchecked")
@Override
public final Object opt(final String key) {
final Object value = this.obj.get(key);
if (value instanceof Map, ?>) {
return new PYamlObject(this, (Map) value, key);
} else if (value instanceof List>) {
return new PYamlArray(this, (List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy