|
Lines 72-81
Link Here
|
| 72 |
/** The Map of embeddables in this metamodel keyed on Class **/ |
72 |
/** The Map of embeddables in this metamodel keyed on Class **/ |
| 73 |
protected Map<Class, EmbeddableTypeImpl<?>> embeddables; |
73 |
protected Map<Class, EmbeddableTypeImpl<?>> embeddables; |
| 74 |
|
74 |
|
| 75 |
/** The Map of managed types in this metamodel keyed on Class **/ |
75 |
/** The Map of managed types (Entity, Embeddable and MappedSuperclass) in this metamodel keyed on Class **/ |
| 76 |
protected Map<Class, ManagedTypeImpl<?>> managedTypes; |
76 |
protected Map<Class, ManagedTypeImpl<?>> managedTypes; |
| 77 |
|
77 |
|
| 78 |
/** The Map of types in this metamodel keyed on Class **/ |
78 |
/** The Map of types (Entity, Embeddable, MappedSuperclass and Basic - essentially Basic + managedTypes) in this metamodel keyed on Class **/ |
| 79 |
private Map<Class, TypeImpl<?>> types; |
79 |
private Map<Class, TypeImpl<?>> types; |
| 80 |
|
80 |
|
| 81 |
/** The Set of MappedSuperclassTypes in this metamodel**/ |
81 |
/** The Set of MappedSuperclassTypes in this metamodel**/ |
|
Lines 313-327
Link Here
|
| 313 |
*/ |
313 |
*/ |
| 314 |
public <X> ManagedType<X> type(Class<X> clazz) { |
314 |
public <X> ManagedType<X> type(Class<X> clazz) { |
| 315 |
Object aType = this.managedTypes.get(clazz); |
315 |
Object aType = this.managedTypes.get(clazz); |
| 316 |
return (ManagedType<X>)aType; |
316 |
// Throw an IAE exception if the returned type is not a ManagedType |
| 317 |
// IAE exception is disabled until bug# 285512 is fixed |
317 |
// However in this case the type will usually be null - as no Basic types are in the managedTypes Map |
| 318 |
/* if(aType instanceof ManagedType) { |
318 |
if(null == aType) { |
| 319 |
return (ManagedType<X>) this.managedTypes.get(clazz); |
319 |
// return null as there is no way to check the return type for isManagedType |
| 320 |
} else { |
320 |
return null; |
| 321 |
throw new IllegalArgumentException(ExceptionLocalization.buildMessage( |
321 |
} else { |
| 322 |
"metamodel_class_incorrect_type_instance", |
322 |
if(aType instanceof ManagedType) { |
| 323 |
new Object[] { clazz, "ManagedType", aType})); |
323 |
return (ManagedType<X>) this.managedTypes.get(clazz); |
| 324 |
}*/ |
324 |
} else { |
|
|
325 |
throw new IllegalArgumentException(ExceptionLocalization.buildMessage( |
| 326 |
"metamodel_class_incorrect_type_instance", |
| 327 |
new Object[] { clazz, "ManagedType", aType})); |
| 328 |
} |
| 329 |
} |
| 325 |
} |
330 |
} |
| 326 |
|
331 |
|
| 327 |
/** |
332 |
/** |