Package org.hibernate.annotations.common.reflection

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


    ReflectionManager reflectionManager = SearchFactoryImpl.getReflectionManager(cfg);
    //get the most specialized (ie subclass > superclass) non default index name
    //if none extract the name from the most generic (superclass > subclass) @Indexed class in the hierarchy
    //FIXME I'm inclined to get rid of the default value
    PersistentClass pc = cfg.getClassMapping( clazz.getName() );
    XClass rootIndex = null;
    do {
      XClass currentClazz = reflectionManager.toXClass( pc.getMappedClass() );
      Indexed indexAnn = currentClazz.getAnnotation( Indexed.class );
      if ( indexAnn != null ) {
        if ( indexAnn.index().length() != 0 ) {
          return indexAnn.index();
        }
        else {
View Full Code Here


    // 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

    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( MappedSuperclass.class ) ) {
          copy.add( superClass );
        }
        superClass = superClass.getSuperclass();
      }
    }
  }
View Full Code Here

   * @param persistentClass the mapped class
   *
   * @return the configuration object
   */
  public AnnotationConfiguration addAnnotatedClass(Class persistentClass) throws MappingException {
    XClass persistentXClass = reflectionManager.toXClass( persistentClass );
    try {
      annotatedClasses.add( persistentXClass );
      return this;
    }
    catch ( MappingException me ) {
View Full Code Here

   *
   * @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

    }

    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

      // 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

      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

    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

    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

TOP

Related Classes of org.hibernate.annotations.common.reflection.XClass

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.