Package org.hibernate.search.util.impl

Source Code of org.hibernate.search.util.impl.FilterCacheModeTypeHelper

/*
* 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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.util.impl;

import org.hibernate.search.annotations.FilterCacheModeType;
import org.hibernate.search.exception.AssertionFailure;

/**
* @author Emmanuel Bernard
*/
public class FilterCacheModeTypeHelper {

  private FilterCacheModeTypeHelper() { }

  public static boolean cacheInstance(FilterCacheModeType type) {
    switch ( type ) {
      case NONE:
        return false;
      case INSTANCE_AND_DOCIDSETRESULTS:
        return true;
      case INSTANCE_ONLY:
        return true;
      default:
        throw new AssertionFailure("Unknown FilterCacheModeType:" + type);
    }
  }

  public static boolean cacheResults(FilterCacheModeType type) {
    switch ( type ) {
      case NONE:
        return false;
      case INSTANCE_AND_DOCIDSETRESULTS:
        return true;
      case INSTANCE_ONLY:
        return false;
      default:
        throw new AssertionFailure("Unknown FilterCacheModeType:" + type);
    }
  }
}
TOP

Related Classes of org.hibernate.search.util.impl.FilterCacheModeTypeHelper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.