Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] API changes for derived id work

Hello again all,

I've made a few more changes due to the fact that we have to scan java source types for basic type mapping annotations (@Entity, @Embeddable, etc.) before they ever get put into the context model, and so cannot count on the context model to answer all our "mapping" questions.

org.eclipse.jpt.core.JpaAnnotationDefinitionProvider
org.eclipse.jpt.core.JpaAnnotationProvider
added back: typeMappingAnnotationDefinitions(), which is now used only when determining whether resource java types should be added to the context model (and validating resource java types which have specifically *not* been added to the context model)

org.eclipse.jpt.core.JpaProject
annotatedClassNames() -> annotatedJavaSourceClassNames() (java source classes with any recognized annotation) and mappedJavaSourceClassNames() (java source classes with recognized *mapping* annotations)

org.eclipse.jpt.core.resource.java.JavaResourcePersistentType
added: isMapped(), which determines whether the resource type has one of the type mapping annotations contributed by the annotation providers for that platform


Thanks,
Paul

Paul Fullbright wrote:
Hello all,

With respect to the changes I'm making to core functionality to support the new JPA 2.0 derived id functionality, I have made some API changes to core code.

I have removed the distinction between "mapping" and "supporting" annotations in the resource model. All context model type/attribute mappings still know what annotations are "supporting" the main mapping annotation, but the resource model is blissfully ignorant.

API changed:

org.eclipse.jpt.core.JpaAnnotationDefinitionProvider

typeMapping/SupportingAnnotationDefinitions() -> typeAnnotationDefinitions() attributeMapping/SupportingAnnotationDefinitions() -> attributeAnnotationDefinitions()


org.eclipse.jpt.core.JpaAnnotationProvider

   typeMapping/SupportingAnnotationNames() -> typeAnnotationNames()
   buildTypeMapping/SupportingAnnotation(..) -> buildTypeAnnotation(..)
   buildNullTypeSupportingAnnotation(..) -> buildNullTypeAnnotation(..)
attributeMapping/SupportingAnnotationNames() -> attributeAnnotationNames() buildAttributeMapping/SupportingAnnotation(..) -> buildAttributeAnnotation(..) buildNullAttributeMapping/SupportingAnnotation(..) -> buildNullAttributeAnnotation(..)


org.eclipse.jpt.core.JpaPlatform

In JpaPlatform, I changed the API to return type (and attribute, previously) mapping providers rather than having the platform build them itself. buildJavaTypeMappingFromAnnotation/MappingKey(..) -> getJavaTypeMappingProvider(JavaPersistentType persistentType -or- String mappingKey)


org.eclipse.jpt.core.context.java.JavaAttributeMappingProvider

   defaultApplies(..) -> testDefault(..)
   specifiedApplies(..) -> testSpecified(..)


org.eclipse.jpt.core.context.java.JavaTypeMappingProvider
added boolean test(..) for determining if a type mapping provider applies to a JavaPersistentType


org.eclipse.jpt.core.context.java.JavaPersistentType

   hasAnyAttributePersistenceAnnotations() -> hasAnyAnnotatedAttributes()


org.eclipse.jpt.core.context.java.JavaTypeMapping

   correspondingAnnotationNames() -> supportingAnnotationNames()


org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember

Most of the changes are here, collapsing "mapping" annotations and "supporting" annotations into just annotations.
 MAPPING/SUPPORTING_ANNOTATIONS_COLLECTION -> ANNOTATIONS_COLLECTION
 mapping/supportingAnnotations() -> annotations()
 mapping/supportingAnnotatinsSize() -> annotationsSize()
 addMapping/SupportingAnnotation(..) -> addAnnotation(..)
 getMapping/SupportingAnnotation(..) -> getAnnotation(..)
 moveSupportingAnnotation(..) -> moveAnnotation(..)
 removeMapping/SupportingAnnotation(..) -> removeAnnotation(..)

removed getMappingAnnotation() as determining what annotation takes precedence is now done by the mapping providers

isPersisted() -> isAnnotated() (as there is no "mapping" annotation at this level, we can just determine whether or not a member is annotated with something we recognize)

setMappingAnnotation(String annotationName) -> setPrimaryAnnotation(String primaryAnnotation, String[] supportingAnnotations) This new method is used when changing mapping types (or something similar). The supporting annotations, if any, are retained on the member, and all other recognized annotations are removed.


org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute

 getNullMappingAnnotation(..) -> getNullAnnotation(..)

removed boolean hasAnyPersistenceAnnotations() (use JavaResourcePersistentMember.isAnnotated() instead)


org.eclipse.jpt.core.resource.java.JavaResourcePersistentType

  hasAnyAttributePersistenceAnnotations() -> hasAnyAnnotatedAttributes()


The rest of the associated changes are to implementations/extensions of these interfaces/classes or to internal classes. If there are any questions or problems, please feel free to let me know.

Thanks,
Paul



--
Paul Fullbright
Eclipse Java Persistence Tools (Dali) Development
Oracle



Back to the top