}
public Object getEmbeddedModelObject(Proxy proxy, boolean required) {
// Get the property's model object.
PropertyDescriptor descriptor = findPropertyDescriptor(proxy);
Object propertyModelObject = getEmbeddedModelObject(descriptor,
required);
if (required && propertyModelObject == null) {
// The model object for the property does not exist and the caller
// requires it because it needs to modify it. Therefore, a new
// model object needs to be created and associated with this
// property.
//
// As the caller needs to modify the object it cannot be either
// a primitive, unchangeable or abstract type.
ModifiableClassDescriptor modifiable = (ModifiableClassDescriptor)
descriptor.getPropertyType();
propertyModelObject = modifiable.createModelObject();
setEmbeddedModelObject(proxy, propertyModelObject);
}
return propertyModelObject;