@Override public Object convert(ComplexDefinition definition, Type type) { List<ComplexDefinition.Entry> attributes = definition.getAttributes(); // if we have used templates, there may be multiple attributes with the same name String name = null; Definition def = null; for (ComplexDefinition.Entry attr : attributes) { if (name == null) { name = attr.name; def = attr.definition; } else if (!name.equals(attr.name)) { throw new IllegalArgumentException("Single attribute expected"); } else { def = def.apply(attr.definition); } } return instantiate(name, def); }