expectedType = Object.class;
} else {
expectedType = propertyType;
}
ResourceParameter resourceParameter = getDependency();
String expression = resourceParameter.expression();
String name = resourceParameter.name();
if (expression.length() != 0 && name.length() != 0) {
throw new IllegalStateException(MessageFormat.format(
"'name' and 'expression' should not be specified simultaneously: {0}", resourceParameter));
}
Object propertyValue = null;
if (expression.length() != 0) {
propertyValue = getExpressionValue(context, expression, expectedType);
} else {
if (name.length() == 0) {
name = getPropertyDescriptor().getName();
}
Map<String, Object> parameters = (Map<String, Object>) context.getAttributes().get(
ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME);
propertyValue = parameters.get(name);
}
if (propertyValue == null || "".equals(propertyValue)) {
String defaultValue = resourceParameter.defaultValue();
if (defaultValue != null && defaultValue.length() != 0) {
propertyValue = getExpressionValue(context, defaultValue, expectedType);
}
}