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

com.liferay.layout.converter.FlexWrapConverter Maven / Gradle / Ivy

There is a newer version: 50.2.0
Show newest version
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

package com.liferay.layout.converter;

import com.liferay.portal.kernel.util.HashMapBuilder;

import java.util.Map;
import java.util.Objects;
import java.util.Set;

/**
 * @author Sandro Chinea
 */
public class FlexWrapConverter {

	public static final Map externalToInternalValuesMap =
		HashMapBuilder.put(
			"NoWrap", "flex-nowrap"
		).put(
			"Wrap", "flex-wrap"
		).put(
			"WrapReverse", "flex-wrap-reverse"
		).build();

	public static String convertToExternalValue(String value) {
		Set externalValues = externalToInternalValuesMap.keySet();

		for (String externalValue : externalValues) {
			if (Objects.equals(
					value, externalToInternalValuesMap.get(externalValue))) {

				return externalValue;
			}
		}

		return null;
	}

	public static String convertToInternalValue(String label) {
		return externalToInternalValuesMap.get(label);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy