@Test public void testGetMetadataFromMethods_InheritanceOrder() { EntityClassMetadata<Integer_ConcreteId_M> metadata = factory .getEntityClassMetadata(Integer_ConcreteId_M.class); assertEquals("Integer_ConcreteId_M", metadata.getEntityName()); assertEquals(Integer_ConcreteId_M.class, metadata.getMappedClass()); assertTrue(metadata.hasIdentifierProperty()); { PersistentPropertyMetadata id = metadata.getIdentifierProperty(); assertEquals("id", id.getName()); assertEquals(Integer.class, id.getType()); assertEquals(PersistentPropertyMetadata.AccessType.METHOD, id.getAccessType()); assertNotNull(id.getAnnotation(Id.class)); assertNull(id.getTypeMetadata()); assertTrue(id.isWritable()); } assertSame(metadata.getIdentifierProperty(), metadata.getProperty("id")); assertEquals(1, metadata.getProperties().size()); }
public <T> EntityClassMetadata<T> getEntityClassMetadata( Class<T> mappedClass) throws IllegalArgumentException { assert mappedClass != null : "mappedClass must not be null"; if (mappedClass.getAnnotation(Entity.class) == null) { throw new IllegalArgumentException("The class is not an entity"); } PersistentPropertyMetadata.AccessType accessType = determineAccessType(mappedClass); if (accessType == null) { throw new IllegalArgumentException( "The access type could not be determined"); } else { return (EntityClassMetadata<T>) getClassMetadata(mappedClass, accessType); } }
MetadataFactory { public <T> EntityClassMetadata<T> getEntityClassMetadata( Class<T> mappedClass) throws IllegalArgumentException { assert mappedClass != null : "mappedClass must not be null"; if (mappedClass.getAnnotation(Entity.class) == null) { throw new IllegalArgumentException("The class is not an entity"); } PersistentPropertyMetadata.AccessType accessType = determineAccessType(mappedClass); if (accessType == null) { throw new IllegalArgumentException( "The access type could not be determined"); } else { return (EntityClassMetadata<T>) getClassMetadata(mappedClass, accessType); } } }
MetadataFactory { public <T> EntityClassMetadata<T> getEntityClassMetadata( Class<T> mappedClass) throws IllegalArgumentException { assert mappedClass != null : "mappedClass must not be null"; if (mappedClass.getAnnotation(Entity.class) == null) { throw new IllegalArgumentException("The class is not an entity"); } PersistentPropertyMetadata.AccessType accessType = determineAccessType(mappedClass); if (accessType == null) { throw new IllegalArgumentException( "The access type could not be determined"); } else { return (EntityClassMetadata<T>) getClassMetadata(mappedClass, accessType); } } protected  MetadataFactory(); }
MetadataFactory { public <T> EntityClassMetadata<T> getEntityClassMetadata( Class<T> mappedClass) throws IllegalArgumentException { assert mappedClass != null : "mappedClass must not be null"; if (mappedClass.getAnnotation(Entity.class) == null) { throw new IllegalArgumentException("The class is not an entity"); } PersistentPropertyMetadata.AccessType accessType = determineAccessType(mappedClass); if (accessType == null) { throw new IllegalArgumentException( "The access type could not be determined"); } else { return (EntityClassMetadata<T>) getClassMetadata(mappedClass, accessType); } } protected  MetadataFactory(); static MetadataFactory getInstance(); EntityClassMetadata<T> getEntityClassMetadata(
            Class<T> mappedClass); @SuppressWarnings("unchecked") ClassMetadata<T> getClassMetadata(Class<T> mappedClass,
            PersistentPropertyMetadata.AccessType accessType); }
MetadataFactory { public <T> EntityClassMetadata<T> getEntityClassMetadata( Class<T> mappedClass) throws IllegalArgumentException { assert mappedClass != null : "mappedClass must not be null"; if (mappedClass.getAnnotation(Entity.class) == null) { throw new IllegalArgumentException("The class is not an entity"); } PersistentPropertyMetadata.AccessType accessType = determineAccessType(mappedClass); if (accessType == null) { throw new IllegalArgumentException( "The access type could not be determined"); } else { return (EntityClassMetadata<T>) getClassMetadata(mappedClass, accessType); } } protected  MetadataFactory(); static MetadataFactory getInstance(); EntityClassMetadata<T> getEntityClassMetadata(
            Class<T> mappedClass); @SuppressWarnings("unchecked") ClassMetadata<T> getClassMetadata(Class<T> mappedClass,
            PersistentPropertyMetadata.AccessType accessType);  }