Examples of XClass


Examples of org.hibernate.annotations.common.reflection.XClass

   *
   * @return this (for method chaining)
   */
  @SuppressWarnings({ "unchecked" })
  public Configuration addAnnotatedClass(Class annotatedClass) {
    XClass xClass = reflectionManager.toXClass( annotatedClass );
    metadataSourceQueue.add( xClass );
    return this;
  }
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

    }

    protected void syncAnnotatedClasses() {
      final Iterator<XClass> itr = annotatedClasses.iterator();
      while ( itr.hasNext() ) {
        final XClass annotatedClass = itr.next();
        if ( annotatedClass.isAnnotationPresent( Entity.class ) ) {
          annotatedClassesByEntityNameMap.put( annotatedClass.getName(), annotatedClass );
          continue;
        }

        if ( !annotatedClass.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) {
          itr.remove();
        }
      }
    }
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

      // order the hierarchy
      List<XClass> workingCopy = new ArrayList<XClass>( copy );
      List<XClass> newList = new ArrayList<XClass>( copy.size() );
      while ( workingCopy.size() > 0 ) {
        XClass clazz = workingCopy.get( 0 );
        orderHierarchy( workingCopy, newList, copy, clazz );
      }
      return newList;
    }
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

      return newList;
    }

    private void insertMappedSuperclasses(List<XClass> original, List<XClass> copy) {
      for ( XClass clazz : original ) {
        XClass superClass = clazz.getSuperclass();
        while ( superClass != null
            && !reflectionManager.equals( superClass, Object.class )
            && !copy.contains( superClass ) ) {
          if ( superClass.isAnnotationPresent( Entity.class )
              || superClass.isAnnotationPresent( javax.persistence.MappedSuperclass.class ) ) {
            copy.add( superClass );
          }
          superClass = superClass.getSuperclass();
        }
      }
    }
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

    DirectoryProviderFactory factory = new DirectoryProviderFactory();

    while ( iter.hasNext() ) {
      Class mappedClass = iter.next();
      if (mappedClass != null) {
        XClass mappedXClass = reflectionManager.toXClass(mappedClass);
        if ( mappedXClass != null) {
          if ( mappedXClass.isAnnotationPresent( Indexed.class ) ) {
            DirectoryProviderFactory.DirectoryProviders providers = factory.createDirectoryProviders( mappedXClass, cfg, this, reflectionManager );
            //FIXME DocumentBuilder needs to be built by a helper method receiving Class<T> to infer T properly
            //XClass unfortunately is not (yet) genericized: TODO?
            final DocumentBuilder<?> documentBuilder = new DocumentBuilder(
                mappedXClass, context, providers.getProviders(), providers.getSelectionStrategy(),
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

    return allowFieldSelectionInProjection;
  }

  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 = clazz.getSuperclass();
    }
    return id;
  }
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

    for (XClass currClass = clazz; currClass != null; currClass = currClass.getSuperclass()) {
      hierarchy.add( currClass );
    }
    Class similarityClass = null;
    for (int index = hierarchy.size() - 1; index >= 0; index--) {
      XClass currClass = hierarchy.get( index );
      /**
       * Override the default analyzer for the properties if the class hold one
       * That's the reason we go down the hierarchy
       */
      Analyzer analyzer = getAnalyzer( currClass, context );

      if ( analyzer != null ) {
        propertiesMetadata.analyzer = analyzer;
      }
      checkForAnalyzerDefs( currClass, context );
      // Check for any ClassBridges annotation.
      ClassBridges classBridgesAnn = currClass.getAnnotation( ClassBridges.class );
      if ( classBridgesAnn != null ) {
        ClassBridge[] cbs = classBridgesAnn.value();
        for (ClassBridge cb : cbs) {
          bindClassAnnotation( prefix, propertiesMetadata, cb, context );
        }
      }

      // Check for any ClassBridge style of annotations.
      ClassBridge classBridgeAnn = currClass.getAnnotation( ClassBridge.class );
      if ( classBridgeAnn != null ) {
        bindClassAnnotation( prefix, propertiesMetadata, classBridgeAnn, context );
      }

      //Get similarity
      //TODO: similarity form @IndexedEmbedded are not taken care of. Exception??
      if ( isRoot ) {
        org.hibernate.search.annotations.Similarity similarityAnn = currClass.getAnnotation( org.hibernate.search.annotations.Similarity.class );
        if ( similarityAnn != null ) {
          if ( similarityClass != null ) {
            throw new SearchException( "Multiple Similarities defined in the same class hierarchy: " + beanClass.getName() );
          }
          similarityClass = similarityAnn.impl();
        }
      }

      //rejecting non properties (ie regular methods) because the object is loaded from Hibernate,
      // so indexing a non property does not make sense
      List<XProperty> methods = currClass.getDeclaredProperties( XClass.ACCESS_PROPERTY );
      for (XProperty method : methods) {
        initializeMember( method, propertiesMetadata, isRoot, prefix, processedClasses, context );
      }

      List<XProperty> fields = currClass.getDeclaredProperties( XClass.ACCESS_FIELD );
      for (XProperty field : fields) {
        initializeMember( field, propertiesMetadata, isRoot, prefix, processedClasses, context );
      }
    }
    if ( isRoot && similarityClass != null ) {
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

        potentialLevel = Integer.MAX_VALUE;
      }
      maxLevel = potentialLevel > maxLevel ? maxLevel : potentialLevel;
      level++;

      XClass elementClass;
      if ( void.class == embeddedAnn.targetElement() ) {
        elementClass = member.getElementClass();
      }
      else {
        elementClass = reflectionManager.toXClass( embeddedAnn.targetElement() );
      }
      if ( maxLevel == Integer.MAX_VALUE //infinite
          && processedClasses.contains( elementClass ) ) {
        throw new SearchException(
            "Circular reference. Duplicate use of "
                + elementClass.getName()
                + " in root entity " + beanClass.getName()
                + "#" + buildEmbeddedPrefix( prefix, embeddedAnn, member )
        );
      }
      if ( level <= maxLevel ) {
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

    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();
    }
    return id;
  }
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

  private void initializeClass(XClass clazz, PropertiesMetadata propertiesMetadata, boolean isRoot, String prefix,
                 Set<XClass> processedClasses, ConfigContext context, Set<XClass> optimizationBlackList,
                 boolean disableOptimizationsArg, PathsContext pathsContext) {
    List<XClass> hierarchy = new LinkedList<XClass>();
    XClass next;
    for ( XClass previousClass = clazz; previousClass != null; previousClass = next ) {
      next = previousClass.getSuperclass();
      if ( next != null ) {
        hierarchy.add( 0, previousClass ); // append to head to create a list in top-down iteration order
      }
View Full Code Here
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.