Author: epbernard
Date: 2009-12-17 06:05:13 -0500 (Thu, 17 Dec 2009)
New Revision: 18256
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/AttributeFactory.java
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java
Log:
Remove now unneeded flag to avoid getMember population
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/AttributeFactory.java
===================================================================
---
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/AttributeFactory.java 2009-12-17
08:49:02 UTC (rev 18255)
+++
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/AttributeFactory.java 2009-12-17
11:05:13 UTC (rev 18256)
@@ -58,19 +58,19 @@
}
@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 );
final AttributeImplementor<X, Y> attribute;
if ( attrContext.isCollection() ) {
- attribute = buildPluralAttribute( ownerType, property, attrContext, getMember );
+ attribute = buildPluralAttribute( ownerType, property, attrContext);
}
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>(
property.getName(),
property.getType().getReturnedClass(),
ownerType,
- getMember ? determineStandardJavaMember( ownerType, property ) : null,
+ determineStandardJavaMember( ownerType, property ),
false,
false,
property.isOptional(),
@@ -82,15 +82,15 @@
}
@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;
- final Type<V> attrType = getType( ownerType, attrContext.getElementTypeStatus(),
attrContext.getElementValue(), getMember );
- final Member member = getMember ? determineStandardJavaMember( ownerType, property ) :
null;
+ final Type<V> attrType = getType( ownerType, attrContext.getElementTypeStatus(),
attrContext.getElementValue() );
+ final Member member = determineStandardJavaMember( ownerType, property );
final Class<Y> collectionClass = (Class<Y>) ( member instanceof Field
? ( ( Field ) member ).getType()
: ( ( Method ) member ).getReturnType() );
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
)
.member( member )
.property( property )
@@ -107,13 +107,13 @@
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();
switch ( elementTypeStatus ) {
case BASIC:
return buildBasicType( type );
case EMBEDDABLE:
- return buildEmbeddableType( owner, value, type, getMember );
+ return buildEmbeddableType( owner, value, type );
case ENTITY:
return buildEntityType( type );
default:
@@ -135,7 +135,7 @@
}
@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
final Class<X> clazz = type.getReturnedClass();
final EmbeddableTypeImpl<X> embeddableType = new EmbeddableTypeImpl<X>(
clazz, owner, (ComponentType) type );
@@ -144,22 +144,22 @@
final Iterator<Property> subProperties = component.getPropertyIterator();
while ( subProperties.hasNext() ) {
final Property property = subProperties.next();
- embeddableType.getBuilder().addAttribute( buildAttribute( embeddableType, property,
getMember ) );
+ embeddableType.getBuilder().addAttribute( buildAttribute( embeddableType, property)
);
}
embeddableType.lock();
return embeddableType;
}
@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 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();
return new SingularAttributeImpl.Identifier(
property.getName(),
idJavaType,
ownerType,
- getMember ? determineIdentifierJavaMember( ownerType, property ) : null,
+ determineIdentifierJavaMember( ownerType, property ),
attrType,
attrContext.getElementAttributeType()
);
@@ -259,15 +259,15 @@
}
@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 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(
property.getName(),
javaType,
ownerType,
- getMember ? determineVersionJavaMember( ownerType, property ) : null,
+ determineVersionJavaMember( ownerType, property ),
attrType,
attrContext.getElementAttributeType()
);
Modified:
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java
===================================================================
---
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java 2009-12-17
08:49:02 UTC (rev 18255)
+++
core/trunk/entitymanager/src/main/java/org/hibernate/ejb/metamodel/MetadataContext.java 2009-12-17
11:05:13 UTC (rev 18256)
@@ -174,7 +174,7 @@
// #buildIdClassAttributes
continue;
}
- final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property,
true );
+ final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property
);
jpa2Mapping.getBuilder().addAttribute( attribute );
}
jpa2Mapping.lock();
@@ -191,7 +191,7 @@
Iterator<Property> properties = ( Iterator<Property> )
safeMapping.getDeclaredPropertyIterator();
while ( properties.hasNext() ) {
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.lock();
@@ -213,7 +213,7 @@
final Property declaredIdentifierProperty =
persistentClass.getDeclaredIdentifierProperty();
if (declaredIdentifierProperty != null) {
jpaEntityType.getBuilder().applyIdAttribute(
- attributeFactory.buildIdAttribute( jpaEntityType, declaredIdentifierProperty, true
)
+ attributeFactory.buildIdAttribute( jpaEntityType, declaredIdentifierProperty )
);
}
}
@@ -227,7 +227,7 @@
final Property declaredIdentifierProperty =
mappingType.getDeclaredIdentifierProperty();
if (declaredIdentifierProperty != null) {
jpaMappingType.getBuilder().applyIdAttribute(
- attributeFactory.buildIdAttribute( jpaMappingType, declaredIdentifierProperty, true
)
+ attributeFactory.buildIdAttribute( jpaMappingType, declaredIdentifierProperty )
);
}
}
@@ -244,7 +244,7 @@
final Property declaredVersion = persistentClass.getDeclaredVersion();
if (declaredVersion != null) {
jpaEntityType.getBuilder().applyVersionAttribute(
- attributeFactory.buildVersionAttribute( jpaEntityType, declaredVersion, true )
+ attributeFactory.buildVersionAttribute( jpaEntityType, declaredVersion )
);
}
}
@@ -253,7 +253,7 @@
final Property declaredVersion = mappingType.getDeclaredVersion();
if ( declaredVersion != null ) {
jpaMappingType.getBuilder().applyVersionAttribute(
- attributeFactory.buildVersionAttribute( jpaMappingType, declaredVersion, true )
+ attributeFactory.buildVersionAttribute( jpaMappingType, declaredVersion )
);
}
}
@@ -265,7 +265,7 @@
@SuppressWarnings( "unchecked")
Iterator<Property> properties =
persistentClass.getIdentifierMapper().getPropertyIterator();
while ( properties.hasNext() ) {
- attributes.add( attributeFactory.buildIdAttribute( jpaEntityType, properties.next(),
true ) );
+ attributes.add( attributeFactory.buildIdAttribute( jpaEntityType, properties.next() )
);
}
return attributes;
}
@@ -277,7 +277,7 @@
@SuppressWarnings( "unchecked" )
Iterator<Property> properties =
mappingType.getIdentifierMapper().getPropertyIterator();
while ( properties.hasNext() ) {
- attributes.add( attributeFactory.buildIdAttribute( jpaMappingType, properties.next(),
true ) );
+ attributes.add( attributeFactory.buildIdAttribute( jpaMappingType, properties.next() )
);
}
return attributes;
}