ContentPolicyStyle.java 3.73 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.cq.wcm.api.designer.Cell
 *  com.day.cq.wcm.api.designer.Design
 *  com.day.cq.wcm.api.designer.Style
 *  com.day.cq.wcm.api.policies.ContentPolicy
 *  org.apache.sling.api.resource.Resource
 *  org.apache.sling.api.resource.ValueMap
 *  org.apache.sling.api.wrappers.ValueMapDecorator
 */
package com.day.cq.wcm.scripting.impl;

import com.day.cq.wcm.api.designer.Cell;
import com.day.cq.wcm.api.designer.Design;
import com.day.cq.wcm.api.designer.Style;
import com.day.cq.wcm.api.policies.ContentPolicy;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.api.wrappers.ValueMapDecorator;

/*
 * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
 */
public class ContentPolicyStyle
implements Style {
    private final ContentPolicy contentPolicy;
    private final Cell cell;
    private ValueMap properties;

    public ContentPolicyStyle(ContentPolicy contentPolicy, Cell cell) {
        if (contentPolicy == null) {
            throw new IllegalArgumentException("contentPolicy is null");
        }
        this.contentPolicy = contentPolicy;
        this.cell = cell;
    }

    private void initProperties() {
        if (this.properties == null) {
            this.properties = this.contentPolicy.getProperties();
            if (this.properties == null) {
                this.properties = new ValueMapDecorator(new HashMap());
            }
        }
    }

    public Design getDesign() {
        return null;
    }

    public String getPath() {
        return this.contentPolicy.getPath();
    }

    public Cell getCell() {
        return this.cell;
    }

    public <T> T get(String name, Class<T> type) {
        this.initProperties();
        return (T)this.properties.get(name, type);
    }

    public <T> T get(String name, T defaultValue) {
        this.initProperties();
        return (T)this.properties.get(name, defaultValue);
    }

    public Resource getDefiningResource(String name) {
        return null;
    }

    public String getDefiningPath(String name) {
        return null;
    }

    public Style getSubStyle(String relPath) {
        return null;
    }

    public int size() {
        this.initProperties();
        return this.properties.size();
    }

    public boolean isEmpty() {
        this.initProperties();
        return this.properties.isEmpty();
    }

    public boolean containsKey(Object o) {
        this.initProperties();
        return this.properties.containsKey(o);
    }

    public boolean containsValue(Object o) {
        this.initProperties();
        return this.properties.containsValue(o);
    }

    public Object get(Object o) {
        this.initProperties();
        return this.properties.get(o);
    }

    public Object put(String s, Object o) {
        this.initProperties();
        return this.properties.put((Object)s, o);
    }

    public Object remove(Object o) {
        this.initProperties();
        return this.properties.remove(o);
    }

    public void putAll(Map<? extends String, ?> map) {
        this.initProperties();
        this.properties.putAll(map);
    }

    public void clear() {
        this.initProperties();
        this.properties.clear();
    }

    public Set<String> keySet() {
        this.initProperties();
        return this.properties.keySet();
    }

    public Collection<Object> values() {
        this.initProperties();
        return this.properties.values();
    }

    public Set<Map.Entry<String, Object>> entrySet() {
        this.initProperties();
        return this.properties.entrySet();
    }
}