/** Sets the value of the attribute */ public void setValue(Object bean, QName name, Object value) throws ConfigException { try { if (value instanceof XmlBeanConfig<?>) { XmlBeanConfig<?> config = (XmlBeanConfig<?>) value; value = config.toObject(); } else if (value instanceof AnnotationConfig) { AnnotationConfig config = (AnnotationConfig) value; value = config.replace(); } if (_setMethod != null && value != null) { if (!_setMethod.getParameterTypes()[0].isAssignableFrom(value.getClass())) throw new ConfigException( L.l( "'{0}.{1}' is not assignable from {2}", _setMethod.getDeclaringClass().getSimpleName(), _setMethod.getName(), value)); _setMethod.invoke(bean, value); } } catch (Exception e) { throw ConfigException.create(e); } }
/** Converts the string to a value of the type. */ public Object valueOf(String text) { AnnotationConfig ann = new AnnotationConfig(this, _annClass); if (!"".equals(text)) { // ioc/04e2 Attribute attr = getAttribute(TEXT); if (attr == null) throw new ConfigException(L.l("'{0}' does not support value", this)); attr.setText(ann, TEXT, text); } // ioc/2183 return ann.replace(); }