[hibernate-commits] Hibernate SVN: r18818 - in search/trunk/src/main/java/org/hibernate/search: query and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Feb 17 07:07:30 EST 2010


Author: epbernard
Date: 2010-02-17 07:07:29 -0500 (Wed, 17 Feb 2010)
New Revision: 18818

Modified:
   search/trunk/src/main/java/org/hibernate/search/FullTextQuery.java
   search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java
Log:
HSEARCH-422 support for the new methods

Modified: search/trunk/src/main/java/org/hibernate/search/FullTextQuery.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/FullTextQuery.java	2010-02-17 12:00:26 UTC (rev 18817)
+++ search/trunk/src/main/java/org/hibernate/search/FullTextQuery.java	2010-02-17 12:07:29 UTC (rev 18818)
@@ -136,8 +136,9 @@
 	FullTextQuery setResultTransformer(ResultTransformer transformer);
 
 	/**
-	 * return the underlying type if possible
-	 * TODO document what can be unwrapped
+	 * return the underlying type if possible or IllegalArgumentException otherwise
+	 * Supported types are:
+	 *  - org.apache.lucene.search.Query the underlying lucene query
 	 */
 	<T> T unwrap(Class<T> type);
 }

Modified: search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java	2010-02-17 12:00:26 UTC (rev 18817)
+++ search/trunk/src/main/java/org/hibernate/search/query/FullTextQueryImpl.java	2010-02-17 12:07:29 UTC (rev 18818)
@@ -902,23 +902,26 @@
 	}
 
 	public <T> T unwrap(Class<T> type) {
-		return null;  //To change body of implemented methods use File | Settings | File Templates.
+		if ( type == org.apache.lucene.search.Query.class) {
+			return (T) luceneQuery;
+		}
+		throw new IllegalArgumentException("Cannot unwrap " + type.getName() );
 	}
 
 	protected LockOptions getLockOptions() {
-		return null;
+		throw new UnsupportedOperationException( "Lock options are not implemented in Hibernate Search queries" );
 	}
 
 	public int executeUpdate() throws HibernateException {
-		throw new HibernateException( "Not supported operation" );
+		throw new UnsupportedOperationException( "executeUpdate is not supported in Hibernate Search queries" );
 	}
 
 	public Query setLockMode(String alias, LockMode lockMode) {
-		return null;
+		throw new UnsupportedOperationException( "Lock options are not implemented in Hibernate Search queries" );
 	}
 
 	protected Map getLockModes() {
-		return null;
+		throw new UnsupportedOperationException( "Lock options are not implemented in Hibernate Search queries" );
 	}
 
 	public FullTextFilter enableFullTextFilter(String name) {



More information about the hibernate-commits mailing list