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

com.adobe.aemds.guide.utils.StyleUtils 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @pad.exclude Exclude from Published API.
 */
public class StyleUtils {
    private static Logger logger = LoggerFactory.getLogger(StyleUtils.class);

    /**
     * Append each style class with the postfix.
     * @param inputClasses Space separated style classes.
     * @param postfix String to be appended to each class of input style classes.
     * @return String containing space separated classes, where each class is appended with postfix.
     */
    public static String addPostfixToClasses(String inputClasses, String postfix) {
        logger.trace("Entered addPostfixToClasses with input classes: " + inputClasses);
        String returnClasses = "";
        StringBuilder postfixedClasses = new StringBuilder();
        if (inputClasses != null && !inputClasses.isEmpty()) {
            String[] classes = inputClasses.split(" ");
            if (classes != null) {
                for(String singleClass : classes) {
                    if (singleClass != null && !singleClass.isEmpty()) {
                        postfixedClasses.append(singleClass + postfix + " ");
                    }
                }
            }
        }
        returnClasses = postfixedClasses.toString().trim();
        logger.trace("Exiting addPostfixToClasses returning classes: " + returnClasses);
        return returnClasses;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy