private Map < String , String > getVariantMap ( ResourceBundlesHandler bundlesHandler , String contextPath , String bundlePath ) { JoinableResourceBundle bundle = bundlesHandler . resolveBundleForPath ( bundlePath ) ; Set < String > variantTypes = bundle . getVariants ( ) . keySet ( ) ; String variantKey = getVariantKey ( contextPath ) ; String [ ] variantValues = new String [ 0 ] ; if ( variantKey . length ( ) > 0 ) { if ( variantKey . length ( ) == 1 ) { variantValues = new String [ ] { "" , "" } ; } else { variantValues = variantKey . split ( String . valueOf ( JawrConstant . VARIANT_SEPARATOR_CHAR ) ) ; } } Map < String , String > variants = new HashMap <> ( ) ; if ( variantTypes . size ( ) != variantValues . length ) { throw new BundlingProcessException ( "For the resource '" + contextPath + "', the number variant types for the bundle don't match the variant values." ) ; } int i = 0 ; for ( String variantType : variantTypes ) { variants . put ( variantType , variantValues [ i ++ ] ) ; } return variants ; }
Returns the variant map from the context path