Package org.hibernate.search.annotations

Examples of org.hibernate.search.annotations.ProvidedId


  private PropertyMetadata providedIdMetadata(XClass clazz, ConfigContext context, ReflectionManager reflectionManager) {
    PropertyMetadata propertyMetadata = null;

    FieldBridge providedIdFieldBridge = null;
    String providedIdFieldName = null;
    ProvidedId provided = findProvidedId( clazz, reflectionManager );
    if ( provided != null ) {
      providedIdFieldBridge = BridgeFactory.extractTwoWayType( provided.bridge(), clazz, reflectionManager );
      providedIdFieldName = provided.name();
      idProvided = true;
    }
    else if ( context.isProvidedIdImplicit() ) {
      providedIdFieldBridge = new TwoWayString2FieldBridgeAdaptor( org.hibernate.search.bridge.builtin.StringBridge.INSTANCE );
      providedIdFieldName = ProvidedId.defaultFieldName;
View Full Code Here


  public FieldCacheCollectorFactory getIdFieldCacheCollectionFactory() {
    return idFieldCacheCollectorFactory;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

   */
  public DocumentBuilderIndexedEntity(XClass clazz, ConfigContext context, Similarity similarity,
      ReflectionManager reflectionManager, Set<XClass> optimizationBlackList, ClassNavigator classHelper) {
    super( clazz, context, similarity, reflectionManager, optimizationBlackList, classHelper );
    // special case @ProvidedId
    ProvidedId provided = findProvidedId( clazz, reflectionManager );
    if ( provided != null ) {
      idBridge = BridgeFactory.extractTwoWayType( provided.bridge(), clazz, reflectionManager );
      idKeywordName = provided.name();
      idProvided = true;
    }
    if ( idKeywordName == null ) {
      throw new SearchException( "No document id in: " + clazz );
    }
View Full Code Here

    }
    return idAnnotation;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

  public DocumentBuilderIndexedEntity(
      XClass clazz, ConfigContext context, DirectoryProviderFactory.DirectoryProviders providerWrapper, ReflectionManager reflectionManager) {

    super( clazz, context, providerWrapper.getSimilarity(), reflectionManager );
    // special case @ProvidedId
    ProvidedId provided = findProvidedId( clazz, reflectionManager );
    if ( provided != null ) {
      idBridge = BridgeFactory.extractTwoWayType( provided.bridge(), clazz, reflectionManager );
      idKeywordName = provided.name();
      idProvided = true;
    }
    if ( idKeywordName == null ) {
      throw new SearchException( "No document id in: " + clazz );
    }
View Full Code Here

    }
    return idAnnotation;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

   */
  public DocumentBuilderIndexedEntity(XClass clazz, ConfigContext context, Similarity similarity,
      ReflectionManager reflectionManager, Set<XClass> optimizationBlackList, InstanceInitializer instanceInitializer) {
    super( clazz, context, similarity, reflectionManager, optimizationBlackList, instanceInitializer );
    // special case @ProvidedId
    ProvidedId provided = findProvidedId( clazz, reflectionManager );
    if ( provided != null ) {
      idBridge = BridgeFactory.extractTwoWayType( provided.bridge(), clazz, reflectionManager );
      idKeywordName = provided.name();
      idProvided = true;
    }
    if ( idKeywordName == null ) {
      throw new SearchException( "No document id in: " + clazz );
    }
View Full Code Here

    }
    return idAnnotation;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

      boolean disableOptimizationsArg,
      PathsContext pathsContext) {
    List<XClass> hierarchy = ReflectionHelper.createXClassHierarchy( parseContext.getCurrentClass() );

    // Iterate the class hierarchy top down. This allows to override the default analyzer for the properties if the class holds one
    ProvidedId explicitProvidedIdAnnotation = null;
    XClass providedIdHostingClass = null;
    for ( XClass currentClass : hierarchy ) {
      if ( currentClass.getAnnotation( ProvidedId.class ) != null ) {
        explicitProvidedIdAnnotation = currentClass.getAnnotation( ProvidedId.class );
        providedIdHostingClass = currentClass;
View Full Code Here

    this.directoryProviders = directoryProviders;
    this.shardingStrategy = shardingStrategy;

    if ( idKeywordName == null ) {
      // if no DocumentId then check if we have a ProvidedId instead
      ProvidedId provided = findProvidedId( clazz, reflectionManager );
      if ( provided == null ) {
        throw new SearchException( "No document id in: " + clazz.getName() );
      }

      idBridge = BridgeFactory.extractTwoWayType( provided.bridge() );
      idKeywordName = provided.name();
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.annotations.ProvidedId

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.