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

org.apache.struts.faces.util.Utils Maven / Gradle / Ivy

There is a newer version: 1.5.0-RC2
Show newest version
package org.apache.struts.faces.util;

import java.util.Map;

/**
 * This class has some static utils-methods.
 *
 * @author Stefan Graff
 *
 * @since Struts 1.4.1
 */
public class Utils {

    /**
     * Returns the value of a map as expected class.
     *
     * @param  the expected class
     * @param clazz the expected class
     * @param map the map with the values
     * @param key the key to access the map
     *
     * @return the value as expected class
     *
     * @throws ClassCastException if the key is of an
     *     inappropriate type for this map or if the
     *     value is not null and is not assignable to
     *     the type T.
     * @throws NullPointerException if the specified key
     *     is null and this map does not permit null keys.
     */
    public static  T getMapValue(Class clazz, Map map, String key) {
        final Object ret = map.get(key);
        return clazz.cast(ret);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy