org.hibernate.search.bridge.builtin.impl.DateResolutionUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-search-engine Show documentation
Show all versions of hibernate-search-engine Show documentation
Core of the Object/Lucene mapper, query engine and index management
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.search.bridge.builtin.impl;
import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.DateTools.Resolution;
import org.hibernate.search.exception.AssertionFailure;
public class DateResolutionUtil {
private DateResolutionUtil() {
}
public static Resolution getLuceneResolution(org.hibernate.search.annotations.Resolution hibResolution) {
final Resolution resolution;
switch ( hibResolution ) {
case YEAR:
resolution = DateTools.Resolution.YEAR;
break;
case MONTH:
resolution = DateTools.Resolution.MONTH;
break;
case DAY:
resolution = DateTools.Resolution.DAY;
break;
case HOUR:
resolution = DateTools.Resolution.HOUR;
break;
case MINUTE:
resolution = DateTools.Resolution.MINUTE;
break;
case SECOND:
resolution = DateTools.Resolution.SECOND;
break;
case MILLISECOND:
resolution = DateTools.Resolution.MILLISECOND;
break;
default:
throw new AssertionFailure( "Unknown Resolution: " + hibResolution );
}
return resolution;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy