}
}
private void bindFilterDef(FullTextFilterDef defAnn, XClass mappedXClass) {
if ( filterDefinitions.containsKey( defAnn.name() ) ) {
throw new SearchException("Multiple definition of @FullTextFilterDef.name=" + defAnn.name() + ": "
+ mappedXClass.getName() );
}
FilterDef filterDef = new FilterDef(defAnn);
try {
filterDef.getImpl().newInstance();
}
catch (IllegalAccessException e) {
throw new SearchException("Unable to create Filter class: " + filterDef.getImpl().getName(), e);
}
catch (InstantiationException e) {
throw new SearchException("Unable to create Filter class: " + filterDef.getImpl().getName(), e);
}
for ( Method method : filterDef.getImpl().getMethods() ) {
if ( method.isAnnotationPresent( Factory.class ) ) {
if ( filterDef.getFactoryMethod() != null ) {
throw new SearchException("Multiple @Factory methods found" + defAnn.name() + ": "
+ filterDef.getImpl().getName() + "." + method.getName() );
}
if ( !method.isAccessible() ) method.setAccessible( true );
filterDef.setFactoryMethod( method );
}
if ( method.isAnnotationPresent( Key.class ) ) {
if ( filterDef.getKeyMethod() != null ) {
throw new SearchException("Multiple @Key methods found" + defAnn.name() + ": "
+ filterDef.getImpl().getName() + "." + method.getName() );
}
if ( !method.isAccessible() ) method.setAccessible( true );
filterDef.setKeyMethod( method );
}