javax.annotation.processing.SupportedOptions Java Examples
The following examples show how to use
javax.annotation.processing.SupportedOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PluginEnvironment.java From squidb with Apache License 2.0 | 6 votes |
/** * Add a {@link Plugin} class to the list of known plugins * * @param plugin the plugin class * @param priority the priority to give the plugin */ private void addPlugin(Class<? extends Plugin> plugin, PluginPriority priority) { switch (priority) { case LOW: lowPriorityPlugins.add(plugin); break; case HIGH: highPriorityPlugins.add(plugin); break; case NORMAL: default: normalPriorityPlugins.add(plugin); break; } SupportedOptions supportedOptionsAnnotation = plugin.getAnnotation(SupportedOptions.class); if (supportedOptionsAnnotation != null) { String[] options = supportedOptionsAnnotation.value(); Collections.addAll(pluginSupportedOptions, options); } }
Example #2
Source File: AutoValueExtension.java From auto with Apache License 2.0 | 3 votes |
/** * Analogous to {@link Processor#getSupportedOptions()}, here to allow extensions to report their * own. * * <p>By default, if the extension class is annotated with {@link SupportedOptions}, this will * return a set with the strings in the annotation. If the class is not so annotated, an empty set * is returned. * * @return the set of options recognized by this extension or an empty set if none * @see SupportedOptions */ public Set<String> getSupportedOptions() { SupportedOptions so = this.getClass().getAnnotation(SupportedOptions.class); if (so == null) { return ImmutableSet.of(); } else { return ImmutableSet.copyOf(so.value()); } }