METAGEN-55 Formatting

This commit is contained in:
Hardy Ferentschik 2011-02-14 19:39:52 +01:00 committed by Strong Liu
parent 05c4251b78
commit f88284036f
2 changed files with 30 additions and 31 deletions

View File

@ -45,6 +45,7 @@ import org.hibernate.jpamodelgen.xml.jaxb.Basic;
import org.hibernate.jpamodelgen.xml.jaxb.ElementCollection; import org.hibernate.jpamodelgen.xml.jaxb.ElementCollection;
import org.hibernate.jpamodelgen.xml.jaxb.Embeddable; import org.hibernate.jpamodelgen.xml.jaxb.Embeddable;
import org.hibernate.jpamodelgen.xml.jaxb.EmbeddableAttributes; import org.hibernate.jpamodelgen.xml.jaxb.EmbeddableAttributes;
import org.hibernate.jpamodelgen.xml.jaxb.Embedded;
import org.hibernate.jpamodelgen.xml.jaxb.Entity; import org.hibernate.jpamodelgen.xml.jaxb.Entity;
import org.hibernate.jpamodelgen.xml.jaxb.Id; import org.hibernate.jpamodelgen.xml.jaxb.Id;
import org.hibernate.jpamodelgen.xml.jaxb.ManyToMany; import org.hibernate.jpamodelgen.xml.jaxb.ManyToMany;
@ -385,8 +386,8 @@ public class XmlMetaEntity implements MetaEntity {
} }
} }
for (org.hibernate.jpamodelgen.xml.jaxb.Embedded embedded : attributes.getEmbedded()) { for ( Embedded embedded : attributes.getEmbedded() ) {
parseEmbedded( embedded); parseEmbedded( embedded );
} }
} }
@ -452,7 +453,7 @@ public class XmlMetaEntity implements MetaEntity {
return false; return false;
} }
private void parseEmbedded(org.hibernate.jpamodelgen.xml.jaxb.Embedded embedded) { private void parseEmbedded(Embedded embedded) {
XmlMetaSingleAttribute attribute; XmlMetaSingleAttribute attribute;
ElementKind elementKind = getElementKind( embedded.getAccess() ); ElementKind elementKind = getElementKind( embedded.getAccess() );
String type = getType( embedded.getName(), null, elementKind ); String type = getType( embedded.getName(), null, elementKind );
@ -462,8 +463,6 @@ public class XmlMetaEntity implements MetaEntity {
} }
} }
private String determineExplicitTargetEntity(String targetClass) { private String determineExplicitTargetEntity(String targetClass) {
String explicitTargetClass = targetClass; String explicitTargetClass = targetClass;
if ( explicitTargetClass != null ) { if ( explicitTargetClass != null ) {

View File

@ -40,21 +40,21 @@ public class XmlOnlyTest extends CompilationTest {
@Test @Test
public void testMetaModelGeneratedForManyToManyFieldAccessWithoutTargetEntity() { public void testMetaModelGeneratedForManyToManyFieldAccessWithoutTargetEntity() {
assertPresenceOfFieldInMetamodelFor(Course.class, "qualifiedTeachers", "Type should be inferred from field"); assertPresenceOfFieldInMetamodelFor( Course.class, "qualifiedTeachers", "Type should be inferred from field" );
assertPresenceOfFieldInMetamodelFor(Teacher.class, "qualifiedFor", "Type should be inferred from field"); assertPresenceOfFieldInMetamodelFor( Teacher.class, "qualifiedFor", "Type should be inferred from field" );
} }
@Test @Test
public void testMetaModelGeneratedForOneToManyPropertyAccessWithoutTargetEntity() { public void testMetaModelGeneratedForOneToManyPropertyAccessWithoutTargetEntity() {
assertPresenceOfFieldInMetamodelFor(Car.class, "tires", "Type should be inferred from field"); assertPresenceOfFieldInMetamodelFor( Car.class, "tires", "Type should be inferred from field" );
assertPresenceOfFieldInMetamodelFor(Tire.class, "car", "Type should be inferred from field"); assertPresenceOfFieldInMetamodelFor( Tire.class, "car", "Type should be inferred from field" );
} }
@Test @Test
public void testMetaModelGeneratedForEmbeddable() { public void testMetaModelGeneratedForEmbeddable() {
assertPresenceOfFieldInMetamodelFor(Option.class, "period", "Embedded expected"); assertPresenceOfFieldInMetamodelFor( Option.class, "period", "Embedded expected" );
assertPresenceOfFieldInMetamodelFor(Period.class, "start", "Embedded expected"); assertPresenceOfFieldInMetamodelFor( Period.class, "start", "Embedded expected" );
assertPresenceOfFieldInMetamodelFor(Period.class, "end", "Embedded expected"); assertPresenceOfFieldInMetamodelFor( Period.class, "end", "Embedded expected" );
} }
@Override @Override