use of io.undertow.UndertowOptions in project adeptj-runtime by AdeptJ.
the class BaseOptions method getOption.
/**
* Search the given {@link Option} first in UndertowOptions class and if not found then Options class.
*
* @param name the option name
* @param <T> the option type
* @return Option of correct resolved type as per the field type.
*/
@SuppressWarnings("unchecked")
<T> Option<T> getOption(String name) {
Option<T> option = null;
try {
Field field = FieldUtils.getDeclaredField(UndertowOptions.class, name);
if (field == null) {
field = FieldUtils.getDeclaredField(Options.class, name);
}
if (field == null) {
this.logger.error("[{}] field is not found either in class UndertowOptions or Options", name);
}
option = (field == null ? null : (Option<T>) field.get(null));
} catch (IllegalArgumentException | IllegalAccessException ex) {
this.logger.error("Exception while accessing field: [{}]", name, ex);
}
return option;
}
Aggregations