public class OptionsParser extends Object
OptionDescriptors. The OptionDescriptors are loaded via a ServiceLoader.| Modifier and Type | Field and Description |
|---|---|
static float |
FUZZY_MATCH_THRESHOLD |
| Constructor and Description |
|---|
OptionsParser() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
collectFuzzyMatches(Iterable<OptionDescriptor> toSearch,
String name,
Collection<OptionDescriptor> matches)
Collects the set of options that fuzzy match a given option name.
|
static Iterable<OptionDescriptors> |
getOptionsLoader()
Gets an iterable of available
OptionDescriptors. |
static void |
parseOption(String name,
Object uncheckedValue,
org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values,
Iterable<OptionDescriptors> loader)
Parses a given option name and value.
|
static void |
parseOptions(org.graalvm.collections.EconomicMap<String,String> optionSettings,
org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values,
Iterable<OptionDescriptors> loader)
Parses a map representing assignments of values to options.
|
static void |
parseOptionSettingTo(String optionSetting,
org.graalvm.collections.EconomicMap<String,String> dst)
Parses a given option setting string and adds the parsed key and value
dst. |
static Object |
parseOptionValue(OptionDescriptor desc,
Object uncheckedValue)
Parses a given option value with a known descriptor.
|
static void |
setCachedOptionDescriptors(List<OptionDescriptors> list) |
static float |
stringSimilarity(String str1,
String str2)
Compute string similarity based on Dice's coefficient.
|
public static final float FUZZY_MATCH_THRESHOLD
public static Iterable<OptionDescriptors> getOptionsLoader()
OptionDescriptors.public static void setCachedOptionDescriptors(List<OptionDescriptors> list)
public static void parseOptions(org.graalvm.collections.EconomicMap<String,String> optionSettings, org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values, Iterable<OptionDescriptors> loader)
optionSettings - option settings (i.e., assignments of values to options)values - the object in which to store the parsed valuesloader - source of the available OptionDescriptorsIllegalArgumentException - if there's a problem parsing optionpublic static void parseOptionSettingTo(String optionSetting, org.graalvm.collections.EconomicMap<String,String> dst)
dst.optionSetting - a string matching the pattern <name>=<value>public static void parseOption(String name, Object uncheckedValue, org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values, Iterable<OptionDescriptors> loader)
name - the option nameuncheckedValue - the unchecked value for the optionvalues - the object in which to store the parsed option and valueloader - source of the available OptionDescriptorsIllegalArgumentException - if there's a problem parsing optionpublic static Object parseOptionValue(OptionDescriptor desc, Object uncheckedValue)
public static float stringSimilarity(String str1, String str2)
public static boolean collectFuzzyMatches(Iterable<OptionDescriptor> toSearch, String name, Collection<OptionDescriptor> matches)
toSearch - the set of option descriptors to searchname - the option name to search formatches - the collection to which fuzzy matches of name will be added