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

com.composum.platform.models.simple.ViewValueMap Maven / Gradle / Ivy

Go to download

Bundle containing features for the general use of Models incl. Sling-Models bundled as a package

The newest version!
package com.composum.platform.models.simple;

import org.apache.commons.lang3.StringUtils;
import org.apache.sling.api.wrappers.ValueMapDecorator;

import java.util.Map;

public class ViewValueMap extends ValueMapDecorator {

    public ViewValueMap(Map base) {
        super(base);
    }

    /**
     * assuming the Map.get() is used in templates a multi value is joined to a String
     */
    @Override
    public Object get(Object key) {
        Object value = super.get(key);
        return value instanceof Object[] ? StringUtils.join((Object[]) value, ", ") : value;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy