use of org.jboss.as.service.descriptor.JBossServiceAttributeConfig.ValueFactoryParameter in project wildfly by wildfly.
the class ParsedServiceDeploymentProcessor method getValue.
private static Value<?> getValue(final ValueFactory valueFactory, final ClassLoader classLoader) throws DeploymentUnitProcessingException {
final String methodName = valueFactory.getMethodName();
final ValueFactoryParameter[] parameters = valueFactory.getParameters();
final List<Class<?>> paramTypes = new ArrayList<Class<?>>(parameters.length);
final List<Value<?>> paramValues = new ArrayList<Value<?>>(parameters.length);
for (ValueFactoryParameter parameter : parameters) {
final Class<?> attributeTypeValue = ReflectionUtils.getClass(parameter.getType(), classLoader);
paramTypes.add(attributeTypeValue);
paramValues.add(new ImmediateValue<Object>(newValue(attributeTypeValue, parameter.getValue())));
}
final Value<Method> methodValue = new InjectedBeanMethodValue(Values.injectedValue(), new InjectedBeanMethodValue.MethodFinder() {
@Override
public Method find(Class<?> clazz) {
return ReflectionUtils.getMethod(clazz, methodName, paramTypes.toArray(new Class<?>[0]));
}
});
return cached(new MethodValue<Object>(methodValue, Values.injectedValue(), paramValues));
}
Aggregations