public static CacheBuilderSpec parse ( String cacheBuilderSpecification ) { CacheBuilderSpec spec = new CacheBuilderSpec ( cacheBuilderSpecification ) ; if ( ! cacheBuilderSpecification . isEmpty ( ) ) { for ( String keyValuePair : KEYS_SPLITTER . split ( cacheBuilderSpecification ) ) { List < String > keyAndValue = ImmutableList . copyOf ( KEY_VALUE_SPLITTER . split ( keyValuePair ) ) ; checkArgument ( ! keyAndValue . isEmpty ( ) , "blank key-value pair" ) ; checkArgument ( keyAndValue . size ( ) <= 2 , "key-value pair %s with more than one equals sign" , keyValuePair ) ; // Find the ValueParser for the current key. String key = keyAndValue . get ( 0 ) ; ValueParser valueParser = VALUE_PARSERS . get ( key ) ; checkArgument ( valueParser != null , "unknown key %s" , key ) ; String value = keyAndValue . size ( ) == 1 ? null : keyAndValue . get ( 1 ) ; valueParser . parse ( spec , key , value ) ; } } return spec ; }
Creates a CacheBuilderSpec from a string .