Top Description Inners Fields Constructors Methods
org.hibernate.metamodel.internal

public Class AttributeFactory

extends Object
Class Inheritance
Imports
java.lang.reflect.Field, .Member, .Method, .ParameterizedType, .TypeVariable, .WildcardType, java.util.Iterator, javax.persistence.ManyToMany, .OneToOne, javax.persistence.metamodel.Attribute, .PluralAttribute, .Type, org.hibernate.AssertionFailure, org.hibernate.internal.EntityManagerMessageLogger, .HEMLogging, org.hibernate.mapping.Collection, .Component, .Map, .OneToMany, .PersistentClass, .Property, .Value, org.hibernate.metamodel.model.domain.internal.AbstractIdentifiableType, .BasicTypeImpl, .EmbeddableTypeImpl, .MapMember, .MappedSuperclassTypeImpl, .PluralAttributeBuilder, .SingularAttributeImpl, org.hibernate.metamodel.model.domain.spi.ManagedTypeDescriptor.InFlightAccess, .PersistentAttributeDescriptor, .EmbeddedTypeDescriptor, .IdentifiableTypeDescriptor, .ManagedTypeDescriptor, .SimpleTypeDescriptor, .SingularPersistentAttribute, org.hibernate.property.access.internal.PropertyAccessMapImpl, org.hibernate.property.access.spi.Getter, org.hibernate.tuple.entity.EntityMetamodel, org.hibernate.type.ComponentType, .CompositeType, .EmbeddedComponentType, .EntityType

A factory for building Attribute instances. Exposes 3 main services for building
  1. normal attributes
  2. id attributes
  3. version attributes
Authors
Steve Ebersole, Emmanuel Bernard

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
AttributeFactory.AttributeContext<
The owner type.
X
>

Bundle's a Hibernate property mapping together with the JPA metamodel information of the attribute owner.

private static interface
AttributeFactory.AttributeMetadata<
The attribute owner type
X
,
The attribute type.
Y
>

Basic contract for describing an attribute.

private abstract class
private static interface
AttributeFactory.MemberResolver

Contract for how we resolve the Member for a give attribute context.

private static interface
AttributeFactory.PluralAttributeMetadata<
The owner type
X
,
The attribute type (the collection type)
Y
,
The collection element type
E
>

Attribute metadata contract for a plural attribute.

private class
private static interface
AttributeFactory.SingularAttributeMetadata<
The owner type
X
,
The attribute type
Y
>

Attribute metadata contract for a non-plural attribute.

private class
private static interface
AttributeFactory.ValueContext

A contract for defining the meta information about a Value

Field Summary

Modifier and TypeField and Description
private final MetadataContext
private final AttributeFactory.MemberResolver
private final AttributeFactory.MemberResolver
private static final EntityManagerMessageLogger
private final AttributeFactory.MemberResolver
normalMemberResolver

A Member resolver for normal attributes.

private final AttributeFactory.MemberResolver
private final AttributeFactory.MemberResolver

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected <Y> Class<Y>
public <
The type of the owner
X
,
The attribute type
Y
>
PersistentAttributeDescriptor<X, Y>

Returns:

The built attribute descriptor or null if the attribute is not part of the JPA 2 model (eg backrefs)
buildAttribute
(ManagedTypeDescriptor<X>
The descriptor of the attribute owner (aka declarer).
ownerType
,
Property
The Hibernate property descriptor for the attribute
property
)

Build a normal attribute.

public <
The type of the owner
X
,
The attribute type
Y
>
SingularPersistentAttribute<X, Y>

Returns:

The built attribute descriptor
buildIdAttribute
(IdentifiableTypeDescriptor<X>
The descriptor of the attribute owner (aka declarer).
ownerType
,
Property
The Hibernate property descriptor for the identifier attribute
property
)

Build the identifier attribute descriptor

private <X, Y, E, K> PersistentAttributeDescriptor<X, Y>
public <
The type of the owner
X
,
The attribute type
Y
>
SingularAttributeImpl<X, Y>

Returns:

The built attribute descriptor
buildVersionAttribute
(IdentifiableTypeDescriptor<X>
The descriptor of the attribute owner (aka declarer).
ownerType
,
Property
The Hibernate property descriptor for the version attribute
property
)

Build the version attribute descriptor

private <
The owner type
X
,
The attribute type
Y
>
AttributeFactory.AttributeMetadata<X, Y>

Returns:

The attribute description
determineAttributeMetadata
(AttributeFactory.AttributeContext<X>
The attribute to be described
attributeContext
,
AttributeFactory.MemberResolver
Strategy for how to resolve the member defining the attribute.
memberResolver
)

Here is most of the nuts and bolts of this factory, where we interpret the known JPA metadata against the known Hibernate metadata and build a descriptor for the attribute.

public static PluralAttribute.CollectionType
private <Y> SimpleTypeDescriptor<Y>
public static Attribute.PersistentAttributeType
private EntityMetamodel
public static ParameterizedType
public static boolean
private <X> AttributeFactory.AttributeContext<X>
wrap(final ManagedTypeDescriptor<X> ownerType, final Property property)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait