Package org.hibernate.search.filter

Examples of org.hibernate.search.filter.FilterKey


    return filter;
  }

  private FilterKey createFilterKey(FilterDef def, Object instance) {
    FilterKey key = null;
    if ( !cacheInstance( def.getCacheMode() ) ) {
      return key; // if the filter is not cached there is no key!
    }

    if ( def.getKeyMethod() == null ) {
      key = new FilterKey() {
        public int hashCode() {
          return getImpl().hashCode();
        }

        public boolean equals(Object obj) {
          if ( !( obj instanceof FilterKey ) ) {
            return false;
          }
          FilterKey that = (FilterKey) obj;
          return this.getImpl().equals( that.getImpl() );
        }
      };
    }
    else {
      try {
View Full Code Here


    if ( isPreQueryFilterOnly( def ) ) {
      return null;
    }

    Object instance = createFilterInstance( fullTextFilter, def );
    FilterKey key = createFilterKey( def, instance );

    // try to get the filter out of the cache
    Filter filter = cacheInstance( def.getCacheMode() ) ?
        searchFactoryImplementor.getFilterCachingStrategy().getCachedFilter( key ) :
        null;
View Full Code Here

    return filter;
  }

  private FilterKey createFilterKey(FilterDef def, Object instance) {
    FilterKey key = null;
    if ( !cacheInstance( def.getCacheMode() ) ) {
      return key; // if the filter is not cached there is no key!
    }

    if ( def.getKeyMethod() == null ) {
      key = new FilterKey() {
        @Override
        public int hashCode() {
          return getImpl().hashCode();
        }

        @Override
        public boolean equals(Object obj) {
          if ( !( obj instanceof FilterKey ) ) {
            return false;
          }
          FilterKey that = (FilterKey) obj;
          return this.getImpl().equals( that.getImpl() );
        }
      };
    }
    else {
      try {
View Full Code Here

    if ( isPreQueryFilterOnly( def ) ) {
      return null;
    }

    Object instance = createFilterInstance( fullTextFilter, def );
    FilterKey key = createFilterKey( def, instance );

    // try to get the filter out of the cache
    Filter filter = cacheInstance( def.getCacheMode() ) ?
        searchFactoryImplementor.getFilterCachingStrategy().getCachedFilter( key ) :
        null;
View Full Code Here

    return filter;
  }

  private FilterKey createFilterKey(FilterDef def, Object instance) {
    FilterKey key = null;
    if ( !cacheInstance( def.getCacheMode() ) ) {
      return key; // if the filter is not cached there is no key!
    }

    if ( def.getKeyMethod() == null ) {
      key = new FilterKey() {
        @Override
        public int hashCode() {
          return getImpl().hashCode();
        }

        @Override
        public boolean equals(Object obj) {
          if ( !( obj instanceof FilterKey ) ) {
            return false;
          }
          FilterKey that = (FilterKey) obj;
          return this.getImpl().equals( that.getImpl() );
        }
      };
    }
    else {
      try {
View Full Code Here

    if ( isPreQueryFilterOnly( def ) ) {
      return null;
    }

    Object instance = createFilterInstance( fullTextFilter, def );
    FilterKey key = createFilterKey( def, instance );

    // try to get the filter out of the cache
    Filter filter = cacheInstance( def.getCacheMode() ) ?
        searchFactoryImplementor.getFilterCachingStrategy().getCachedFilter( key ) :
        null;
View Full Code Here

    return filter;
  }

  private FilterKey createFilterKey(FilterDef def, Object instance) {
    FilterKey key = null;
    if ( !cacheInstance( def.getCacheMode() ) ) {
      return key; // if the filter is not cached there is no key!
    }

    if ( def.getKeyMethod() == null ) {
      key = new FilterKey() {
        public int hashCode() {
          return getImpl().hashCode();
        }

        public boolean equals(Object obj) {
          if ( !( obj instanceof FilterKey ) ) {
            return false;
          }
          FilterKey that = ( FilterKey ) obj;
          return this.getImpl().equals( that.getImpl() );
        }
      };
    }
    else {
      try {
View Full Code Here

          def.invoke( entry.getKey(), instance, entry.getValue() );
        }
        if ( def.isCache() && def.getKeyMethod() == null && filterDefinition.getParameters().size() > 0 ) {
          throw new SearchException("Filter with parameters and no @Key method: " + filterDefinition.getName() );
        }
        FilterKey key = null;
        if ( def.isCache() ) {
          if ( def.getKeyMethod() == null ) {
            key = new FilterKey( ) {
              public int hashCode() {
                return getImpl().hashCode();
              }

              public boolean equals(Object obj) {
                if ( ! ( obj instanceof FilterKey ) ) return false;
                FilterKey that = (FilterKey) obj;
                return this.getImpl().equals( that.getImpl() );
              }
            };
          }
          else {
            try {
View Full Code Here

            }
            if (def.isCache() && def.getKeyMethod() == null && filterDefinition.getParameters().size() > 0)
            {
               throw new SearchException("Filter with parameters and no @Key method: " + filterDefinition.getName());
            }
            FilterKey key = null;
            if (def.isCache())
            {
               if (def.getKeyMethod() == null)
               {
                  key = new FilterKey()
                  {
                     public int hashCode()
                     {
                        return getImpl().hashCode();
                     }

                     public boolean equals(Object obj)
                     {
                        if (!(obj instanceof FilterKey)) return false;
                        FilterKey that = (FilterKey) obj;
                        return this.getImpl().equals(that.getImpl());
                     }
                  };
               }
               else
               {
View Full Code Here

    if ( isPreQueryFilterOnly( def ) ) {
      return null;
    }

    Object instance = createFilterInstance( fullTextFilter, def );
    FilterKey key = createFilterKey( def, instance );

    // try to get the filter out of the cache
    Filter filter = cacheInstance( def.getCacheMode() ) ?
        searchFactoryImplementor.getFilterCachingStrategy().getCachedFilter( key ) :
        null;
View Full Code Here

TOP

Related Classes of org.hibernate.search.filter.FilterKey

Copyright © 2018 www.massapicom. 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.