HHH-6478 - Code cleanup in metamodel package

This commit is contained in:
Steve Ebersole 2011-07-22 13:11:20 -05:00
parent 8c6b2a52fe
commit 1de1325e64
5 changed files with 22 additions and 83 deletions

View File

@ -23,17 +23,11 @@
*/
package org.hibernate.metamodel.binding;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.hibernate.metamodel.binding.state.AttributeBindingState;
import org.hibernate.metamodel.domain.Attribute;
import org.hibernate.metamodel.relational.Column;
import org.hibernate.metamodel.relational.DerivedValue;
import org.hibernate.metamodel.relational.SimpleValue;
import org.hibernate.metamodel.source.MetaAttributeContext;
/**
@ -61,15 +55,6 @@ public abstract class AbstractAttributeBinding implements AttributeBinding {
this.attribute = attribute;
}
protected void initialize(AttributeBindingState state) {
hibernateTypeDescriptor.setExplicitTypeName( state.getExplicitHibernateTypeName() );
hibernateTypeDescriptor.setTypeParameters( state.getExplicitHibernateTypeParameters() );
hibernateTypeDescriptor.setJavaTypeName( state.getJavaTypeName() );
isLazy = state.isLazy();
isAlternateUniqueKey = state.isAlternateUniqueKey();
metaAttributeContext = state.getMetaAttributeContext();
}
@Override
public EntityBinding getEntityBinding() {
return entityBinding;

View File

@ -1,57 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binding.state;
import java.util.Map;
import java.util.Set;
import org.hibernate.metamodel.source.MetaAttributeContext;
import org.hibernate.metamodel.binding.CascadeType;
/**
* @author Gail Badner
*/
public interface AttributeBindingState {
String getAttributeName();
String getJavaTypeName();
String getExplicitHibernateTypeName();
Map<String, String> getExplicitHibernateTypeParameters();
boolean isLazy();
String getPropertyAccessorName();
boolean isAlternateUniqueKey();
Set<CascadeType> getCascadeTypes();
boolean isOptimisticLockable();
String getNodeName();
public MetaAttributeContext getMetaAttributeContext();
}

View File

@ -24,23 +24,33 @@
package org.hibernate.metamodel.source.binder;
/**
* Source for discriminator metadata.
* <p/>
* <b>NOTE</b> : extends the notion of {@link SingularAttributeSource} only for convenience in that both share many of
* the same source options. However, a discriminator is <b>NEVER</b> a physical attribute on the domain model.
* Contract for sources of information about a mapped discriminator.
*
* @author Hardy Ferentschik
* @author Steve Ebersole
*/
public interface DiscriminatorSource {
/**
* Obtain the column/formula information about the discriminator.
*
* @return The column/formula information
*/
public RelationalValueSource getDiscriminatorRelationalValueSource();
/**
* Obtain the discriminator type. Unlike the type of attributes, implementors here should generally specify the type
* in case of no user selection rather than return null because we cannot infer it from any physical java member.
*
* @return The discriminator type
*/
public String getExplicitHibernateTypeName();
/**
* "Forces" Hibernate to specify the allowed discriminator values, even when retrieving all instances of the root class.
* "Forces" Hibernate to specify the allowed discriminator values, even when retrieving all instances of the
* root class.
*
* @return {@code true} in case the discriminator value should be forces, {@code false} otherwise. Default is {@code false}.
* @return {@code true} in case the discriminator value should be forces, {@code false} otherwise. Default
* is {@code false}.
*/
boolean isForced();
@ -49,7 +59,7 @@ public interface DiscriminatorSource {
* It tells Hibernate not to include the column in SQL INSERTs.
*
* @return {@code true} in case the discriminator value should be included in inserts, {@code false} otherwise.
* Default is {@code true}.
* Default is {@code true}.
*/
boolean isInserted();
}

View File

@ -29,8 +29,13 @@ import org.hibernate.metamodel.binding.Caching;
/**
* Contract for the entity that is the root of an inheritance hierarchy.
* <p/>
* <b>NOTE</b> : I think most of this could be moved to {@link EntityHierarchy} much like was done with
* {@link org.hibernate.metamodel.binding.HierarchyDetails}
*
* @author Steve Ebersole
*
* @todo Move these concepts to {@link EntityHierarchy} ?
*/
public interface RootEntitySource extends EntitySource {
/**
@ -56,8 +61,6 @@ public interface RootEntitySource extends EntitySource {
/**
* Obtain the entity mode for this entity.
* <p/>
* todo : I think this should probably move to EntityHierarchy.
*
* @return The entity mode.
*/

View File

@ -23,8 +23,6 @@
*/
package org.hibernate.metamodel.source.binder;
import org.hibernate.FetchMode;
/**
* Further contract for sources of {@code *-to-one} style associations.
*