// ### probably compiling this to 2 arrays might be quicker and smaller
for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
Expression expression = (Expression) entry.getValue();
Class type = dynaTag.getAttributeType(name);
Object value = null;
if (type != null && type.isAssignableFrom(Expression.class) && !type.isAssignableFrom(Object.class)) {
value = expression;
}
else {
value = expression.evaluateRecurse(context);
}
dynaTag.setAttribute(name, value);
}
}
else {
// treat the tag as a bean
DynaBean dynaBean = new ConvertingWrapDynaBean( tag );
for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
Expression expression = (Expression) entry.getValue();
DynaProperty property = dynaBean.getDynaClass().getDynaProperty(name);
if (property == null) {
throw new JellyException("This tag does not understand the '" + name + "' attribute" );
}
Class type = property.getType();
Object value = null;
if (type.isAssignableFrom(Expression.class) && !type.isAssignableFrom(Object.class)) {
value = expression;
}
else {
value = expression.evaluateRecurse(context);
}
dynaBean.set(name, value);
}
}