Package org.hibernate.annotations.common.reflection.java

Examples of org.hibernate.annotations.common.reflection.java.JavaReflectionManager


    ResourceBundle rb = (ResourceBundle) ois.readObject();
    if ( rb == null ) rb = getDefaultResourceBundle();
    this.messageBundle = rb;
    this.userInterpolator = (MessageInterpolator) ois.readObject();
    this.defaultMessageBundle = ResourceBundle.getBundle( DEFAULT_VALIDATOR_MESSAGE );
    reflectionManager = new JavaReflectionManager();
    initValidator( reflectionManager.toXClass( beanClass ), new HashMap<XClass, ClassValidator>() );
  }
View Full Code Here


        reflectionManager =
            (ReflectionManager) cfg.getClass().getMethod( "getReflectionManager" ).invoke( cfg );

      }
      catch (Exception e) {
        reflectionManager = new JavaReflectionManager();
      }
      while ( classes.hasNext() ) {
        PersistentClass clazz = classes.next();
        final Class mappedClass = clazz.getMappedClass();
        ClassValidator validator =
View Full Code Here

    XProperty generic = contained.getType().getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 );
    assertTrue( generic.isTypeResolved() );
  }

  public void test2StepsGenericsCollection() throws Exception {
    JavaReflectionManager factory = new JavaReflectionManager();
    XClass container = factory.toXClass( ContainerWithCollection.class );
    XProperty collection = container.getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 );
    assertTrue( collection.isTypeResolved() );
    XClass elementClass = collection.getElementClass();
    XProperty generic = elementClass.getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 );
    assertTrue( generic.isTypeResolved() );
View Full Code Here

/**
* @author Emmanuel Bernard
*/
public class DeepGenericsInheritance extends TestCase {
  public void test2StepsGenerics() throws Exception {
    JavaReflectionManager factory = new JavaReflectionManager();
    XClass subclass2 = factory.toXClass( Subclass2.class );
    XClass dummySubclass = factory.toXClass( DummySubclass.class );
    XClass superclass = subclass2.getSuperclass();
    XClass supersuperclass = superclass.getSuperclass();
    assertTrue( supersuperclass.getDeclaredProperties( "field" ).get( 1 ).isTypeResolved() );
    assertEquals( dummySubclass, supersuperclass.getDeclaredProperties( "field" ).get( 1 ).getType() );

View Full Code Here

     */
    public ClassValidator(
      Class<T> beanClass, ResourceBundle resourceBundle, MessageInterpolator interpolator,
            Map<XClass, ClassValidator> childClassValidators, ReflectionManager reflectionManager
    ) {
        this.reflectionManager = reflectionManager != null ? reflectionManager : new JavaReflectionManager();
        XClass beanXClass = this.reflectionManager.toXClass( beanClass );
    this.beanClass = beanClass;
    this.messageBundle = resourceBundle == null ?
        getDefaultResourceBundle() :
        resourceBundle;
View Full Code Here

    ResourceBundle rb = (ResourceBundle) ois.readObject();
    if ( rb == null ) rb = getDefaultResourceBundle();
    this.messageBundle = rb;
    this.userInterpolator = (MessageInterpolator) ois.readObject();
    this.defaultMessageBundle = ResourceBundle.getBundle( DEFAULT_VALIDATOR_MESSAGE );
    reflectionManager = new JavaReflectionManager();
    initValidator( reflectionManager.toXClass( beanClass ), new HashMap<XClass, ClassValidator>() );
  }
View Full Code Here

  public static class ContainerWithCollection {
    List<Contained<String>> contained;
  }

  public void test2StepsGenerics() throws Exception {
    JavaReflectionManager factory = new JavaReflectionManager();
    XClass container = factory.toXClass( Container.class );
    XProperty contained = container.getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 );
    assertTrue( contained.isTypeResolved() );
    XProperty generic = contained.getType().getDeclaredProperties( XClass.ACCESS_FIELD ).get( 0 );
    assertTrue( generic.isTypeResolved() );
  }
View Full Code Here

  private void createReflectionManager() {
    createReflectionManager( new JPAMetadataProvider() );
  }

  private void createReflectionManager(MetadataProvider metadataProvider) {
    reflectionManager = new JavaReflectionManager();
    ( ( MetadataProviderInjector ) reflectionManager ).setMetadataProvider( metadataProvider );
  }
View Full Code Here

  }

  private static String getDirectoryProviderName(XClass clazz, SearchConfiguration cfg) {
    ReflectionManager reflectionManager = cfg.getReflectionManager();
    if ( reflectionManager == null ) {
      reflectionManager = new JavaReflectionManager();
    }
    //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
    Class<?> aClass = cfg.getClassMapping( clazz.getName() );
View Full Code Here

    return geReflectionManager( reflectionManager );
  }

  private ReflectionManager geReflectionManager(ReflectionManager reflectionManager) {
    if ( reflectionManager == null ) {
      reflectionManager = new JavaReflectionManager();
    }
    return reflectionManager;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.annotations.common.reflection.java.JavaReflectionManager

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.