MCPcopy Create free account
hub / github.com/antlr/codebuff / parse

Method parse

output/java_guava/1.4.18/CacheBuilderSpec.java:134–151  ·  view source on GitHub ↗

Creates a CacheBuilderSpec from a string. @param cacheBuilderSpecification the string form

(String cacheBuilderSpecification)

Source from the content-addressed store, hash-verified

132
133
134 public static CacheBuilderSpec parse(String cacheBuilderSpecification) {
135 CacheBuilderSpec spec = new CacheBuilderSpec(cacheBuilderSpecification);
136 if (!cacheBuilderSpecification.isEmpty()) {
137 for (String keyValuePair : KEYS_SPLITTER.split(cacheBuilderSpecification)) {
138 List<String> keyAndValue = ImmutableList.copyOf(KEY_VALUE_SPLITTER.split(keyValuePair));
139 checkArgument(!keyAndValue.isEmpty(), "blank key-value pair");
140 checkArgument(keyAndValue.size() <= 2, "key-value pair %s with more than one equals sign", keyValuePair);
141
142 // Find the ValueParser for the current key.
143 String key = keyAndValue.get(0);
144 ValueParser valueParser = VALUE_PARSERS.get(key);
145 checkArgument(valueParser != null, "unknown key %s", key);
146 String value = keyAndValue.size() == 1 ? null : keyAndValue.get(1);
147 valueParser.parse(spec, key, value);
148 }
149 }
150 return spec;
151 }
152
153 /**
154 * Returns a CacheBuilderSpec that will prevent caching.

Callers 2

fromMethod · 0.95
disableCachingMethod · 0.95

Calls 7

copyOfMethod · 0.95
parseMethod · 0.95
isEmptyMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
splitMethod · 0.45
checkArgumentMethod · 0.45

Tested by

no test coverage detected