HHH-6171 Some more name changes. Also adding setter/getter for TypeDef to MetadataImpl
This commit is contained in:
parent
c7293c2170
commit
bf4d8ad290
|
@ -44,8 +44,8 @@ import org.hibernate.metamodel.relational.Identifier;
|
|||
import org.hibernate.metamodel.relational.Schema;
|
||||
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
|
||||
import org.hibernate.metamodel.source.annotations.JPADotNames;
|
||||
import org.hibernate.metamodel.source.annotations.entity.state.binding.AnnotationsAttributeBindingState;
|
||||
import org.hibernate.metamodel.source.annotations.entity.state.binding.AnnotationsDiscriminatorBindingState;
|
||||
import org.hibernate.metamodel.source.annotations.entity.state.binding.AttributeBindingStateImpl;
|
||||
import org.hibernate.metamodel.source.annotations.entity.state.binding.DiscriminatorBindingStateImpl;
|
||||
import org.hibernate.metamodel.source.annotations.entity.state.relational.AttributeColumnRelationalState;
|
||||
import org.hibernate.metamodel.source.annotations.entity.state.relational.AttributeTupleRelationalState;
|
||||
import org.hibernate.metamodel.source.annotations.util.JandexHelper;
|
||||
|
@ -303,7 +303,7 @@ public class EntityBinder {
|
|||
entityBinding.getEntity().getOrCreateSingularAttribute( idName );
|
||||
|
||||
SimpleAttributeBinding attributeBinding = entityBinding.makeSimpleIdAttributeBinding( idName );
|
||||
attributeBinding.initialize( new AnnotationsAttributeBindingState( idAttribute ) );
|
||||
attributeBinding.initialize( new AttributeBindingStateImpl( idAttribute ) );
|
||||
attributeBinding.initialize( new AttributeColumnRelationalState( idAttribute, meta ) );
|
||||
}
|
||||
|
||||
|
@ -325,15 +325,15 @@ public class EntityBinder {
|
|||
|
||||
if ( mappedAttribute.isDiscriminator() ) {
|
||||
attributeBinding = entityBinding.makeEntityDiscriminator( attributeName ).getValueBinding();
|
||||
bindingState = new AnnotationsDiscriminatorBindingState( mappedAttribute );
|
||||
bindingState = new DiscriminatorBindingStateImpl( mappedAttribute );
|
||||
}
|
||||
else if ( mappedAttribute.isVersioned() ) {
|
||||
attributeBinding = entityBinding.makeVersionBinding( attributeName );
|
||||
bindingState = new AnnotationsAttributeBindingState( mappedAttribute );
|
||||
bindingState = new AttributeBindingStateImpl( mappedAttribute );
|
||||
}
|
||||
else {
|
||||
attributeBinding = entityBinding.makeSimpleAttributeBinding( attributeName );
|
||||
bindingState = new AnnotationsAttributeBindingState( mappedAttribute );
|
||||
bindingState = new AttributeBindingStateImpl( mappedAttribute );
|
||||
}
|
||||
attributeBinding.initialize( bindingState );
|
||||
|
||||
|
|
|
@ -32,15 +32,17 @@ import org.hibernate.metamodel.domain.MetaAttribute;
|
|||
import org.hibernate.metamodel.source.annotations.entity.MappedAttribute;
|
||||
|
||||
/**
|
||||
* Implementation of the attribute binding state via annotation configuration.
|
||||
*
|
||||
* @author Hardy Ferentschik
|
||||
*/
|
||||
public class AnnotationsAttributeBindingState implements SimpleAttributeBindingState {
|
||||
public class AttributeBindingStateImpl implements SimpleAttributeBindingState {
|
||||
private final MappedAttribute mappedAttribute;
|
||||
private final PropertyGeneration propertyGeneration = null;
|
||||
private final String typeName;
|
||||
private final Properties typeParameters;
|
||||
|
||||
public AnnotationsAttributeBindingState(MappedAttribute mappedAttribute) {
|
||||
public AttributeBindingStateImpl(MappedAttribute mappedAttribute) {
|
||||
this.mappedAttribute = mappedAttribute;
|
||||
typeName = mappedAttribute.getType().getName();
|
||||
// TODO: implement....
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.source.annotations.entity.state.binding;
|
||||
|
||||
import org.hibernate.metamodel.binding.state.DiscriminatorBindingState;
|
||||
import org.hibernate.metamodel.source.annotations.entity.DiscriminatorColumnValues;
|
||||
import org.hibernate.metamodel.source.annotations.entity.MappedAttribute;
|
||||
|
||||
|
@ -32,12 +31,12 @@ import org.hibernate.metamodel.source.annotations.entity.MappedAttribute;
|
|||
*
|
||||
* TODO: extract a superclass that sets defaults for other stuff
|
||||
*/
|
||||
public class AnnotationsDiscriminatorBindingState
|
||||
extends AnnotationsAttributeBindingState implements DiscriminatorBindingState {
|
||||
public class DiscriminatorBindingStateImpl
|
||||
extends AttributeBindingStateImpl implements org.hibernate.metamodel.binding.state.DiscriminatorBindingState {
|
||||
private final boolean isForced;
|
||||
private final boolean isInserted;
|
||||
|
||||
public AnnotationsDiscriminatorBindingState(MappedAttribute mappedAttribute) {
|
||||
public DiscriminatorBindingStateImpl(MappedAttribute mappedAttribute) {
|
||||
super( mappedAttribute );
|
||||
DiscriminatorColumnValues columnValues = DiscriminatorColumnValues.class.cast( mappedAttribute.getColumnValues() );
|
||||
isForced = columnValues.isForced();
|
|
@ -47,6 +47,7 @@ import org.hibernate.metamodel.SourceProcessingOrder;
|
|||
import org.hibernate.metamodel.binding.EntityBinding;
|
||||
import org.hibernate.metamodel.binding.FetchProfile;
|
||||
import org.hibernate.metamodel.binding.PluralAttributeBinding;
|
||||
import org.hibernate.metamodel.binding.TypeDef;
|
||||
import org.hibernate.metamodel.relational.Database;
|
||||
import org.hibernate.metamodel.source.annotation.xml.XMLEntityMappings;
|
||||
import org.hibernate.metamodel.source.annotations.AnnotationBinder;
|
||||
|
@ -58,7 +59,7 @@ import org.hibernate.service.BasicServiceRegistry;
|
|||
import org.hibernate.service.classloading.spi.ClassLoaderService;
|
||||
|
||||
/**
|
||||
* Container for configuration data while building and binding the metamodel
|
||||
* Container for configuration data collected during binding the metamodel.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @author Hardy Ferentschik
|
||||
|
@ -76,6 +77,7 @@ public class MetadataImpl implements Metadata, MetadataImplementor, Serializable
|
|||
private Map<String, EntityBinding> entityBindingMap = new HashMap<String, EntityBinding>();
|
||||
private Map<String, PluralAttributeBinding> collectionBindingMap = new HashMap<String, PluralAttributeBinding>();
|
||||
private Map<String, FetchProfile> fetchProfiles = new HashMap<String, FetchProfile>();
|
||||
private Map<String, TypeDef> typeDefs = new HashMap<String, TypeDef>();
|
||||
private Map<String, String> imports;
|
||||
|
||||
public MetadataImpl(MetadataBuilderImpl builder) {
|
||||
|
@ -218,6 +220,15 @@ public class MetadataImpl implements Metadata, MetadataImplementor, Serializable
|
|||
return fetchProfiles.values();
|
||||
}
|
||||
|
||||
public void addTypeDef(String name, TypeDef typeDef) {
|
||||
// TODO - should we check whether the typedef already exists? Log it? Exception? (HF)
|
||||
typeDefs.put( name, typeDef );
|
||||
}
|
||||
|
||||
public TypeDef getTypeDef(String name) {
|
||||
return typeDefs.get( name );
|
||||
}
|
||||
|
||||
public FetchProfile findOrCreateFetchProfile(String profileName, MetadataSource source) {
|
||||
FetchProfile profile = fetchProfiles.get( profileName );
|
||||
if ( profile == null ) {
|
||||
|
|
Loading…
Reference in New Issue