Map m = cm.getMetaAttributes(); assertNotNull(m); assertNotNull(cm.getMetaAttribute("global")); assertNull(cm.getMetaAttribute("globalnoinherit")); MetaAttribute metaAttribute = cm.getMetaAttribute("implements"); assertNotNull(metaAttribute); assertEquals("implements", metaAttribute.getName());
public void testNonMutatedInheritance() { PersistentClass cm = metadata.getEntityBinding( "org.hibernate.test.legacy.Wicked" ); MetaAttribute metaAttribute = cm.getMetaAttribute( "globalmutated" );
interfaces.add( clazz.getSuperclass().getClassName() ); if ( clazz.getMetaAttribute( IMPLEMENTS ) != null ) { interfaces.addAll( clazz.getMetaAttribute( IMPLEMENTS ).getValues() );
interfaces.add( clazz.getSuperclass().getClassName() ); if ( clazz.getMetaAttribute( IMPLEMENTS ) != null ) { interfaces.addAll( clazz.getMetaAttribute( IMPLEMENTS ).getValues() );
/** * @return whatever the class (or interface) extends (null if it does not extend anything) */ public String getExtends() { String extendz = ""; if ( isInterface() ) { if ( clazz.getSuperclass() != null ) { extendz = clazz.getSuperclass().getClassName(); } if ( clazz.getMetaAttribute( EXTENDS ) != null ) { if ( !"".equals( extendz ) ) { extendz += ","; } extendz += getMetaAsString( EXTENDS, "," ); } } else if ( clazz.getSuperclass() != null ) { if ( c2j.getPOJOClass(clazz.getSuperclass()).isInterface() ) { // class cannot extend it's superclass because the superclass is marked as an interface } else { extendz = clazz.getSuperclass().getClassName(); } } else if ( clazz.getMetaAttribute( EXTENDS ) != null ) { extendz = getMetaAsString( EXTENDS, "," ); } return "".equals( extendz ) ? null : extendz; }
/** * @return whatever the class (or interface) extends (null if it does not extend anything) */ public String getExtends() { String extendz = ""; if ( isInterface() ) { if ( clazz.getSuperclass() != null ) { extendz = clazz.getSuperclass().getClassName(); } if ( clazz.getMetaAttribute( EXTENDS ) != null ) { if ( !"".equals( extendz ) ) { extendz += ","; } extendz += getMetaAsString( EXTENDS, "," ); } } else if ( clazz.getSuperclass() != null ) { if ( c2j.getPOJOClass(clazz.getSuperclass()).isInterface() ) { // class cannot extend it's superclass because the superclass is marked as an interface } else { extendz = clazz.getSuperclass().getClassName(); } } else if ( clazz.getMetaAttribute( EXTENDS ) != null ) { extendz = getMetaAsString( EXTENDS, "," ); } return "".equals( extendz ) ? null : extendz; }
@Test public void testMetaAttributeMappings() { PersistentClass classMapping = metadata.getEntityBinding( "Orders" ); Assert.assertEquals("order table value", classMapping.getMetaAttribute( "order-meta" ).getValue()); Property property = classMapping.getProperty("orderName"); Assert.assertEquals("order column value", property.getMetaAttribute( "order-meta" ).getValue()); //TODO: test sequence of meta }