Package org.hibernate.annotations.common.reflection

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


    assertEquals( "methodProperty", getConcreteInstance().getName() );
  }

  @Override
  protected XProperty getConcreteInstance() {
    XClass xClass = factory.toXClass( Dad.class );
    List<XProperty> properties = xClass.getDeclaredProperties( "property" );
    for ( XProperty p : properties ) {
      if ( p.getName().equals( "methodProperty" ) ) {
        return p;
      }
    }
View Full Code Here


    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

    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

public class JavaReflectionManagerTest extends TestCase {

  private ReflectionManager rm = new JavaReflectionManager();

  public void testReturnsAnXClassThatWrapsTheGivenClass() {
    XClass xc = rm.toXClass( Integer.class );
    assertEquals( "java.lang.Integer", xc.getName() );
  }
View Full Code Here

    XClass xc = rm.toXClass( Integer.class );
    assertEquals( "java.lang.Integer", xc.getName() );
  }

  public void testReturnsSameXClassForSameClass() {
    XClass xc1 = rm.toXClass( void.class );
    XClass xc2 = rm.toXClass( void.class );
    assertSame( xc2, xc1 );
  }
View Full Code Here

  public void testReturnsNullForANullClass() {
    assertNull( rm.toXClass( null ) );
  }

  public void testComparesXClassesWithClasses() {
    XClass xc = rm.toXClass( Integer.class );
    assertTrue( rm.equals( xc, Integer.class ) );
  }
View Full Code Here

    XClass xc = rm.toXClass( Integer.class );
    assertTrue( rm.equals( xc, Integer.class ) );
  }

  public void testSupportsNullsInComparisons() {
    XClass xc = rm.toXClass( Integer.class );
    assertFalse( rm.equals( null, Number.class ) );
    assertFalse( rm.equals( xc, null ) );
    assertTrue( rm.equals( null, null ) );
  }
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

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

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

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.