本文整理了Java中org.xnio.Option.getName()
方法的一些代码示例,展示了Option.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.getName()
方法的具体详情如下:
包路径:org.xnio.Option
类名称:Option
方法名:getName
[英]Get the name of this option.
[中]获取此选项的名称。
代码示例来源:origin: jooby-project/jooby
@SuppressWarnings("rawtypes")
private static Consumer<Map.Entry<String, ConfigValue>> setOption(final Config config,
final String level,
final BiConsumer<Option, Object> setter) {
return entry -> {
String name = entry.getKey();
Object value = entry.getValue().unwrapped();
Option option = findOption(name, UndertowOptions.class, Options.class);
if (option != null) {
// parse option to adjust correct type
Object parsedValue = value.toString();
try {
parsedValue = option.parseValue(value.toString(), null);
} catch (NumberFormatException ex) {
// try bytes
try {
parsedValue = option.parseValue(config.getBytes(level + "." + name).toString(), null);
} catch (ConfigException.BadValue badvalue) {
// try duration
parsedValue = option.parseValue(
config.getDuration(level + "." + name, TimeUnit.MILLISECONDS) + "", null);
}
}
log.debug("{}.{}({})", level, option.getName(), parsedValue);
setter.accept(option, parsedValue);
} else {
log.error("Unknown option: 'undertow.{}.{} = {}'", level, name, value);
}
};
}
代码示例来源:origin: io.skullabs.kikaha/kikaha-core
private static void populate(Option option) {
final String name = option.getName();
OPTIONS.put(name, option);
}
代码示例来源:origin: stackoverflow.com
private void onFileClick(Option o) {
String path = o.getName();
Intent data = new Intent();
data.putExtra("path", path);
setResult(Activity.RESULT_OK, data);
finish();
}
代码示例来源:origin: SoftInstigate/restheart
@SuppressWarnings("unchecked")
public static void setConnectionOptions(
Builder builder,
Configuration configuration) {
Map<String, Object> options = configuration.getConnectionOptions();
UNDERTOW_OPTIONS.stream().forEach(option -> {
if (options.containsKey(option.getName())) {
Object value = options.get(option.getName());
if (value != null) {
builder.setServerOption(option, value);
LOGGER.trace("Connection option {}={}", option.getName(), value);
}
}
});
LONG_UNDERTOW_OPTIONS.stream().forEach(option -> {
if (options.containsKey(option.getName())) {
Object value = options.get(option.getName());
if (value != null) {
Long lvalue = 0l + (Integer) value;
builder.setServerOption(option, lvalue);
LOGGER.trace("Connection option {}={}", option.getName(), lvalue);
}
}
});
}
代码示例来源:origin: io.joshworks.snappy/snappy
public static void serverConfig(OptionMap.Builder options) {
System.err.println("--------------- SERVER CONFIG ---------------");
options.getMap().forEach(option -> {
System.err.println(String.format("%s: %s", option.getName().replaceAll("_", " ").toLowerCase(), options.getMap().get(option)));
});
System.err.println();
}
代码示例来源:origin: stackoverflow.com
public class ParseXML {
public static void main(String[] args) {
final OptionsParser handler = new OptionsParser();
try {
SAXParserFactory.newInstance().newSAXParser()
.parse("C:/luna/sample/inputs/options.xml", handler);
} catch (SAXException | IOException | ParserConfigurationException e) {
System.err.println("Somethig went wrong while parsing the input file the exception is -- " + e.getMessage() + " -- ");
}
Map<String, Option> result = handler.getResultAsMap();
Collection<Option> values = result.values();
for (Option option : values) {
System.out.println(option.getName());
}
}
}
代码示例来源:origin: wildfly/wildfly-core
private static AuthenticationConfiguration configureSaslMechanisms(Map<String, String> saslOptions, boolean isLocal, AuthenticationConfiguration authenticationConfiguration) {
String[] mechanisms = null;
String listed;
if (saslOptions != null && (listed = saslOptions.get(Options.SASL_DISALLOWED_MECHANISMS.getName())) != null) {
// Disallowed mechanisms were passed via the saslOptions map; need to convert to an XNIO option
String[] split = listed.split(" ");
if (isLocal) {
mechanisms = new String[split.length + 1];
mechanisms[0] = JBOSS_LOCAL_USER;
System.arraycopy(split, 0, mechanisms, 1, split.length);
} else {
mechanisms = split;
}
} else if (!isLocal) {
mechanisms = new String[]{ JBOSS_LOCAL_USER };
}
return (mechanisms != null && mechanisms.length > 0) ? authenticationConfiguration.setSaslMechanismSelector(SaslMechanismSelector.DEFAULT.forbidMechanisms(mechanisms)) : authenticationConfiguration;
}
代码示例来源:origin: io.joshworks/snappy
public static void serverConfig(OptionMap.Builder options) {
System.err.println("--------------- SERVER CONFIG ---------------");
options.getMap().forEach(option -> {
System.err.println(String.format("%s: %s", option.getName().replaceAll("_", " ").toLowerCase(), options.getMap().get(option)));
});
System.err.println();
}
代码示例来源:origin: org.wildfly.core/wildfly-protocol
private static AuthenticationConfiguration configureSaslMechanisms(Map<String, String> saslOptions, boolean isLocal, AuthenticationConfiguration authenticationConfiguration) {
String[] mechanisms = null;
String listed;
if (saslOptions != null && (listed = saslOptions.get(Options.SASL_DISALLOWED_MECHANISMS.getName())) != null) {
// Disallowed mechanisms were passed via the saslOptions map; need to convert to an XNIO option
String[] split = listed.split(" ");
if (isLocal) {
mechanisms = new String[split.length + 1];
mechanisms[0] = JBOSS_LOCAL_USER;
System.arraycopy(split, 0, mechanisms, 1, split.length);
} else {
mechanisms = split;
}
} else if (!isLocal) {
mechanisms = new String[]{ JBOSS_LOCAL_USER };
}
return (mechanisms != null && mechanisms.length > 0) ? authenticationConfiguration.setSaslMechanismSelector(SaslMechanismSelector.DEFAULT.forbidMechanisms(mechanisms)) : authenticationConfiguration;
}
代码示例来源:origin: stackoverflow.com
fileName.setText(o.getName());
代码示例来源:origin: stackoverflow.com
t1.Text = o.getName().ToString();
if (t2 != null)
t2.Text = o.getData().ToString();
代码示例来源:origin: io.joshworks/snappy-core
public static void deploymentInfo(boolean bindAddress,
boolean httpTracer,
int port,
boolean httpMetrics,
List<ExecutorConfig> executorConfig,
List<SchedulerConfig> schedulerConfig,
OptionMap.Builder options,
List<MappedEndpoint> endpoints, String basePath) {
System.err.println("---------------- HTTP CONFIG ----------------");
System.err.println(String.format("Bind address: %s", bindAddress));
System.err.println(String.format("Port: %d", port));
System.err.println(String.format("Http tracer : %b", httpTracer));
System.err.println(String.format("Http metrics: %b", httpMetrics));
System.err.println();
System.err.println("--------------- SERVER CONFIG ---------------");
options.getMap().forEach(option -> {
System.err.println(String.format("%s: %s", option.getName().replaceAll("_", " ").toLowerCase(), options.getMap().get(option)));
});
System.err.println();
System.err.println("------------- APP THREAD CONFIG -------------");
if (executorConfig.isEmpty() && schedulerConfig.isEmpty()) {
System.err.println("No executors configured (default will be used)");
}
executorConfig.forEach(exec -> logExecutors(exec.getName(), exec.getExecutor()));
schedulerConfig.forEach(entry -> logExecutors(entry.getName(), entry.getScheduler()));
System.err.println();
System.err.println("----------------- ENDPOINTS -----------------");
logEndpoints(endpoints, basePath);
System.err.println();
}
代码示例来源:origin: org.jooby/jooby-undertow
@SuppressWarnings("rawtypes")
private static Consumer<Map.Entry<String, ConfigValue>> setOption(final Config config,
final String level,
final BiConsumer<Option, Object> setter) {
return entry -> {
String name = entry.getKey();
Object value = entry.getValue().unwrapped();
Option option = findOption(name, UndertowOptions.class, Options.class);
if (option != null) {
// parse option to adjust correct type
Object parsedValue = value.toString();
try {
parsedValue = option.parseValue(value.toString(), null);
} catch (NumberFormatException ex) {
// try bytes
try {
parsedValue = option.parseValue(config.getBytes(level + "." + name).toString(), null);
} catch (ConfigException.BadValue badvalue) {
// try duration
parsedValue = option.parseValue(
config.getDuration(level + "." + name, TimeUnit.MILLISECONDS) + "", null);
}
}
log.debug("{}.{}({})", level, option.getName(), parsedValue);
setter.accept(option, parsedValue);
} else {
log.error("Unknown option: 'undertow.{}.{} = {}'", level, name, value);
}
};
}
代码示例来源:origin: org.apache.camel/camel-undertow
Option option = Option.fromString(key, cl);
value = option.parseValue(value.toString(), cl);
LOG.trace("Parsed option {}={}", option.getName(), value);
builder.set(option, value);
代码示例来源:origin: wildfly/wildfly-core
saslOptions = new HashMap<>(saslOptions);
saslOptions.remove(Options.SASL_DISALLOWED_MECHANISMS.getName());
mergedConfiguration = mergedConfiguration.useMechanismProperties(saslOptions);
代码示例来源:origin: org.wildfly.core/wildfly-protocol
saslOptions = new HashMap<>(saslOptions);
saslOptions.remove(Options.SASL_DISALLOWED_MECHANISMS.getName());
mergedConfiguration = mergedConfiguration.useMechanismProperties(saslOptions);
代码示例来源:origin: wildfly/wildfly-core
Option<?> optionMechanismNames = Option.fromString("org.xnio.Options."+ Options.SASL_MECHANISMS.getName(), loader);
String[] mechanismNames = null;
if(connectorPropertiesOptionMap.contains(optionMechanismNames)) {
Option<?> optionPolicyNonanonymous = Option.fromString("org.xnio.Options."+ Options.SASL_POLICY_NOANONYMOUS.getName(), loader);
内容来源于网络,如有侵权,请联系作者删除!