public static FileExtension getFileExtensionById(Class fileExtnsionEnumClass, String extension)
    {
        if(fileExtnsionEnumClass == null || extension == null)
            throw new NullPointerException("Invalid parameter(s): 'fileExtnsionEnumClass' and 'extension' can not be NULL.");

        if(!fileExtnsionEnumClass.isEnum())
            throw new IllegalArgumentException("Invalid parameter 'fileExtnsionEnumClass'. The parameter must exends Enum class.");

        if(!FileExtension.class.isAssignableFrom(fileExtnsionEnumClass))
            throw new IllegalArgumentException("Invalid parameter 'fileExtnsionEnumClass'. The class must implements 'FileExtension' interface.");

        String className = fileExtnsionEnumClass.getName();
        TreeMap<String, FileExtension> enumMap = fileExtensionsMap.get(className);
        if(enumMap == null)
        {
            enumMap = new TreeMap<String, FileExtension>();
            for(Object enumObject : fileExtnsionEnumClass.getEnumConstants())
            {
                FileExtension fileExt = (FileExtension)enumObject;
                String ext = fileExt.getExtension();
                if(ext != null)
                {
                    enumMap.put(ext, fileExt);
                }
            }
            fileExtensionsMap.put(className, enumMap);
        }

        if(extension.charAt(0) != '.')
            return enumMap.get("." + extension.toLowerCase());
        else
            return enumMap.get(extension.toLowerCase());
    }