Remove now unneeded flag to avoid getMember population

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18256 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Emmanuel Bernard 2009-12-17 11:05:13 +00:00
parent 446ac0e0df
commit 355e81a7f1
2 changed files with 26 additions and 26 deletions

View File

@ -58,19 +58,19 @@ public AttributeFactory(MetadataContext context) {
} }
@SuppressWarnings({ "unchecked" }) @SuppressWarnings({ "unchecked" })
public <X, Y> AttributeImplementor<X, Y> buildAttribute(AbstractManagedType<X> ownerType, Property property, boolean getMember) { public <X, Y> AttributeImplementor<X, Y> buildAttribute(AbstractManagedType<X> ownerType, Property property) {
AttributeContext attrContext = getAttributeContext( property ); AttributeContext attrContext = getAttributeContext( property );
final AttributeImplementor<X, Y> attribute; final AttributeImplementor<X, Y> attribute;
if ( attrContext.isCollection() ) { if ( attrContext.isCollection() ) {
attribute = buildPluralAttribute( ownerType, property, attrContext, getMember ); attribute = buildPluralAttribute( ownerType, property, attrContext);
} }
else { else {
final Type<Y> attrType = getType( ownerType, attrContext.getElementTypeStatus(), attrContext.getElementValue(), getMember ); final Type<Y> attrType = getType( ownerType, attrContext.getElementTypeStatus(), attrContext.getElementValue() );
attribute = new SingularAttributeImpl<X,Y>( attribute = new SingularAttributeImpl<X,Y>(
property.getName(), property.getName(),
property.getType().getReturnedClass(), property.getType().getReturnedClass(),
ownerType, ownerType,
getMember ? determineStandardJavaMember( ownerType, property ) : null, determineStandardJavaMember( ownerType, property ),
false, false,
false, false,
property.isOptional(), property.isOptional(),
@ -82,15 +82,15 @@ public <X, Y> AttributeImplementor<X, Y> buildAttribute(AbstractManagedType<X> o
} }
@SuppressWarnings( "unchecked" ) @SuppressWarnings( "unchecked" )
private <X, Y, V, K> AttributeImplementor<X, Y> buildPluralAttribute(AbstractManagedType<X> ownerType, Property property, AttributeContext attrContext, boolean getMember) { private <X, Y, V, K> AttributeImplementor<X, Y> buildPluralAttribute(AbstractManagedType<X> ownerType, Property property, AttributeContext attrContext) {
AttributeImplementor<X, Y> attribute; AttributeImplementor<X, Y> attribute;
final Type<V> attrType = getType( ownerType, attrContext.getElementTypeStatus(), attrContext.getElementValue(), getMember ); final Type<V> attrType = getType( ownerType, attrContext.getElementTypeStatus(), attrContext.getElementValue() );
final Member member = getMember ? determineStandardJavaMember( ownerType, property ) : null; final Member member = determineStandardJavaMember( ownerType, property );
final Class<Y> collectionClass = (Class<Y>) ( member instanceof Field final Class<Y> collectionClass = (Class<Y>) ( member instanceof Field
? ( ( Field ) member ).getType() ? ( ( Field ) member ).getType()
: ( ( Method ) member ).getReturnType() ); : ( ( Method ) member ).getReturnType() );
if ( java.util.Map.class.isAssignableFrom( collectionClass ) ) { if ( java.util.Map.class.isAssignableFrom( collectionClass ) ) {
final Type<K> keyType = getType( ownerType, attrContext.getKeyTypeStatus(), attrContext.getKeyValue(), getMember ); final Type<K> keyType = getType( ownerType, attrContext.getKeyTypeStatus(), attrContext.getKeyValue() );
attribute = PluralAttributeImpl.create( ownerType, attrType, collectionClass, keyType ) attribute = PluralAttributeImpl.create( ownerType, attrType, collectionClass, keyType )
.member( member ) .member( member )
.property( property ) .property( property )
@ -107,13 +107,13 @@ private <X, Y, V, K> AttributeImplementor<X, Y> buildPluralAttribute(AbstractMan
return attribute; return attribute;
} }
private <X> Type<X> getType(AbstractManagedType owner, AttributeContext.TypeStatus elementTypeStatus, Value value, boolean getMember) { private <X> Type<X> getType(AbstractManagedType owner, AttributeContext.TypeStatus elementTypeStatus, Value value) {
final org.hibernate.type.Type type = value.getType(); final org.hibernate.type.Type type = value.getType();
switch ( elementTypeStatus ) { switch ( elementTypeStatus ) {
case BASIC: case BASIC:
return buildBasicType( type ); return buildBasicType( type );
case EMBEDDABLE: case EMBEDDABLE:
return buildEmbeddableType( owner, value, type, getMember ); return buildEmbeddableType( owner, value, type );
case ENTITY: case ENTITY:
return buildEntityType( type ); return buildEntityType( type );
default: default:
@ -135,7 +135,7 @@ private <X> Type<X> buildEntityType(org.hibernate.type.Type type) {
} }
@SuppressWarnings( "unchecked" ) @SuppressWarnings( "unchecked" )
private <X> Type<X> buildEmbeddableType(AbstractManagedType owner, Value value, org.hibernate.type.Type type, boolean getMember) { private <X> Type<X> buildEmbeddableType(AbstractManagedType owner, Value value, org.hibernate.type.Type type) {
//build embedable type //build embedable type
final Class<X> clazz = type.getReturnedClass(); final Class<X> clazz = type.getReturnedClass();
final EmbeddableTypeImpl<X> embeddableType = new EmbeddableTypeImpl<X>( clazz, owner, (ComponentType) type ); final EmbeddableTypeImpl<X> embeddableType = new EmbeddableTypeImpl<X>( clazz, owner, (ComponentType) type );
@ -144,22 +144,22 @@ private <X> Type<X> buildEmbeddableType(AbstractManagedType owner, Value value,
final Iterator<Property> subProperties = component.getPropertyIterator(); final Iterator<Property> subProperties = component.getPropertyIterator();
while ( subProperties.hasNext() ) { while ( subProperties.hasNext() ) {
final Property property = subProperties.next(); final Property property = subProperties.next();
embeddableType.getBuilder().addAttribute( buildAttribute( embeddableType, property, getMember ) ); embeddableType.getBuilder().addAttribute( buildAttribute( embeddableType, property) );
} }
embeddableType.lock(); embeddableType.lock();
return embeddableType; return embeddableType;
} }
@SuppressWarnings({ "unchecked" }) @SuppressWarnings({ "unchecked" })
public <X, Y> SingularAttributeImpl<X, Y> buildIdAttribute(AbstractIdentifiableType<X> ownerType, Property property, boolean getMember) { public <X, Y> SingularAttributeImpl<X, Y> buildIdAttribute(AbstractIdentifiableType<X> ownerType, Property property) {
final AttributeContext attrContext = getAttributeContext( property ); final AttributeContext attrContext = getAttributeContext( property );
final Type<Y> attrType = getType( ownerType, attrContext.getElementTypeStatus(), attrContext.getElementValue(), getMember ); final Type<Y> attrType = getType( ownerType, attrContext.getElementTypeStatus(), attrContext.getElementValue() );
final Class<Y> idJavaType = property.getType().getReturnedClass(); final Class<Y> idJavaType = property.getType().getReturnedClass();
return new SingularAttributeImpl.Identifier( return new SingularAttributeImpl.Identifier(
property.getName(), property.getName(),
idJavaType, idJavaType,
ownerType, ownerType,
getMember ? determineIdentifierJavaMember( ownerType, property ) : null, determineIdentifierJavaMember( ownerType, property ),
attrType, attrType,
attrContext.getElementAttributeType() attrContext.getElementAttributeType()
); );
@ -259,15 +259,15 @@ private Member determineStandardJavaMemberOutOfIdentifiableType(IdentifiableType
} }
@SuppressWarnings({ "unchecked" }) @SuppressWarnings({ "unchecked" })
public <X, Y> SingularAttributeImpl<X, Y> buildVersionAttribute(AbstractIdentifiableType<X> ownerType, Property property, boolean getMember) { public <X, Y> SingularAttributeImpl<X, Y> buildVersionAttribute(AbstractIdentifiableType<X> ownerType, Property property) {
final AttributeContext attrContext = getAttributeContext( property ); final AttributeContext attrContext = getAttributeContext( property );
final Class<Y> javaType = property.getType().getReturnedClass(); final Class<Y> javaType = property.getType().getReturnedClass();
final Type<Y> attrType = getType( ownerType, attrContext.getElementTypeStatus(), attrContext.getElementValue(), getMember ); final Type<Y> attrType = getType( ownerType, attrContext.getElementTypeStatus(), attrContext.getElementValue() );
return new SingularAttributeImpl.Version( return new SingularAttributeImpl.Version(
property.getName(), property.getName(),
javaType, javaType,
ownerType, ownerType,
getMember ? determineVersionJavaMember( ownerType, property ) : null, determineVersionJavaMember( ownerType, property ),
attrType, attrType,
attrContext.getElementAttributeType() attrContext.getElementAttributeType()
); );

View File

@ -174,7 +174,7 @@ public void wrapUp() {
// #buildIdClassAttributes // #buildIdClassAttributes
continue; continue;
} }
final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property, true ); final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
jpa2Mapping.getBuilder().addAttribute( attribute ); jpa2Mapping.getBuilder().addAttribute( attribute );
} }
jpa2Mapping.lock(); jpa2Mapping.lock();
@ -191,7 +191,7 @@ else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
Iterator<Property> properties = ( Iterator<Property> ) safeMapping.getDeclaredPropertyIterator(); Iterator<Property> properties = ( Iterator<Property> ) safeMapping.getDeclaredPropertyIterator();
while ( properties.hasNext() ) { while ( properties.hasNext() ) {
final Property property = properties.next(); final Property property = properties.next();
final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property, true ); final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
jpa2Mapping.getBuilder().addAttribute( attribute ); jpa2Mapping.getBuilder().addAttribute( attribute );
} }
jpa2Mapping.lock(); jpa2Mapping.lock();
@ -213,7 +213,7 @@ private <X> void applyIdMetadata(PersistentClass persistentClass, EntityTypeImpl
final Property declaredIdentifierProperty = persistentClass.getDeclaredIdentifierProperty(); final Property declaredIdentifierProperty = persistentClass.getDeclaredIdentifierProperty();
if (declaredIdentifierProperty != null) { if (declaredIdentifierProperty != null) {
jpaEntityType.getBuilder().applyIdAttribute( jpaEntityType.getBuilder().applyIdAttribute(
attributeFactory.buildIdAttribute( jpaEntityType, declaredIdentifierProperty, true ) attributeFactory.buildIdAttribute( jpaEntityType, declaredIdentifierProperty )
); );
} }
} }
@ -227,7 +227,7 @@ private <X> void applyIdMetadata(MappedSuperclass mappingType, MappedSuperclassT
final Property declaredIdentifierProperty = mappingType.getDeclaredIdentifierProperty(); final Property declaredIdentifierProperty = mappingType.getDeclaredIdentifierProperty();
if (declaredIdentifierProperty != null) { if (declaredIdentifierProperty != null) {
jpaMappingType.getBuilder().applyIdAttribute( jpaMappingType.getBuilder().applyIdAttribute(
attributeFactory.buildIdAttribute( jpaMappingType, declaredIdentifierProperty, true ) attributeFactory.buildIdAttribute( jpaMappingType, declaredIdentifierProperty )
); );
} }
} }
@ -244,7 +244,7 @@ private <X> void applyVersionAttribute(PersistentClass persistentClass, EntityTy
final Property declaredVersion = persistentClass.getDeclaredVersion(); final Property declaredVersion = persistentClass.getDeclaredVersion();
if (declaredVersion != null) { if (declaredVersion != null) {
jpaEntityType.getBuilder().applyVersionAttribute( jpaEntityType.getBuilder().applyVersionAttribute(
attributeFactory.buildVersionAttribute( jpaEntityType, declaredVersion, true ) attributeFactory.buildVersionAttribute( jpaEntityType, declaredVersion )
); );
} }
} }
@ -253,7 +253,7 @@ private <X> void applyVersionAttribute(MappedSuperclass mappingType, MappedSuper
final Property declaredVersion = mappingType.getDeclaredVersion(); final Property declaredVersion = mappingType.getDeclaredVersion();
if ( declaredVersion != null ) { if ( declaredVersion != null ) {
jpaMappingType.getBuilder().applyVersionAttribute( jpaMappingType.getBuilder().applyVersionAttribute(
attributeFactory.buildVersionAttribute( jpaMappingType, declaredVersion, true ) attributeFactory.buildVersionAttribute( jpaMappingType, declaredVersion )
); );
} }
} }
@ -265,7 +265,7 @@ private <X> void applyVersionAttribute(MappedSuperclass mappingType, MappedSuper
@SuppressWarnings( "unchecked") @SuppressWarnings( "unchecked")
Iterator<Property> properties = persistentClass.getIdentifierMapper().getPropertyIterator(); Iterator<Property> properties = persistentClass.getIdentifierMapper().getPropertyIterator();
while ( properties.hasNext() ) { while ( properties.hasNext() ) {
attributes.add( attributeFactory.buildIdAttribute( jpaEntityType, properties.next(), true ) ); attributes.add( attributeFactory.buildIdAttribute( jpaEntityType, properties.next() ) );
} }
return attributes; return attributes;
} }
@ -277,7 +277,7 @@ private <X> void applyVersionAttribute(MappedSuperclass mappingType, MappedSuper
@SuppressWarnings( "unchecked" ) @SuppressWarnings( "unchecked" )
Iterator<Property> properties = mappingType.getIdentifierMapper().getPropertyIterator(); Iterator<Property> properties = mappingType.getIdentifierMapper().getPropertyIterator();
while ( properties.hasNext() ) { while ( properties.hasNext() ) {
attributes.add( attributeFactory.buildIdAttribute( jpaMappingType, properties.next(), true ) ); attributes.add( attributeFactory.buildIdAttribute( jpaMappingType, properties.next() ) );
} }
return attributes; return attributes;
} }