}
if (node == null){
node = new AttributeNodeImpl<X>(attributeName);
addAttributeNodeImpl(node);
}
AttributeGroup localGroup = null;
DatabaseMapping mapping = descriptor.getMappingForAttributeName(attributeName);
if (mapping == null) {
throw new IllegalArgumentException(ExceptionLocalization.buildMessage("metamodel_managed_type_attribute_not_present", new Object[] { this.descriptor.getJavaClassName(), attributeName }));
}
if (!mapping.getContainerPolicy().isMappedKeyMapPolicy() && !((MappedKeyMapContainerPolicy) mapping.getContainerPolicy()).isMapKeyAttribute()) {
throw new IllegalArgumentException(ExceptionLocalization.buildMessage("attribute_is_not_map_with_managed_key", new Object[] { attributeName, descriptor.getJavaClassName() }));
}
localGroup = new AttributeGroup(attributeName, type, true);
ClassDescriptor targetDesc = ((MappedKeyMapContainerPolicy) mapping.getContainerPolicy()).getDescriptorForMapKey();
if (type != null && targetDesc.hasInheritance()) {
targetDesc = targetDesc.getInheritancePolicy().getDescriptor(type);
if (targetDesc == null) {