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.Embeddable;
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.Id;
import org.hibernate.jpamodelgen.xml.jaxb.ManyToMany;
@ -385,12 +386,12 @@ public class XmlMetaEntity implements MetaEntity {
}
}
for (org.hibernate.jpamodelgen.xml.jaxb.Embedded embedded : attributes.getEmbedded()) {
parseEmbedded( embedded);
}
for ( Embedded embedded : attributes.getEmbedded() ) {
parseEmbedded( embedded );
}
}
private void parseEmbeddableAttributes(EmbeddableAttributes attributes) {
private void parseEmbeddableAttributes(EmbeddableAttributes attributes) {
if ( attributes == null ) {
return;
}
@ -452,17 +453,15 @@ public class XmlMetaEntity implements MetaEntity {
return false;
}
private void parseEmbedded(org.hibernate.jpamodelgen.xml.jaxb.Embedded embedded) {
XmlMetaSingleAttribute attribute;
ElementKind elementKind = getElementKind( embedded.getAccess() );
String type = getType( embedded.getName(), null, elementKind );
if ( type != null ) {
attribute = new XmlMetaSingleAttribute( this, embedded.getName(), type );
members.add( attribute );
}
}
private void parseEmbedded(Embedded embedded) {
XmlMetaSingleAttribute attribute;
ElementKind elementKind = getElementKind( embedded.getAccess() );
String type = getType( embedded.getName(), null, elementKind );
if ( type != null ) {
attribute = new XmlMetaSingleAttribute( this, embedded.getName(), type );
members.add( attribute );
}
}
private String determineExplicitTargetEntity(String targetClass) {
String explicitTargetClass = targetClass;

View File

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