use of org.wildfly.swarm.spi.runtime.annotations.ConfigurationValue in project wildfly-swarm by wildfly-swarm.
the class ConfigurationValueProducer method produceOptionalConfigValue.
@SuppressWarnings("unchecked")
@ConfigurationValue("")
@Dependent
@Produces
<T> Optional<T> produceOptionalConfigValue(InjectionPoint injectionPoint) {
Type type = injectionPoint.getAnnotated().getBaseType();
final Class<T> valueType;
if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) type;
Type[] typeArguments = parameterizedType.getActualTypeArguments();
valueType = unwrapType(typeArguments[0]);
} else {
valueType = (Class<T>) String.class;
}
return Optional.ofNullable(resolve(injectionPoint, valueType));
}
Aggregations