MCPcopy Index your code
hub / github.com/google/dagger / valueOf

Method valueOf

java/dagger/internal/codegen/CompilerOptions.java:213–238  ·  view source on GitHub ↗
(
      ProcessingEnvironment processingEnv, String key, T defaultValue, Set<T> validValues)

Source from the content-addressed store, hash-verified

211 }
212
213 private static <T extends Enum<T>> T valueOf(
214 ProcessingEnvironment processingEnv, String key, T defaultValue, Set<T> validValues) {
215 Map<String, String> options = processingEnv.getOptions();
216 if (options.containsKey(key)) {
217 try {
218 T type =
219 Enum.valueOf(defaultValue.getDeclaringClass(), Ascii.toUpperCase(options.get(key)));
220 if (!validValues.contains(type)) {
221 throw new IllegalArgumentException(); // let handler below print out good msg.
222 }
223 return type;
224 } catch (IllegalArgumentException e) {
225 processingEnv
226 .getMessager()
227 .printMessage(
228 Diagnostic.Kind.ERROR,
229 "Processor option -A"
230 + key
231 + " may only have the values "
232 + validValues
233 + " (case insensitive), found: "
234 + options.get(key));
235 }
236 }
237 return defaultValue;
238 }
239}

Calls 3

containsMethod · 0.80
printMessageMethod · 0.80
getMethod · 0.65

Tested by 1

greetingsMethod · 0.64