}
TypeInfo typeInfo = getTypeInfo(fieldType, colHandler, fieldMap);
ExtendedFieldHandler exfHandler = null;
FieldHandler handler = null;
// Check for user supplied FieldHandler
if (fieldMap.getHandler() != null) {
handler = getFieldHandler(fieldMap);
// ExtendedFieldHandler?
if (handler instanceof ExtendedFieldHandler) {
exfHandler = (ExtendedFieldHandler) handler;
}
// Fix for CastorJDO from Steve Vaughan, CastorJDO requires FieldHandlerImpl
// or a ClassCastException will be thrown... [KV 20030131 - also make sure
// this new handler doesn't use it's own CollectionHandler otherwise it'll
// cause unwanted calls to the getValue method during unmarshalling]
colHandler = typeInfo.getCollectionHandler();
typeInfo.setCollectionHandler(null);
handler = new FieldHandlerImpl(handler, typeInfo);
typeInfo.setCollectionHandler(colHandler);
// End Castor JDO fix
}
boolean generalized = (exfHandler instanceof GeneralizedFieldHandler);
// If generalized we need to change the fieldType to whatever is specified in the
// GeneralizedFieldHandler so that the correct getter/setter methods can be found
if (generalized) {
fieldType = ((GeneralizedFieldHandler)exfHandler).getFieldType();
}
if (generalized || (handler == null)) {
// Create TypeInfoRef to get new TypeInfo from call to createFieldHandler
FieldHandler custom = handler;
TypeInfoReference typeInfoRef = new TypeInfoReference();
typeInfoRef.typeInfo = typeInfo;
handler = createFieldHandler(javaClass, fieldType, fieldMap, typeInfoRef);
if (custom != null) {
((GeneralizedFieldHandler) exfHandler).setFieldHandler(handler);