HHH-6202 Cleanup of existing classes. Replacing TODO with AssertionFailure

This commit is contained in:
Hardy Ferentschik 2011-05-16 21:15:34 +02:00
parent 5d766b237b
commit 85b0725c28
2 changed files with 17 additions and 6 deletions

View File

@ -30,6 +30,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.hibernate.AssertionFailure;
import org.hibernate.MappingException;
import org.hibernate.engine.internal.Versioning;
import org.hibernate.internal.util.ReflectHelper;
@ -49,6 +50,7 @@ import org.hibernate.metamodel.source.util.MappingHelper;
* Provides the link between the domain and the relational model for an entity.
*
* @author Steve Ebersole
* @author Hardy Ferentschik
*/
public class EntityBinding {
private final EntityIdentifier entityIdentifier = new EntityIdentifier( this );
@ -247,9 +249,9 @@ public class EntityBinding {
public SimpleAttributeBinding makeEntityDiscriminatorBinding(String name) {
if ( entityDiscriminator != null ) {
// TODO: LOG this!!!
throw new AssertionFailure( "Creation of entity discriminator was called more than once" );
}
entityDiscriminator = new EntityDiscriminator( this );
entityDiscriminator = new EntityDiscriminator();
entityDiscriminator.setValueBinding( makeSimpleAttributeBinding( name, true, false ) );
return entityDiscriminator.getValueBinding();
}

View File

@ -24,18 +24,16 @@
package org.hibernate.metamodel.binding;
/**
* TODO : javadoc
* Binding of the discriminator in a entity hierarchy
*
* @author Steve Ebersole
*/
public class EntityDiscriminator {
private final EntityBinding entityBinding;
private SimpleAttributeBinding valueBinding;
private boolean forced;
private boolean inserted = true;
public EntityDiscriminator(EntityBinding entityBinding) {
this.entityBinding = entityBinding;
public EntityDiscriminator() {
}
public SimpleAttributeBinding getValueBinding() {
@ -61,4 +59,15 @@ public class EntityDiscriminator {
public void setInserted(boolean inserted) {
this.inserted = inserted;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append( "EntityDiscriminator" );
sb.append( "{valueBinding=" ).append( valueBinding );
sb.append( ", forced=" ).append( forced );
sb.append( ", inserted=" ).append( inserted );
sb.append( '}' );
return sb.toString();
}
}