boolean disableOptimizations,
TypeMetadata.Builder typeMetadataBuilder,
ConfigContext configContext,
PathsContext pathsContext,
ParseContext parseContext) {
IndexedEmbedded indexedEmbeddedAnnotation = member.getAnnotation( IndexedEmbedded.class );
if ( indexedEmbeddedAnnotation == null ) {
return;
}
//collection role in Hibernate is made of the actual hosting class of the member (see HSEARCH-780)
typeMetadataBuilder.addCollectionRole(
StringHelper.qualify(
parseContext.getCurrentClass().getName(), member.getName()
)
);
int oldMaxLevel = parseContext.getMaxLevel();
int potentialLevel = depth( indexedEmbeddedAnnotation ) + parseContext.getLevel();
// This is really catching a possible int overflow. depth() can return Integer.MAX_VALUE, which then can
// overflow in case level > 0. Really this code should be rewritten (HF)
if ( potentialLevel < 0 ) {
potentialLevel = Integer.MAX_VALUE;
}
// HSEARCH-1442 recreating the behavior prior to PropertiesMetadata refactoring
// not sure whether this is algorithmically correct though. @IndexedEmbedded processing should be refactored (HF)
if ( potentialLevel < oldMaxLevel ) {
parseContext.setMaxLevel( potentialLevel );
}
parseContext.incrementLevel();
XClass elementClass;
if ( void.class == indexedEmbeddedAnnotation.targetElement() ) {
elementClass = member.getElementClass();
}
else {
elementClass = reflectionManager.toXClass( indexedEmbeddedAnnotation.targetElement() );
}
if ( parseContext.getMaxLevel() == Integer.MAX_VALUE //infinite
&& parseContext.hasBeenProcessed( elementClass ) ) {
throw new SearchException(