// needed for field access: I cannot work in the proxied version
Object unproxiedInstance = unproxy( instance, objectInitializer );
// process the class bridges
for ( int i = 0; i < propertiesMetadata.classBridges.size(); i++ ) {
FieldBridge fb = propertiesMetadata.classBridges.get( i );
final String fieldName = propertiesMetadata.classNames.get( i );
final FieldBridge oneWayConversionContext = conversionContext.oneWayConversionContext( fb );
conversionContext.pushProperty( fieldName );
try {
oneWayConversionContext.set(
fieldName, unproxiedInstance,
doc, propertiesMetadata.getClassLuceneOptions( i )
);
}
finally {
conversionContext.popProperty();
}
}
// process the indexed fields
XMember previousMember = null;
Object currentFieldValue = null;
for ( int i = 0; i < propertiesMetadata.fieldNames.size(); i++ ) {
XMember member = propertiesMetadata.fieldGetters.get( i );
if ( previousMember != member ) {
currentFieldValue = unproxy( ReflectionHelper.getMemberValue( unproxiedInstance, member ),
objectInitializer );
previousMember = member;
if ( member.isCollection() ) {
if ( currentFieldValue instanceof Collection ) {
objectInitializer.initializeCollection( (Collection) currentFieldValue );
}
else if ( currentFieldValue instanceof Map ) {
objectInitializer.initializeMap( (Map) currentFieldValue );
}
}
}
final FieldBridge fieldBridge = propertiesMetadata.fieldBridges.get( i );
final String fieldName = propertiesMetadata.fieldNames.get( i );
final FieldBridge oneWayConversionContext = conversionContext.oneWayConversionContext( fieldBridge );
conversionContext.pushProperty( propertiesMetadata.fieldGetterNames.get( i ) );
try {
oneWayConversionContext.set(
fieldName, currentFieldValue, doc,
propertiesMetadata.getFieldLuceneOptions( i, currentFieldValue )
);
}
finally {