Author: epbernard
Date: 2008-03-30 12:48:48 -0400 (Sun, 30 Mar 2008)
New Revision: 14486
Modified:
search/trunk/src/java/org/hibernate/search/bridge/BridgeFactory.java
Log:
HSEARCH-163 better error resport on @ClassBridge implementing the wrong interfaces
Modified: search/trunk/src/java/org/hibernate/search/bridge/BridgeFactory.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/bridge/BridgeFactory.java 2008-03-30
16:41:58 UTC (rev 14485)
+++ search/trunk/src/java/org/hibernate/search/bridge/BridgeFactory.java 2008-03-30
16:48:48 UTC (rev 14486)
@@ -120,6 +120,17 @@
if ( FieldBridge.class.isAssignableFrom( impl ) ) {
bridge = (FieldBridge) instance;
}
+ else if ( org.hibernate.search.bridge.TwoWayStringBridge.class.isAssignableFrom(
impl ) ) {
+ bridge = new TwoWayString2FieldBridgeAdaptor(
+ (org.hibernate.search.bridge.TwoWayStringBridge) instance );
+ }
+ else if ( org.hibernate.search.bridge.StringBridge.class.isAssignableFrom( impl ) )
{
+ bridge = new String2FieldBridgeAdaptor( (org.hibernate.search.bridge.StringBridge)
instance );
+ }
+ else {
+ throw new SearchException("@ClassBridge implementation implements none of the
field bridge interfaces: "
+ + impl );
+ }
if ( cb.params().length > 0 &&
ParameterizedBridge.class.isAssignableFrom( impl ) ) {
Map params = new HashMap( cb.params().length );
for ( Parameter param : cb.params() ) {
@@ -175,7 +186,7 @@
}
( (ParameterizedBridge) instance ).setParameterValues( params );
}
- throw new SearchException("@FieldBridge bridge does not implement any of the
expected interfaces: " + member.getName() );
+
}
catch (Exception e) {
//TODO add classname
Show replies by date