for (XClass currClass = clazz; currClass != null; currClass = currClass.getSuperclass()) {
hierarchy.add( currClass );
}
Class similarityClass = null;
for (int index = hierarchy.size() - 1; index >= 0; index--) {
XClass currClass = hierarchy.get( index );
/**
* Override the default analyzer for the properties if the class hold one
* That's the reason we go down the hierarchy
*/
Analyzer analyzer = getAnalyzer( currClass, context );
if ( analyzer != null ) {
propertiesMetadata.analyzer = analyzer;
}
checkForAnalyzerDefs( currClass, context );
// Check for any ClassBridges annotation.
ClassBridges classBridgesAnn = currClass.getAnnotation( ClassBridges.class );
if ( classBridgesAnn != null ) {
ClassBridge[] cbs = classBridgesAnn.value();
for (ClassBridge cb : cbs) {
bindClassAnnotation( prefix, propertiesMetadata, cb, context );
}
}
// Check for any ClassBridge style of annotations.
ClassBridge classBridgeAnn = currClass.getAnnotation( ClassBridge.class );
if ( classBridgeAnn != null ) {
bindClassAnnotation( prefix, propertiesMetadata, classBridgeAnn, context );
}
//Get similarity
//TODO: similarity form @IndexedEmbedded are not taken care of. Exception??
if ( isRoot ) {
org.hibernate.search.annotations.Similarity similarityAnn = currClass.getAnnotation( org.hibernate.search.annotations.Similarity.class );
if ( similarityAnn != null ) {
if ( similarityClass != null ) {
throw new SearchException( "Multiple Similarities defined in the same class hierarchy: " + beanClass.getName() );
}
similarityClass = similarityAnn.impl();
}
}
//rejecting non properties (ie regular methods) because the object is loaded from Hibernate,
// so indexing a non property does not make sense
List<XProperty> methods = currClass.getDeclaredProperties( XClass.ACCESS_PROPERTY );
for (XProperty method : methods) {
initializeMember( method, propertiesMetadata, isRoot, prefix, processedClasses, context );
}
List<XProperty> fields = currClass.getDeclaredProperties( XClass.ACCESS_FIELD );
for (XProperty field : fields) {
initializeMember( field, propertiesMetadata, isRoot, prefix, processedClasses, context );
}
}
if ( isRoot && similarityClass != null ) {