Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/Accessor.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java347
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java197
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaAnnotationProvider.java174
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractAccessor.java268
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java314
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java560
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/FieldAccessor.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PropertyAccessor.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java344
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java508
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentFieldValidator.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java)33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java237
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java401
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyJoinColumn2_0Annotation.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java225
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java657
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java190
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java700
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java281
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java473
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java279
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java178
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java380
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java408
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java930
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java254
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java168
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java4
586 files changed, 7298 insertions, 18302 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java
index c49f656fec..0e6a73cbe2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java
@@ -9,11 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
+
/**
- * Provides annotation definitions for types and attributes.
- * {@link JpaAnnotationProvider}
+ * Provides annotation definitions and nestable annotation definitions
+ * {@link AnnotationProvider}
* then uses a collection of these to build annotations.
* <p>
* Provisional API: This interface is part of an interim API that is still
@@ -28,24 +30,13 @@ import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
public interface JpaAnnotationDefinitionProvider
{
/**
- * Return all annotation definitions which can appear on a type
- */
- Iterable<AnnotationDefinition> getTypeAnnotationDefinitions();
-
- /**
- * Return all annotation definitions which can appear on a type and are used to determine
- * whether and how the type is persisted (how it is "mapped").
- * This should be a subset of {@link #getTypeAnnotationDefinitions()}.
+ * Return all annotation definitions
*/
- Iterable<AnnotationDefinition> getTypeMappingAnnotationDefinitions();
-
- /**
- * Return all annotation definitions which can appear on an attribute
- */
- Iterable<AnnotationDefinition> getAttributeAnnotationDefinitions();
+ Iterable<AnnotationDefinition> getAnnotationDefinitions();
/**
- * Return all annotation definitions which can appear on a package.
+ * Return all nestable annotation definitions
*/
- Iterable<AnnotationDefinition> getPackageAnnotationDefinitions();
+ Iterable<NestableAnnotationDefinition> getNestableAnnotationDefinitions();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java
deleted file mode 100644
index 4802b5d1e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * This is used to provide type and attribute annotations.
- * Also provides list of supported annotation names, check the appropriate list
- * before trying to build an annotation with that name. An exception will
- * be thrown on an attempt to build an annotation that does not exist.
- *
- * This interface is not intended to be implemented. Instead implement
- * JpaAnnotationDefinitionProvider to extend the list of supported annotation definitions.
- *
- * @see JpaAnnotationDefinitionProvider
- * @version 3.0
- * @since 2.0?
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public interface JpaAnnotationProvider
-{
- // ********** type annotations **********
-
- /**
- * Return the names of the annotations that can appear on a type.
- */
- Iterator<String> typeAnnotationNames();
-
- /**
- * Return the names of the annotations that can appear on a type and are used to
- * determine whether and how the type is persisted (how it is "mapped").
- * This should be a subset of {@link #typeAnnotationNames()}.
- */
- Iterator<String> typeMappingAnnotationNames();
-
- /**
- * Build a type annotation with the specified name.
- * Throw an IllegalArgumentException if the specified name is unsupported.
- * @see #typeAnnotationNames()
- */
- Annotation buildTypeAnnotation(
- JavaResourcePersistentType parent, Type type, String annotationName);
-
- /**
- * Build a type annotation for the specified JDT annotation.
- * Throw an IllegalArgumentException if the specified annotation is unsupported.
- * @see #typeAnnotationNames()
- */
- Annotation buildTypeAnnotation(
- JavaResourcePersistentType parent, IAnnotation jdtAnnotation);
-
- /**
- * Build a null type annotation with the specified name.
- * Throw an IllegalArgumentException if the specified annotation is unsupported.
- * @see #typeAnnotationNames()
- */
- Annotation buildNullTypeAnnotation(
- JavaResourcePersistentType parent, String annotationName);
-
-
- // ********** attribute annotations **********
-
- /**
- * Return the names of the annotations that can appear on an attribute.
- */
- Iterator<String> attributeAnnotationNames();
-
- /**
- * Build an attribute annotation with the specified name.
- * Throw an IllegalArgumentException if the specified name is unsupported.
- * @see #attributeAnnotationNames()
- */
- Annotation buildAttributeAnnotation(
- JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName);
-
- /**
- * Build an attribute annotation for the specified JDT annotation.
- * Throw an IllegalArgumentException if the specified annotation is unsupported.
- * @see #attributeAnnotationNames()
- */
- Annotation buildAttributeAnnotation(
- JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation);
-
- /**
- * Build a null attribute annotation with the specified name.
- * Throw an IllegalArgumentException if the specified annotation is unsupported.
- * @see #attributeAnnotationNames()
- */
- Annotation buildNullAttributeAnnotation(
- JavaResourcePersistentAttribute parent, String annotationName);
-
-
- // ********** package annotations **********
-
- /**
- * Return the names of the annotations that can appear on a package.
- */
- Iterator<String> packageAnnotationNames();
-
- /**
- * Build an package annotation with the specified name.
- * Throw an IllegalArgumentException if the specified name is unsupported.
- * @see #packageAnnotationNames()
- */
- Annotation buildPackageAnnotation(
- JavaResourcePackage parent, AnnotatedPackage pack, String annotationName);
-
- /**
- * Build a package annotation for the specified JDT annotation.
- * Throw an IllegalArgumentException if the specified name is unsupported.
- * @see #packageAnnotationNames()
- */
- Annotation buildPackageAnnotation(
- JavaResourcePackage parent, IAnnotation jdtAnnotation);
-
- /**
- * Build a null package annotation with the specified name.
- * Throw an IllegalArgumentException if the specified annotation is unsupported.
- * @see #packageAnnotationNames()
- */
- Annotation buildNullPackageAnnotation(
- JavaResourcePackage parent, String annotationName);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java
index 47577aa1b0..dafa2c44ae 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java
@@ -12,6 +12,9 @@ package org.eclipse.jpt.jpa.core;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.PersistentType;
@@ -21,6 +24,7 @@ import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
import org.eclipse.jpt.jpa.core.context.Table;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.Accessor;
import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
@@ -86,8 +90,6 @@ import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
@@ -176,7 +178,7 @@ public interface JpaFactory
// ********** Java Context Model **********
- JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt);
+ JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourceType jrt);
JavaEntity buildJavaEntity(JavaPersistentType parent, EntityAnnotation entityAnnotation);
@@ -185,8 +187,12 @@ public interface JpaFactory
JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation embeddableAnnotation);
JavaTypeMapping buildJavaNullTypeMapping(JavaPersistentType parent);
+
+ JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, Accessor accessor);
+
+ JavaPersistentAttribute buildJavaPersistentField(PersistentType parent, JavaResourceField resourceField);
- JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa);
+ JavaPersistentAttribute buildJavaPersistentProperty(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter);
JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
index 31e90ffb19..6eae60b1d3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.core;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
@@ -88,7 +89,7 @@ public interface JpaPlatform
* Return an annotation provider responsible for determining what Java
* annotations are supported and constructing java resource model objects.
*/
- JpaAnnotationProvider getAnnotationProvider();
+ AnnotationProvider getAnnotationProvider();
/**
* Return a formatter that can clean up the Java annotations added to source
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java
index 642b10598d..31fa055d62 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -17,15 +17,15 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceTypeCache;
import org.eclipse.jpt.common.utility.CommandExecutor;
import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer;
import org.eclipse.jpt.common.utility.synchronizers.Synchronizer;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentTypeCache;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
@@ -140,9 +140,9 @@ public interface JpaProject
// ********** external Java resource persistent types **********
/**
- * Return the JPA project's external Java resource persistent type cache.
+ * Return the JPA project's external Java resource type cache.
*/
- JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache();
+ JavaResourceTypeCache getExternalJavaResourceTypeCache();
// ********** XML resources **********
@@ -191,11 +191,19 @@ public interface JpaProject
*/
Iterable<String> getMappedJavaSourceClassNames();
+ Iterable<String> getTypeMappingAnnotations();
+
/**
- * Return the Java resource persistent type for the specified type.
+ * Return the Java resource type for the specified type.
* Return null if invalid or absent.
*/
- JavaResourcePersistentType getJavaResourcePersistentType(String typeName);
+ JavaResourceAbstractType getJavaResourceType(String typeName);
+
+ /**
+ * Return the {@link JavaResourceAbstractType} with the specified type name and kind.
+ * Return null if invalid or absent or if the kind does not match.
+ */
+ JavaResourceAbstractType getJavaResourceType(String typeName, JavaResourceAbstractType.Kind kind);
/**
* Return the Java resource package for the specified package.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java
index d65ffc57bf..3c14ddb3c5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Association override container.
@@ -41,12 +41,12 @@ public interface AssociationOverrideContainer
ReadOnlyRelationship resolveOverriddenRelationship(String attributeName);
// covariant overrides
- ListIterator<? extends ReadOnlyAssociationOverride> overrides();
+ ListIterable<? extends ReadOnlyAssociationOverride> getOverrides();
ReadOnlyAssociationOverride getOverrideNamed(String name);
- ListIterator<? extends AssociationOverride> specifiedOverrides();
+ ListIterable<? extends AssociationOverride> getSpecifiedOverrides();
AssociationOverride getSpecifiedOverride(int index);
AssociationOverride getSpecifiedOverrideNamed(String name);
- ListIterator<? extends VirtualAssociationOverride> virtualOverrides();
+ ListIterable<? extends VirtualAssociationOverride> getVirtualOverrides();
VirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride);
AssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java
index e3a51dad74..d45a10d633 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Attribute override container.
@@ -36,12 +36,12 @@ public interface AttributeOverrideContainer
ReadOnlyColumn resolveOverriddenColumn(String attributeName);
// covariant overrides
- ListIterator<? extends ReadOnlyAttributeOverride> overrides();
+ ListIterable<? extends ReadOnlyAttributeOverride> getOverrides();
ReadOnlyAttributeOverride getOverrideNamed(String name);
- ListIterator<? extends AttributeOverride> specifiedOverrides();
+ ListIterable<? extends AttributeOverride> getSpecifiedOverrides();
AttributeOverride getSpecifiedOverride(int index);
AttributeOverride getSpecifiedOverrideNamed(String name);
- ListIterator<? extends VirtualAttributeOverride> virtualOverrides();
+ ListIterable<? extends VirtualAttributeOverride> getVirtualOverrides();
VirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride);
AttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java
index ed494b6929..b376d9e03c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* entity
@@ -82,24 +82,24 @@ public interface Entity
/**
* Return the secondary tables whether specified or default.
*/
- ListIterator<? extends ReadOnlySecondaryTable> secondaryTables();
+ ListIterable<? extends ReadOnlySecondaryTable> getSecondaryTables();
/**
* Return the number of secondary tables, both specified and default.
*/
- int secondaryTablesSize();
+ int getSecondaryTablesSize();
/**
* Return a list iterator of the specified secondary tables.
* This will not be null.
*/
- ListIterator<? extends SecondaryTable> specifiedSecondaryTables();
+ ListIterable<? extends SecondaryTable> getSpecifiedSecondaryTables();
String SPECIFIED_SECONDARY_TABLES_LIST = "specifiedSecondaryTables"; //$NON-NLS-1$
/**
* Return the number of specified secondary tables.
*/
- int specifiedSecondaryTablesSize();
+ int getSpecifiedSecondaryTablesSize();
/**
* Add a specified secondary table to the entity return the object
@@ -211,14 +211,14 @@ public interface Entity
// ********** primary key join columns **********
- ListIterator<? extends ReadOnlyPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterable<? extends ReadOnlyPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
- int primaryKeyJoinColumnsSize();
+ int getPrimaryKeyJoinColumnsSize();
- ListIterator<? extends PrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<? extends PrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
String SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST = "specifiedPrimaryKeyJoinColumns"; //$NON-NLS-1$
- int specifiedPrimaryKeyJoinColumnsSize();
+ int getSpecifiedPrimaryKeyJoinColumnsSize();
PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java
index a6338dfce5..e796fa3791 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Join column relationship strategy.
@@ -37,12 +37,12 @@ public interface JoinColumnRelationshipStrategy
// ********** join columns **********
- ListIterator<? extends JoinColumn> joinColumns();
+ ListIterable<? extends JoinColumn> getJoinColumns();
// ********** specified join columns **********
- ListIterator<? extends JoinColumn> specifiedJoinColumns();
+ ListIterable<? extends JoinColumn> getSpecifiedJoinColumns();
JoinColumn getSpecifiedJoinColumn(int index);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java
index 1fbeba8c73..f5169be42b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Used by many-to-many and one-to-many mappings.
@@ -41,9 +41,9 @@ public interface JoinTable
*/
void convertDefaultInverseJoinColumnToSpecified();
- ListIterator<? extends JoinColumn> inverseJoinColumns();
+ ListIterable<? extends JoinColumn> getInverseJoinColumns();
- ListIterator<? extends JoinColumn> specifiedInverseJoinColumns();
+ ListIterable<? extends JoinColumn> getSpecifiedInverseJoinColumns();
JoinColumn getSpecifiedInverseJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java
index eb032de7c6..3f582e9b33 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.jpa.core.context;
import java.util.Iterator;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
@@ -93,13 +93,12 @@ public interface OverrideContainer
/**
* Return the overrides, both <em>specified</em> and <em>virtual</em>.
*/
- // TODO bjv change to an iterable
- ListIterator<? extends ReadOnlyOverride> overrides();
+ ListIterable<? extends ReadOnlyOverride> getOverrides();
/**
* Return the number of overrides, both <em>specified</em> and <em>virtual</em>.
*/
- int overridesSize();
+ int getOverridesSize();
/**
* Return the override with the specified name,
@@ -121,13 +120,13 @@ public interface OverrideContainer
* <em>Specified</em> overrides can be remvoed via
* {@link Override_#convertToVirtual()}.
*/
- ListIterator<? extends Override_> specifiedOverrides();
+ ListIterable<? extends Override_> getSpecifiedOverrides();
String SPECIFIED_OVERRIDES_LIST = "specifiedOverrides"; //$NON-NLS-1$
/**
* Return the number of <em>specified</em> overrides.
*/
- int specifiedOverridesSize();
+ int getSpecifiedOverridesSize();
/**
* Return the <em>specified</em> override at the specified index.
@@ -157,14 +156,14 @@ public interface OverrideContainer
/**
* Return the <em>virtual</em> overrides (i.e. those not <em>specified</em>).
*/
- // TODO change to a collection?
- ListIterator<? extends VirtualOverride> virtualOverrides();
+ // TODO change to a Iterable instead of ListIterable?
+ ListIterable<? extends VirtualOverride> getVirtualOverrides();
String VIRTUAL_OVERRIDES_LIST = "virtualOverrides"; //$NON-NLS-1$
/**
* Return the number of <em>virtual</em> overrides.
*/
- int virtualOverridesSize();
+ int getVirtualOverridesSize();
/**
* Convert the specified <em>virtual</em> override to <em>specified</em>.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java
index 56d56f6943..adeb788f4c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java
@@ -11,9 +11,9 @@ package org.eclipse.jpt.jpa.core.context;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -72,29 +72,29 @@ public interface PersistentType
/**
* Return the persistent type's persistent attributes.
*/
- <T extends ReadOnlyPersistentAttribute> ListIterator<T> attributes();
+ ListIterable<? extends ReadOnlyPersistentAttribute> getAttributes();
/**
* Return the number of the persistent type's persistent attributes.
*/
- int attributesSize();
+ int getAttributesSize();
/**
* Return the names of the persistent type's persistent attributes.
*/
- Iterator<String> attributeNames();
+ Iterable<String> getAttributeNames();
/**
* Return all the persistent attributes in the persistent type's
* inheritance hierarchy.
*/
- Iterator<ReadOnlyPersistentAttribute> allAttributes();
+ Iterable<ReadOnlyPersistentAttribute> getAllAttributes();
/**
* Return the names of all the persistent attributes in the
* persistent type's hierarchy.
*/
- Iterator<String> allAttributeNames();
+ Iterable<String> getAllAttributeNames();
/**
* Return the persistent attribute with the specified name,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java
index 0fe8328ec8..3d450d4dfd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Primary key join column relationship strategy.
@@ -37,16 +37,16 @@ public interface PrimaryKeyJoinColumnRelationshipStrategy
/**
* Return the strategy's primary key join columns.
*/
- ListIterator<? extends PrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterable<? extends PrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
/**
* Return the number of primary key join columns.
*/
- int primaryKeyJoinColumnsSize();
+ int getPrimaryKeyJoinColumnsSize();
/**
* Return whether the relationship has any primary key join columns.
- * (Equivalent to {@link #primaryKeyJoinColumnsSize()} == 0.)
+ * (Equivalent to {@link #getPrimaryKeyJoinColumnsSize()} == 0.)
*/
boolean hasPrimaryKeyJoinColumns();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java
index 80633bcb55..c6829d95c3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java
@@ -63,7 +63,7 @@ public interface Query
/**
* Return the query's hints.
*/
- <T extends QueryHint> ListIterable<T> getHints();
+ ListIterable<? extends QueryHint> getHints();
/**
* Return the number of hints.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java
index 681b93fa9c..46ff9ddbc5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Container for named queries and/or named native queries.
@@ -33,14 +33,14 @@ public interface QueryContainer
/**
* Return the container's named queries.
*/
- <T extends NamedQuery> ListIterator<T> namedQueries();
+ ListIterable<? extends NamedQuery> getNamedQueries();
String NAMED_QUERIES_LIST = "namedQueries"; //$NON-NLS-1$
/**
* Return the number of named queries.
*/
- int namedQueriesSize();
+ int getNamedQueriesSize();
/**
* Add a new named query to the container and return it.
@@ -74,14 +74,14 @@ public interface QueryContainer
/**
* Return the container's named native queries.
*/
- <T extends NamedNativeQuery> ListIterator<T> namedNativeQueries();
+ ListIterable<? extends NamedNativeQuery> getNamedNativeQueries();
String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueries"; //$NON-NLS-1$
/**
* Return the number of named native queries.
*/
- int namedNativeQueriesSize();
+ int getNamedNativeQueriesSize();
/**
* Add a new named native query to the container and return it.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java
index d880764b28..b3e0a990aa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java
@@ -74,6 +74,6 @@ public interface ReadOnlyBaseJoinColumn
* Return the number of join columns in the owner's list the join
* column belongs to.
*/
- int joinColumnsSize();
+ int getJoinColumnsSize();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java
index 287e821fab..c29e1f8e7f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
@@ -56,12 +56,12 @@ public interface ReadOnlyJoinColumnRelationshipStrategy
/**
* Return the join columns whether specified or default.
*/
- ListIterator<? extends ReadOnlyJoinColumn> joinColumns();
+ ListIterable<? extends ReadOnlyJoinColumn> getJoinColumns();
/**
* Return the number of join columns, whether specified and default.
*/
- int joinColumnsSize();
+ int getJoinColumnsSize();
// ********** specified join columns **********
@@ -74,16 +74,16 @@ public interface ReadOnlyJoinColumnRelationshipStrategy
/**
* Return the specified join columns.
*/
- ListIterator<? extends ReadOnlyJoinColumn> specifiedJoinColumns();
+ ListIterable<? extends ReadOnlyJoinColumn> getSpecifiedJoinColumns();
/**
* Return the number of specified join columns.
*/
- int specifiedJoinColumnsSize();
+ int getSpecifiedJoinColumnsSize();
/**
* Return whether the strategy has any specified join columns.
- * (Equivalent to {@link #specifiedJoinColumnsSize()} != 0.)
+ * (Equivalent to {@link #getSpecifiedJoinColumnsSize()} != 0.)
*/
boolean hasSpecifiedJoinColumns();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java
index 838d16c904..b356f98499 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Used by association overrides.
@@ -33,23 +33,23 @@ public interface ReadOnlyJoinTable
/**
* Return the join table's inverse join columns, whether specified or default.
*/
- ListIterator<? extends ReadOnlyJoinColumn> inverseJoinColumns();
+ ListIterable<? extends ReadOnlyJoinColumn> getInverseJoinColumns();
/**
* Return the number of inverse join columns, whether specified or default.
*/
- int inverseJoinColumnsSize();
+ int getInverseJoinColumnsSize();
/**
* Return the specified inverse join columns.
*/
- ListIterator<? extends ReadOnlyJoinColumn> specifiedInverseJoinColumns();
+ ListIterable<? extends ReadOnlyJoinColumn> getSpecifiedInverseJoinColumns();
String SPECIFIED_INVERSE_JOIN_COLUMNS_LIST = "specifiedInverseJoinColumns"; //$NON-NLS-1$
/**
* Return the number of specified inverse join columns.
*/
- int specifiedInverseJoinColumnsSize();
+ int getSpecifiedInverseJoinColumnsSize();
/**
* Return whether the join table has specified inverse join columns.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java
index ed2fba7080..23e0917bb2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Read-only reference table (i.e. a table that joins with one other table,
@@ -35,23 +35,23 @@ public interface ReadOnlyReferenceTable
/**
* Return the reference table's join columns, whether specified or default.
*/
- ListIterator<? extends ReadOnlyJoinColumn> joinColumns();
+ ListIterable<? extends ReadOnlyJoinColumn> getJoinColumns();
/**
* Return the number of join columns, whether specified or default.
*/
- int joinColumnsSize();
+ int getJoinColumnsSize();
/**
* Return the reference table's specified join columns.
*/
- ListIterator<? extends ReadOnlyJoinColumn> specifiedJoinColumns();
+ ListIterable<? extends ReadOnlyJoinColumn> getSpecifiedJoinColumns();
String SPECIFIED_JOIN_COLUMNS_LIST = "specifiedJoinColumns"; //$NON-NLS-1$
/**
* Return the number of specified join columns.
*/
- int specifiedJoinColumnsSize();
+ int getSpecifiedJoinColumnsSize();
/**
* Return whether the reference table has specified join columns.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java
index 90cd0ada13..b491f4ac37 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Read-only entity secondary table
@@ -39,13 +39,13 @@ public interface ReadOnlySecondaryTable
* Return the secondary table's primary key join columns,
* whether specified or default.
*/
- ListIterator<? extends ReadOnlyPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterable<? extends ReadOnlyPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
/**
* Return the number of primary key join columns,
* whether specified or default.
*/
- int primaryKeyJoinColumnsSize();
+ int getPrimaryKeyJoinColumnsSize();
// ********** specified primary key join columns **********
@@ -53,13 +53,13 @@ public interface ReadOnlySecondaryTable
/**
* Return the specified primary key join columns.
*/
- ListIterator<? extends ReadOnlyPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<? extends ReadOnlyPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
String SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST = "specifiedPrimaryKeyJoinColumns"; //$NON-NLS-1$
/**
* Return the number of specified primary key join columns.
*/
- int specifiedPrimaryKeyJoinColumnsSize();
+ int getSpecifiedPrimaryKeyJoinColumnsSize();
// ********** default primary key join columns **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java
index 6820ddbdd0..43a793961a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
import org.eclipse.jpt.jpa.db.Catalog;
@@ -101,9 +101,9 @@ public interface ReadOnlyTable
// ********** unique constraints **********
- ListIterator<? extends ReadOnlyUniqueConstraint> uniqueConstraints();
+ ListIterable<? extends ReadOnlyUniqueConstraint> getUniqueConstraints();
String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$
- int uniqueConstraintsSize();
+ int getUniqueConstraintsSize();
ReadOnlyUniqueConstraint getUniqueConstraint(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java
index fa5b2f781b..ebda45d015 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Reference table (i.e. a table that joins with one other table,
@@ -36,9 +36,9 @@ public interface ReferenceTable
*/
void convertDefaultJoinColumnToSpecified();
- ListIterator<? extends JoinColumn> joinColumns();
+ ListIterable<? extends JoinColumn> getJoinColumns();
- ListIterator<? extends JoinColumn> specifiedJoinColumns();
+ ListIterable<? extends JoinColumn> getSpecifiedJoinColumns();
JoinColumn getSpecifiedJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java
index bdcdac8846..9c91492b04 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* entity secondary table
@@ -26,8 +26,8 @@ import java.util.ListIterator;
public interface SecondaryTable
extends Table, ReadOnlySecondaryTable
{
- ListIterator<? extends PrimaryKeyJoinColumn> primaryKeyJoinColumns();
- ListIterator<? extends PrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<? extends PrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+ ListIterable<? extends PrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
PrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java
index 4561781a39..f25f804419 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* <ul>
@@ -36,7 +36,7 @@ public interface Table
void setSpecifiedCatalog(String value);
- ListIterator<? extends UniqueConstraint> uniqueConstraints();
+ ListIterable<? extends UniqueConstraint> getUniqueConstraints();
UniqueConstraint getUniqueConstraint(int index);
UniqueConstraint addUniqueConstraint();
UniqueConstraint addUniqueConstraint(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java
index 985be639ce..0905e56be0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Virtual join column relationship strategy.
@@ -23,8 +23,8 @@ import java.util.ListIterator;
public interface VirtualJoinColumnRelationshipStrategy
extends ReadOnlyJoinColumnRelationshipStrategy, VirtualRelationshipStrategy
{
- ListIterator<? extends VirtualJoinColumn> joinColumns();
- ListIterator<? extends VirtualJoinColumn> specifiedJoinColumns();
+ ListIterable<? extends VirtualJoinColumn> getJoinColumns();
+ ListIterable<? extends VirtualJoinColumn> getSpecifiedJoinColumns();
VirtualJoinColumn getSpecifiedJoinColumn(int index);
VirtualJoinColumn getDefaultJoinColumn();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java
index c144623532..263988cd70 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Used by association overrides.
@@ -25,8 +25,8 @@ public interface VirtualJoinTable
{
VirtualJoinTableRelationshipStrategy getParent();
- ListIterator<? extends VirtualJoinColumn> inverseJoinColumns();
- ListIterator<? extends VirtualJoinColumn> specifiedInverseJoinColumns();
+ ListIterable<? extends VirtualJoinColumn> getInverseJoinColumns();
+ ListIterable<? extends VirtualJoinColumn> getSpecifiedInverseJoinColumns();
VirtualJoinColumn getSpecifiedInverseJoinColumn(int index);
VirtualJoinColumn getDefaultInverseJoinColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java
index f6f7fdb925..21a4ec56c7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Virtual reference table
@@ -23,8 +23,8 @@ import java.util.ListIterator;
public interface VirtualReferenceTable
extends VirtualTable, ReadOnlyReferenceTable
{
- ListIterator<? extends VirtualJoinColumn> joinColumns();
- ListIterator<? extends VirtualJoinColumn> specifiedJoinColumns();
+ ListIterable<? extends VirtualJoinColumn> getJoinColumns();
+ ListIterable<? extends VirtualJoinColumn> getSpecifiedJoinColumns();
VirtualJoinColumn getSpecifiedJoinColumn(int index);
VirtualJoinColumn getDefaultJoinColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java
index 2251a30bce..f9275f56f9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Virtual secondary table
@@ -23,8 +23,8 @@ import java.util.ListIterator;
public interface VirtualSecondaryTable
extends VirtualTable, ReadOnlySecondaryTable
{
- ListIterator<? extends VirtualPrimaryKeyJoinColumn> primaryKeyJoinColumns();
- ListIterator<? extends VirtualPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<? extends VirtualPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+ ListIterable<? extends VirtualPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
VirtualPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
SecondaryTable getOverriddenTable();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java
index fb99190b62..2f5a64bd31 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Virtual table
@@ -25,6 +25,6 @@ public interface VirtualTable
{
ReadOnlyTable getOverriddenTable();
- ListIterator<? extends VirtualUniqueConstraint> uniqueConstraints();
+ ListIterable<? extends VirtualUniqueConstraint> getUniqueConstraints();
VirtualUniqueConstraint getUniqueConstraint(int index);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/Accessor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/Accessor.java
new file mode 100644
index 0000000000..d483ec56ad
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/Accessor.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.context.java;
+
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+
+/**
+ * Represents a JPA accessor (field/property).
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.1
+ * @since 3.1
+ */
+public interface Accessor extends JpaContextNode
+{
+ /**
+ * Return the <em>resource</em> attribute(field/method) that is to be annotated.
+ */
+ JavaResourceAttribute getResourceAttribute();
+
+ boolean isFor(JavaResourceField resourceField);
+
+ boolean isFor(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter);
+
+ /**
+ * Build a Java persistent attribute that wraps the original Java resource
+ * attributes and behaves as though it has no annotations. This will cause
+ * all the settings in the Java <em>context</em> attribute to default.
+ */
+ JavaPersistentAttribute buildUnannotatedJavaAttribute(PersistentType parent);
+
+ AccessType getDefaultAccess();
+
+ JptValidator buildAttributeValidator(PersistentAttribute persistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java
index d79ec223b3..e71862f8e3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java
@@ -9,13 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -45,13 +44,13 @@ public interface JarFile
* Return the JAR file's Java persistent types.
* Return only the types that are annotated with JPA annotations.
*/
- Iterator<JavaPersistentType> javaPersistentTypes();
+ Iterable<JavaPersistentType> getJavaPersistentTypes();
String JAVA_PERSISTENT_TYPES_COLLECTION = "javaPersistentTypes"; //$NON-NLS-1$
/**
* Return the size of the JAR file's Java persistent types.
*/
- int javaPersistentTypesSize();
+ int getJavaPersistentTypesSize();
// ********** validation **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java
index d963e33cd4..9677de19a6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
import org.eclipse.jpt.jpa.core.context.Override_;
import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship;
@@ -39,12 +39,12 @@ public interface JavaAssociationOverrideContainer
ReadOnlyOverrideRelationship getOverrideRelationship(String overrideName);
// covariant overrides
- ListIterator<JavaReadOnlyAssociationOverride> overrides();
+ ListIterable<JavaReadOnlyAssociationOverride> getOverrides();
JavaReadOnlyAssociationOverride getOverrideNamed(String name);
- ListIterator<JavaAssociationOverride> specifiedOverrides();
+ ListIterable<JavaAssociationOverride> getSpecifiedOverrides();
JavaAssociationOverride getSpecifiedOverride(int index);
JavaAssociationOverride getSpecifiedOverrideNamed(String name);
- ListIterator<JavaVirtualAssociationOverride> virtualOverrides();
+ ListIterable<JavaVirtualAssociationOverride> getVirtualOverrides();
JavaVirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride);
JavaAssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java
index 0a438ef690..5a585114d1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* Java attribute mapping
@@ -32,7 +32,7 @@ public interface JavaAttributeMapping
JavaPersistentAttribute getPersistentAttribute();
- JavaResourcePersistentAttribute getResourcePersistentAttribute();
+ JavaResourceAttribute getResourceAttribute();
Annotation getMappingAnnotation();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java
index 5e8f23600e..039cfd4a2d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
import org.eclipse.jpt.jpa.core.context.Override_;
import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
@@ -39,12 +39,12 @@ public interface JavaAttributeOverrideContainer
ReadOnlyColumn getOverrideColumn(String overrideName);
// covariant overrides
- ListIterator<JavaReadOnlyAttributeOverride> overrides();
+ ListIterable<JavaReadOnlyAttributeOverride> getOverrides();
JavaReadOnlyAttributeOverride getOverrideNamed(String name);
- ListIterator<JavaAttributeOverride> specifiedOverrides();
+ ListIterable<JavaAttributeOverride> getSpecifiedOverrides();
JavaAttributeOverride getSpecifiedOverride(int index);
JavaAttributeOverride getSpecifiedOverrideNamed(String name);
- ListIterator<JavaVirtualAttributeOverride> virtualOverrides();
+ ListIterable<JavaVirtualAttributeOverride> getVirtualOverrides();
JavaVirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride);
JavaAttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java
index 60df112508..1b2d8c96e0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,12 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.utility.internal.ClassName;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* Java converter
@@ -76,7 +76,7 @@ public interface JavaConverter
*
* @see #buildConverter(Annotation, JavaAttributeMapping, JpaFactory)
*/
- Annotation getConverterAnnotation(JavaResourcePersistentAttribute javaResourcePersistentAttribute);
+ Annotation getConverterAnnotation(JavaResourceAttribute javaResourceAttribute);
/**
* Build a converter using the specified converter annotation.
@@ -97,7 +97,7 @@ public interface JavaConverter
* Remove the adapter's converter annotation from the specified
* Java resource persistent member.
*/
- void removeConverterAnnotation(JavaResourcePersistentAttribute javaResourcePersistentAttribute);
+ void removeConverterAnnotation(JavaResourceAttribute javaResourcePersistentAttribute);
}
@@ -107,31 +107,31 @@ public interface JavaConverter
implements JavaConverter.Adapter
{
public JavaConverter buildConverter(JavaAttributeMapping parent, JpaFactory factory) {
- Annotation annotation = this.getConverterAnnotation(parent.getResourcePersistentAttribute());
+ Annotation annotation = this.getConverterAnnotation(parent.getResourceAttribute());
return (annotation == null) ? null : this.buildConverter(annotation, parent, factory);
}
- public Annotation getConverterAnnotation(JavaResourcePersistentAttribute attribute) {
+ public Annotation getConverterAnnotation(JavaResourceAttribute attribute) {
return attribute.getAnnotation(this.getAnnotationName());
}
protected abstract String getAnnotationName();
public JavaConverter buildNewConverter(JavaAttributeMapping parent, JpaFactory factory) {
- return this.buildConverter(this.buildConverterAnnotationIfNecessary(parent.getResourcePersistentAttribute()), parent, factory);
+ return this.buildConverter(this.buildConverterAnnotationIfNecessary(parent.getResourceAttribute()), parent, factory);
}
- protected Annotation buildConverterAnnotationIfNecessary(JavaResourcePersistentAttribute attribute) {
+ protected Annotation buildConverterAnnotationIfNecessary(JavaResourceAttribute attribute) {
// the annotation may already be present, after we remove the other converter annotations
Annotation annotation = this.getConverterAnnotation(attribute);
return (annotation != null) ? annotation : this.buildConverterAnnotation(attribute);
}
- protected Annotation buildConverterAnnotation(JavaResourcePersistentAttribute attribute) {
+ protected Annotation buildConverterAnnotation(JavaResourceAttribute attribute) {
return attribute.addAnnotation(this.getAnnotationName());
}
- public void removeConverterAnnotation(JavaResourcePersistentAttribute attribute) {
+ public void removeConverterAnnotation(JavaResourceAttribute attribute) {
attribute.removeAnnotation(this.getAnnotationName());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java
index ea466ee4e9..993344ef97 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
@@ -39,16 +39,16 @@ public interface JavaEntity
// ********** secondary tables **********
- ListIterator<JavaSecondaryTable> secondaryTables();
- ListIterator<JavaSecondaryTable> specifiedSecondaryTables();
+ ListIterable<JavaSecondaryTable> getSecondaryTables();
+ ListIterable<JavaSecondaryTable> getSpecifiedSecondaryTables();
JavaSecondaryTable addSpecifiedSecondaryTable();
JavaSecondaryTable addSpecifiedSecondaryTable(int index);
// ********** primary key join columns **********
- ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns();
- ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+ ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java
index ec8671ad3c..a054463334 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.context.Converter;
import org.eclipse.jpt.jpa.core.context.EnumeratedConverter;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java
index 8592c86715..3615dcae23 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,8 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.context.GeneratorContainer;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
/**
* Java generator container
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java
index cba596937c..cf5e5dc3af 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy;
/**
@@ -27,9 +27,9 @@ import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy;
public interface JavaJoinColumnRelationshipStrategy
extends JoinColumnRelationshipStrategy, JavaRelationshipStrategy
{
- ListIterator<JavaJoinColumn> joinColumns();
+ ListIterable<JavaJoinColumn> getJoinColumns();
- ListIterator<JavaJoinColumn> specifiedJoinColumns();
+ ListIterable<JavaJoinColumn> getSpecifiedJoinColumns();
JavaJoinColumn getSpecifiedJoinColumn(int index);
JavaJoinColumn addSpecifiedJoinColumn();
JavaJoinColumn addSpecifiedJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java
index 7d1ac7c54f..38644bad90 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.JoinTable;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
@@ -35,9 +35,9 @@ public interface JavaJoinTable
// ********** inverse join columns **********
- ListIterator<JavaJoinColumn> inverseJoinColumns();
+ ListIterable<JavaJoinColumn> getInverseJoinColumns();
- ListIterator<JavaJoinColumn> specifiedInverseJoinColumns();
+ ListIterable<JavaJoinColumn> getSpecifiedInverseJoinColumns();
JavaJoinColumn getSpecifiedInverseJoinColumn(int index);
JavaJoinColumn addSpecifiedInverseJoinColumn();
JavaJoinColumn addSpecifiedInverseJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java
index 2158df7c79..83b059ee32 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.context.Converter;
import org.eclipse.jpt.jpa.core.context.LobConverter;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java
index 0d915857af..3c8ddfa1b5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
@@ -30,6 +29,4 @@ public interface JavaNamedNativeQuery
{
NamedNativeQueryAnnotation getQueryAnnotation();
- // required to resolve ambiguity
- ListIterable<JavaQueryHint> getHints();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java
index bf742d7a87..d20b49c229 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
@@ -29,7 +28,4 @@ public interface JavaNamedQuery
extends NamedQuery, JavaQuery
{
NamedQueryAnnotation getQueryAnnotation();
-
- // required to resolve ambiguity
- ListIterable<JavaQueryHint> getHints();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java
index 62933f3ea9..b300c2b616 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java
@@ -9,13 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.OverrideContainer;
import org.eclipse.jpt.jpa.core.context.Override_;
import org.eclipse.jpt.jpa.core.context.VirtualOverride;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
/**
* Java attribute or association override container
@@ -43,12 +43,12 @@ public interface JavaOverrideContainer
Iterable<String> getOverrideNames();
// covariant overrides
- ListIterator<? extends JavaReadOnlyOverride> overrides();
+ ListIterable<? extends JavaReadOnlyOverride> getOverrides();
JavaReadOnlyOverride getOverrideNamed(String name);
- ListIterator<? extends JavaOverride> specifiedOverrides();
+ ListIterable<? extends JavaOverride> getSpecifiedOverrides();
JavaOverride getSpecifiedOverride(int index);
JavaOverride getSpecifiedOverrideNamed(String name);
- ListIterator<? extends JavaVirtualOverride> virtualOverrides();
+ ListIterable<? extends JavaVirtualOverride> getVirtualOverrides();
JavaVirtualOverride convertOverrideToVirtual(Override_ specifiedOverride);
JavaOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
@@ -58,7 +58,7 @@ public interface JavaOverrideContainer
interface Owner
extends OverrideContainer.Owner
{
- JavaResourcePersistentMember getResourcePersistentMember();
+ JavaResourceMember getResourceMember();
TextRange getValidationTextRange(CompilationUnit astRoot);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java
index 68f880167f..73637c835f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java
@@ -10,11 +10,13 @@
package org.eclipse.jpt.jpa.core.context.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
import org.eclipse.jpt.jpa.core.context.CollectionMapping;
import org.eclipse.jpt.jpa.core.context.Embeddable;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* Context Java persistent <em>attribute</em> (field or property).
@@ -41,44 +43,38 @@ public interface JavaPersistentAttribute
// ********** misc **********
/**
- * Return the corresponding <em>resource</em> persistent attribute.
+ * Return the accessor(field/property) for the attribute
*/
- JavaResourcePersistentAttribute getResourcePersistentAttribute();
+ Accessor getAccessor();
/**
- * Return whether the attribute contains the given offset into its Java
- * source code file.
- */
- boolean contains(int offset, CompilationUnit astRoot);
-
- /**
- * Return the embeddable (type mapping) corresponding to the persistent
- * attribute's type. Return <code>null</code> if it is not found.
+ * Return the corresponding <em>resource</em> attribute.
+ * This is the attribute (field/method) that is annotated.
+ * @see Accessor#getResourceAttribute()
*/
- Embeddable getEmbeddable();
+ JavaResourceAttribute getResourceAttribute();
/**
- * Return whether the attribute is a field (as opposed to a property).
+ * @see Accessor#isFor(JavaResourceField)
*/
- boolean isField();
+ boolean isFor(JavaResourceField resourceField);
/**
- * Return whether the attribute is a property (as opposed to a field).
+ * @see Accessor#isFor(JavaResourceMethod, JavaResourceMethod)
*/
- boolean isProperty();
+ boolean isFor(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter);
/**
- * Return whether the attribute is <code>public</code>,
- * which is problematic for fields.
+ * Return whether the attribute contains the given offset into its Java
+ * source code file.
*/
- boolean isPublic();
+ boolean contains(int offset, CompilationUnit astRoot);
/**
- * Return whether the attribute is <code>final</code>,
- * which is problematic.
+ * Return the embeddable (type mapping) corresponding to the persistent
+ * attribute's type. Return <code>null</code> if it is not found.
*/
- boolean isFinal();
-
+ Embeddable getEmbeddable();
// ********** type **********
@@ -127,8 +123,8 @@ public interface JavaPersistentAttribute
String getTypeName();
boolean isContainer();
boolean isMap();
- String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute);
- String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute);
+ String getMultiReferenceTargetTypeName(JavaResourceAttribute resourceAttribute);
+ String getMultiReferenceMapKeyTypeName(JavaResourceAttribute resourceAttribute);
String getMetamodelContainerFieldTypeName();
String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping);
@@ -150,10 +146,10 @@ public interface JavaPersistentAttribute
public boolean isMap() {
return false;
}
- public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ public String getMultiReferenceTargetTypeName(JavaResourceAttribute resourceAttribute) {
return null;
}
- public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ public String getMultiReferenceMapKeyTypeName(JavaResourceAttribute resourceAttribute) {
return null;
}
public String getMetamodelContainerFieldTypeName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java
index 0ab09a0dc5..30200d7a66 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* Context Java persistent type.
@@ -33,8 +33,7 @@ public interface JavaPersistentType
JavaTypeMapping getMapping();
- @SuppressWarnings("unchecked")
- ListIterator<JavaPersistentAttribute> attributes();
+ ListIterable<JavaPersistentAttribute> getAttributes();
String ATTRIBUTES_LIST = "attributes"; //$NON-NLS-1$
JavaPersistentAttribute getAttributeNamed(String attributeName);
@@ -50,7 +49,7 @@ public interface JavaPersistentType
/**
* Return the Java resource persistent type.
*/
- JavaResourcePersistentType getResourcePersistentType();
+ JavaResourceType getJavaResourceType();
- JavaPersistentAttribute getAttributeFor(JavaResourcePersistentAttribute javaResourcePersistentAttribute);
+ JavaPersistentAttribute getAttributeFor(JavaResourceAttribute javaResourceAttribute);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java
index 16158a0615..6c5dfea50d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationshipStrategy;
/**
@@ -27,7 +27,7 @@ import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationshipStrategy
public interface JavaPrimaryKeyJoinColumnRelationshipStrategy
extends JavaRelationshipStrategy, PrimaryKeyJoinColumnRelationshipStrategy
{
- ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
JavaPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index);
JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn();
JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java
index 9dbea1e546..da27403d3f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,7 +35,6 @@ public interface JavaQuery
// ********** hints **********
- @SuppressWarnings("unchecked")
ListIterable<JavaQueryHint> getHints();
JavaQueryHint addHint();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java
index 6f7afe6241..044261ba17 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.QueryContainer;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
/**
* Java query container
@@ -30,8 +30,7 @@ public interface JavaQueryContainer
{
// ********** named queries **********
- @SuppressWarnings("unchecked")
- ListIterator<JavaNamedQuery> namedQueries();
+ ListIterable<JavaNamedQuery> getNamedQueries();
JavaNamedQuery addNamedQuery();
@@ -40,8 +39,7 @@ public interface JavaQueryContainer
// ********** named native queries **********
- @SuppressWarnings("unchecked")
- ListIterator<JavaNamedNativeQuery> namedNativeQueries();
+ ListIterable<JavaNamedNativeQuery> getNamedNativeQueries();
JavaNamedNativeQuery addNamedNativeQuery();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java
index d65d9fe62e..b93abfeda9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.ReferenceTable;
import org.eclipse.jpt.jpa.core.resource.java.ReferenceTableAnnotation;
@@ -33,9 +33,9 @@ public interface JavaReferenceTable
// ********** join columns **********
- ListIterator<JavaJoinColumn> joinColumns();
+ ListIterable<JavaJoinColumn> getJoinColumns();
- ListIterator<JavaJoinColumn> specifiedJoinColumns();
+ ListIterable<JavaJoinColumn> getSpecifiedJoinColumns();
JavaJoinColumn getSpecifiedJoinColumn(int index);
JavaJoinColumn addSpecifiedJoinColumn();
JavaJoinColumn addSpecifiedJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java
index 27b74cab7c..f36f708557 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.SecondaryTable;
import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
@@ -35,8 +35,8 @@ public interface JavaSecondaryTable
// ********** primary key join columns **********
- ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns();
- ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+ ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn();
JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java
index 15e8dfd953..b34de68cad 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.Table;
import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
@@ -30,7 +30,7 @@ public interface JavaTable
{
BaseTableAnnotation getTableAnnotation();
- ListIterator<JavaUniqueConstraint> uniqueConstraints();
+ ListIterable<JavaUniqueConstraint> getUniqueConstraints();
JavaUniqueConstraint getUniqueConstraint(int index);
JavaUniqueConstraint addUniqueConstraint();
JavaUniqueConstraint addUniqueConstraint(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java
index a05540642d..29055561a9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.context.Converter;
import org.eclipse.jpt.jpa.core.context.TemporalConverter;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java
index 034db01fe9..0578698820 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,9 @@
package org.eclipse.jpt.jpa.core.context.java;
import java.util.Iterator;
-
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* Java type mapping
@@ -30,7 +29,7 @@ import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
public interface JavaTypeMapping
extends TypeMapping, JavaJpaContextNode
{
- JavaResourcePersistentType getResourcePersistentType();
+ JavaResourceType getJavaResourceType();
Annotation getMappingAnnotation();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java
index 28dfa505e0..27ccf16bb5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,8 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
/**
* Map a string key to a type mapping and its corresponding
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java
index b9b9bc4c10..2e0262d863 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationshipStrategy;
/**
@@ -24,8 +24,8 @@ import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationshipStrategy;
public interface JavaVirtualJoinColumnRelationshipStrategy
extends VirtualJoinColumnRelationshipStrategy, JavaVirtualRelationshipStrategy
{
- ListIterator<JavaVirtualJoinColumn> joinColumns();
- ListIterator<JavaVirtualJoinColumn> specifiedJoinColumns();
+ ListIterable<JavaVirtualJoinColumn> getJoinColumns();
+ ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns();
JavaVirtualJoinColumn getSpecifiedJoinColumn(int index);
JavaVirtualJoinColumn getDefaultJoinColumn();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java
index e2da3a12db..a70f5dbbbe 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
import org.eclipse.jpt.jpa.core.context.VirtualJoinTable;
@@ -27,16 +27,16 @@ public interface JavaVirtualJoinTable
{
JavaVirtualJoinTableRelationshipStrategy getParent();
- ListIterator<JavaVirtualUniqueConstraint> uniqueConstraints();
+ ListIterable<JavaVirtualUniqueConstraint> getUniqueConstraints();
JavaVirtualUniqueConstraint getUniqueConstraint(int index);
- ListIterator<JavaVirtualJoinColumn> joinColumns();
- ListIterator<JavaVirtualJoinColumn> specifiedJoinColumns();
+ ListIterable<JavaVirtualJoinColumn> getJoinColumns();
+ ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns();
JavaVirtualJoinColumn getSpecifiedJoinColumn(int index);
JavaVirtualJoinColumn getDefaultJoinColumn();
- ListIterator<JavaVirtualJoinColumn> inverseJoinColumns();
- ListIterator<JavaVirtualJoinColumn> specifiedInverseJoinColumns();
+ ListIterable<JavaVirtualJoinColumn> getInverseJoinColumns();
+ ListIterable<JavaVirtualJoinColumn> getSpecifiedInverseJoinColumns();
JavaVirtualJoinColumn getSpecifiedInverseJoinColumn(int index);
JavaVirtualJoinColumn getDefaultInverseJoinColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java
index c5c9da81e9..0e77913758 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.context.orm;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.Schema;
@@ -146,14 +146,14 @@ public interface EntityMappings
boolean containsOffset(int textOffset);
/**
- * Return the Java resource persistent type for the specified class name
+ * Return the Java resource type for the specified class name
* found in the JPA project. First look for one with the specified
* name (since it might be fully qualified). If not found, prepend the
* default package name and try again.
*
* @see #getPackage()
*/
- JavaResourcePersistentType resolveJavaResourcePersistentType(String className);
+ JavaResourceAbstractType resolveJavaResourceType(String className);
/**
* Return the persistent type for the specified class name
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java
index 563e15bae3..8241f04350 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java
@@ -9,8 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
import org.eclipse.jpt.jpa.core.context.Override_;
import org.eclipse.jpt.jpa.core.context.VirtualOverride;
@@ -32,12 +32,12 @@ public interface OrmAssociationOverrideContainer
extends AssociationOverrideContainer, OrmOverrideContainer
{
// covariant overrides
- ListIterator<OrmReadOnlyAssociationOverride> overrides();
+ ListIterable<OrmReadOnlyAssociationOverride> getOverrides();
OrmReadOnlyAssociationOverride getOverrideNamed(String name);
- ListIterator<OrmAssociationOverride> specifiedOverrides();
+ ListIterable<OrmAssociationOverride> getSpecifiedOverrides();
OrmAssociationOverride getSpecifiedOverride(int index);
OrmAssociationOverride getSpecifiedOverrideNamed(String name);
- ListIterator<OrmVirtualAssociationOverride> virtualOverrides();
+ ListIterable<OrmVirtualAssociationOverride> getVirtualOverrides();
OrmVirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride);
OrmAssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java
index 9419a6cc89..cd0d995573 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java
@@ -9,8 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
import org.eclipse.jpt.jpa.core.context.Override_;
import org.eclipse.jpt.jpa.core.context.VirtualOverride;
@@ -34,12 +34,12 @@ public interface OrmAttributeOverrideContainer
void initializeFrom(OrmAttributeOverrideContainer oldContainer);
// covariant overrides
- ListIterator<OrmReadOnlyAttributeOverride> overrides();
+ ListIterable<OrmReadOnlyAttributeOverride> getOverrides();
OrmReadOnlyAttributeOverride getOverrideNamed(String name);
- ListIterator<OrmAttributeOverride> specifiedOverrides();
+ ListIterable<OrmAttributeOverride> getSpecifiedOverrides();
OrmAttributeOverride getSpecifiedOverride(int index);
OrmAttributeOverride getSpecifiedOverrideNamed(String name);
- ListIterator<OrmVirtualAttributeOverride> virtualOverrides();
+ ListIterable<OrmVirtualAttributeOverride> getVirtualOverrides();
OrmVirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride);
OrmAttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java
index 505e4d7ff5..37ae997983 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
@@ -46,21 +46,21 @@ public interface OrmEntity
// ********** secondary tables **********
- ListIterator<ReadOnlySecondaryTable> secondaryTables();
- ListIterator<OrmSecondaryTable> specifiedSecondaryTables();
+ ListIterable<ReadOnlySecondaryTable> getSecondaryTables();
+ ListIterable<OrmSecondaryTable> getSpecifiedSecondaryTables();
OrmSecondaryTable addSpecifiedSecondaryTable();
OrmSecondaryTable addSpecifiedSecondaryTable(int index);
/**
* Return the virtual (not specified) secondary tables.
*/
- ListIterator<OrmVirtualSecondaryTable> virtualSecondaryTables();
+ ListIterable<OrmVirtualSecondaryTable> getVirtualSecondaryTables();
String VIRTUAL_SECONDARY_TABLES_LIST = "virtualSecondaryTables"; //$NON-NLS-1$
/**
* Return the number of virtual secondary tables.
*/
- int virtualSecondaryTablesSize();
+ int getVirtualSecondaryTablesSize();
/**
* Return true if there are no virtual secondary tables on the orm entity.
@@ -80,12 +80,13 @@ public interface OrmEntity
// ********** primary key join columns **********
- ListIterator<ReadOnlyPrimaryKeyJoinColumn> primaryKeyJoinColumns();
- ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<ReadOnlyPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+ ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn();
OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
- ListIterator<ReadOnlyPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns();
+ ListIterable<ReadOnlyPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns();
+ int getDefaultPrimaryKeyJoinColumnsSize();
String DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST = "defaultPrimaryKeyJoinColumns"; //$NON-NLS-1$
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java
index 3f01842efa..d6af886c1b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy;
/**
@@ -27,9 +27,9 @@ import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy;
public interface OrmJoinColumnRelationshipStrategy
extends JoinColumnRelationshipStrategy, OrmRelationshipStrategy
{
- ListIterator<OrmJoinColumn> joinColumns();
+ ListIterable<OrmJoinColumn> getJoinColumns();
- ListIterator<OrmJoinColumn> specifiedJoinColumns();
+ ListIterable<OrmJoinColumn> getSpecifiedJoinColumns();
OrmJoinColumn getSpecifiedJoinColumn(int index);
OrmJoinColumn addSpecifiedJoinColumn();
OrmJoinColumn addSpecifiedJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java
index 4d3d7a27bc..c7ec6c1230 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.JoinTable;
/**
@@ -31,9 +31,9 @@ public interface OrmJoinTable
// ********** inverse join columns **********
- ListIterator<OrmJoinColumn> inverseJoinColumns();
+ ListIterable<OrmJoinColumn> getInverseJoinColumns();
- ListIterator<OrmJoinColumn> specifiedInverseJoinColumns();
+ ListIterable<OrmJoinColumn> getSpecifiedInverseJoinColumns();
OrmJoinColumn getSpecifiedInverseJoinColumn(int index);
OrmJoinColumn addSpecifiedInverseJoinColumn();
OrmJoinColumn addSpecifiedInverseJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java
index bde37c1a12..c42f2c62bf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
@@ -29,7 +28,4 @@ public interface OrmNamedNativeQuery
extends OrmQuery, NamedNativeQuery
{
XmlNamedNativeQuery getXmlQuery();
-
- // required to resolve ambiguity
- ListIterable<OrmQueryHint> getHints();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java
index 5ca76242d9..1bbac18d43 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
@@ -30,7 +29,4 @@ public interface OrmNamedQuery
{
XmlNamedQuery getXmlQuery();
- // required to resolve ambiguity
- ListIterable<OrmQueryHint> getHints();
-
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java
index 7c59e2d496..07357527d4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.OverrideContainer;
import org.eclipse.jpt.jpa.core.context.Override_;
import org.eclipse.jpt.jpa.core.context.VirtualOverride;
@@ -40,12 +40,12 @@ public interface OrmOverrideContainer
* there is simply a list of overrides.
*/
XmlContextNode getParent();
- ListIterator<? extends OrmReadOnlyOverride> overrides();
+ ListIterable<? extends OrmReadOnlyOverride> getOverrides();
OrmReadOnlyOverride getOverrideNamed(String name);
- ListIterator<? extends OrmOverride> specifiedOverrides();
+ ListIterable<? extends OrmOverride> getSpecifiedOverrides();
OrmOverride getSpecifiedOverride(int index);
OrmOverride getSpecifiedOverrideNamed(String name);
- ListIterator<? extends OrmVirtualOverride> virtualOverrides();
+ ListIterable<? extends OrmVirtualOverride> getVirtualOverrides();
OrmVirtualOverride convertOverrideToVirtual(Override_ specifiedOverride);
OrmOverride convertOverrideToSpecified(VirtualOverride virtualOverride);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java
index b5b5c6ac12..9ab880c257 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -46,8 +46,7 @@ public interface OrmPersistentType
* <em>virtual</em> attributes are those derived from the corresponding
* Java persistent type.
*/
- @SuppressWarnings("unchecked")
- ListIterator<OrmReadOnlyPersistentAttribute> attributes();
+ ListIterable<OrmReadOnlyPersistentAttribute> getAttributes();
OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName);
@@ -59,12 +58,12 @@ public interface OrmPersistentType
/**
* Return the persistent type's specified attributes.
*/
- ListIterator<OrmPersistentAttribute> specifiedAttributes();
+ ListIterable<OrmPersistentAttribute> getSpecifiedAttributes();
/**
* Return the number of the persistent type's specified attributes.
*/
- int specifiedAttributesSize();
+ int getSpecifiedAttributesSize();
// TODO this is currently only used by tests; remove it and change tests to use
// OrmReadOnlyPersistenAttribute.convertToSpecified(String mappingKey)
@@ -80,13 +79,13 @@ public interface OrmPersistentType
* are attributes that exist in the corresponding Java class, but are not
* specified in the <code>orm.xml</code>.
*/
- ListIterator<OrmReadOnlyPersistentAttribute> virtualAttributes();
+ ListIterable<OrmReadOnlyPersistentAttribute> getVirtualAttributes();
/**
* Return the number of virtual <code>orm.xml</code> persistent attributes.
- * @see #virtualAttributes()
+ * @see #getVirtualAttributes()
*/
- int virtualAttributesSize();
+ int getVirtualAttributesSize();
/**
* Convert the specified attribute to a virtual attribute. Remove the
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java
index 3333e28146..a6aef3afef 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationshipStrategy;
/**
@@ -27,7 +27,7 @@ import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationshipStrategy
public interface OrmPrimaryKeyJoinColumnRelationshipStrategy
extends OrmRelationshipStrategy, PrimaryKeyJoinColumnRelationshipStrategy
{
- ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
OrmPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index);
OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn();
OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java
index c4e55a211a..21bcadd2f4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,7 +35,6 @@ public interface OrmQuery
// ********** hints **********
- @SuppressWarnings("unchecked")
ListIterable<OrmQueryHint> getHints();
OrmQueryHint addHint();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java
index 4ef6ed563e..99adfc4bf4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.QueryContainer;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
@@ -30,8 +30,7 @@ public interface OrmQueryContainer
{
// ********** named queries **********
- @SuppressWarnings("unchecked")
- ListIterator<OrmNamedQuery> namedQueries();
+ ListIterable<OrmNamedQuery> getNamedQueries();
OrmNamedQuery addNamedQuery();
@@ -40,8 +39,7 @@ public interface OrmQueryContainer
// ********** named native queries **********
- @SuppressWarnings("unchecked")
- ListIterator<OrmNamedNativeQuery> namedNativeQueries();
+ ListIterable<OrmNamedNativeQuery> getNamedNativeQueries();
OrmNamedNativeQuery addNamedNativeQuery();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java
index 6995be47ff..c0d60174e0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,11 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* Read-only context <code>orm.xml</code> persistent <em>attribute</em>
@@ -62,7 +64,11 @@ public interface OrmReadOnlyPersistentAttribute
*/
JavaPersistentAttribute resolveJavaPersistentAttribute();
- JavaResourcePersistentAttribute getJavaResourcePersistentAttribute();
+ JavaResourceAttribute getJavaResourceAttribute();
+
+ boolean isFor(JavaResourceField javaResourceField);
+
+ boolean isFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter);
boolean contains(int textOffset);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java
index 71f53cdf13..a5118a1231 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.ReferenceTable;
/**
@@ -28,10 +28,10 @@ public interface OrmReferenceTable
extends ReferenceTable, OrmTable
{
// ********** join columns **********
-
- ListIterator<OrmJoinColumn> joinColumns();
- ListIterator<OrmJoinColumn> specifiedJoinColumns();
+ ListIterable<OrmJoinColumn> getJoinColumns();
+
+ ListIterable<OrmJoinColumn> getSpecifiedJoinColumns();
OrmJoinColumn getSpecifiedJoinColumn(int index);
OrmJoinColumn addSpecifiedJoinColumn();
OrmJoinColumn addSpecifiedJoinColumn(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java
index cd600a1310..93f476b411 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
import org.eclipse.jpt.jpa.core.context.SecondaryTable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
@@ -38,8 +38,8 @@ public interface OrmSecondaryTable
// ********** primary key join columns **********
- ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns();
- ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+ ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn();
OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java
index c9fe562037..89e5d98697 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.Table;
/**
@@ -27,7 +27,7 @@ import org.eclipse.jpt.jpa.core.context.Table;
public interface OrmTable
extends Table, OrmReadOnlyTable
{
- ListIterator<OrmUniqueConstraint> uniqueConstraints();
+ ListIterable<OrmUniqueConstraint> getUniqueConstraints();
OrmUniqueConstraint getUniqueConstraint(int index);
OrmUniqueConstraint addUniqueConstraint();
OrmUniqueConstraint addUniqueConstraint(int index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java
index 248fbb8293..f938095e33 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationshipStrategy;
/**
@@ -24,8 +24,8 @@ import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationshipStrategy;
public interface OrmVirtualJoinColumnRelationshipStrategy
extends VirtualJoinColumnRelationshipStrategy, OrmVirtualRelationshipStrategy
{
- ListIterator<OrmVirtualJoinColumn> joinColumns();
- ListIterator<OrmVirtualJoinColumn> specifiedJoinColumns();
+ ListIterable<OrmVirtualJoinColumn> getJoinColumns();
+ ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns();
OrmVirtualJoinColumn getSpecifiedJoinColumn(int index);
OrmVirtualJoinColumn getDefaultJoinColumn();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java
index fc41b30297..2a200360fb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
import org.eclipse.jpt.jpa.core.context.VirtualJoinTable;
@@ -27,16 +27,16 @@ public interface OrmVirtualJoinTable
{
OrmVirtualJoinTableRelationshipStrategy getParent();
- ListIterator<OrmVirtualUniqueConstraint> uniqueConstraints();
+ ListIterable<OrmVirtualUniqueConstraint> getUniqueConstraints();
OrmVirtualUniqueConstraint getUniqueConstraint(int index);
- ListIterator<OrmVirtualJoinColumn> joinColumns();
- ListIterator<OrmVirtualJoinColumn> specifiedJoinColumns();
+ ListIterable<OrmVirtualJoinColumn> getJoinColumns();
+ ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns();
OrmVirtualJoinColumn getSpecifiedJoinColumn(int index);
OrmVirtualJoinColumn getDefaultJoinColumn();
- ListIterator<OrmVirtualJoinColumn> inverseJoinColumns();
- ListIterator<OrmVirtualJoinColumn> specifiedInverseJoinColumns();
+ ListIterable<OrmVirtualJoinColumn> getInverseJoinColumns();
+ ListIterable<OrmVirtualJoinColumn> getSpecifiedInverseJoinColumns();
OrmVirtualJoinColumn getSpecifiedInverseJoinColumn(int index);
OrmVirtualJoinColumn getDefaultInverseJoinColumn();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java
index 5f8a9971d7..937913dd5b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.VirtualSecondaryTable;
import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
@@ -25,8 +25,8 @@ import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
public interface OrmVirtualSecondaryTable
extends VirtualSecondaryTable, OrmReadOnlyTable
{
- ListIterator<OrmVirtualPrimaryKeyJoinColumn> primaryKeyJoinColumns();
- ListIterator<OrmVirtualPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ ListIterable<OrmVirtualPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+ ListIterable<OrmVirtualPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
OrmVirtualPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn();
JavaSecondaryTable getOverriddenTable();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java
index 616c3c94a8..9c15fc8639 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.orm;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
@@ -18,7 +20,6 @@ import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
@@ -99,7 +100,14 @@ public interface OrmXmlContextNodeFactory
* must build objects that implement the appropriate behavior.
* @see org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyPersistentAttribute2_0
*/
- OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourcePersistentAttribute);
+ OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentField(OrmPersistentType parent, JavaResourceField javaResourceField);
+
+ /**
+ * NB: A factory for a version 1.0 <code>orm.xml</code> in a JPA 2.0 project
+ * must build objects that implement the appropriate behavior.
+ * @see org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyPersistentAttribute2_0
+ */
+ OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentProperty(OrmPersistentType parent, JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter);
OrmTable buildOrmTable(OrmEntity parent, Table.Owner owner);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java
index 8574352ec5..6262887092 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,8 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.persistence;
-import java.util.ListIterator;
-
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
@@ -53,12 +52,12 @@ public interface Persistence
/**
* Return the persistence element's persistence units.
*/
- ListIterator<PersistenceUnit> persistenceUnits();
+ ListIterable<PersistenceUnit> getPersistenceUnits();
/**
* Return the number of persistence units.
*/
- int persistenceUnitsSize();
+ int getPersistenceUnitsSize();
/**
* Add a persistence unit and return it.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
index 44afac5c51..aae3301d8b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
@@ -9,13 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.persistence;
-import java.util.Iterator;
-import java.util.ListIterator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.Embeddable;
@@ -183,19 +182,19 @@ public interface PersistenceUnit
* Return the persistence unit's list of mapping file refs,
* both specified and implied.
*/
- ListIterator<MappingFileRef> mappingFileRefs();
+ ListIterable<MappingFileRef> getMappingFileRefs();
/**
* Return the size of the persistence unit's list of mapping file refs,
* both specified and implied.
*/
- int mappingFileRefsSize();
+ int getMappingFileRefsSize();
/**
* Return all the mapping file refs, both specified and implied,
* containing the specified type.
*/
- Iterator<MappingFileRef> mappingFileRefsContaining(String typeName);
+ Iterable<MappingFileRef> getMappingFileRefsContaining(String typeName);
// ********** specified mapping file refs **********
@@ -209,12 +208,12 @@ public interface PersistenceUnit
/**
* Return the persistence unit's list of specified mapping file refs.
*/
- ListIterator<MappingFileRef> specifiedMappingFileRefs();
+ ListIterable<MappingFileRef> getSpecifiedMappingFileRefs();
/**
* Return the size of the persistence unit's list of specified mapping file refs.
*/
- int specifiedMappingFileRefsSize();
+ int getSpecifiedMappingFileRefsSize();
/**
* Add a new specified mapping file ref to the persistence unit;
@@ -264,12 +263,12 @@ public interface PersistenceUnit
/**
* Return the persistence unit's list of JAR file refs.
*/
- ListIterator<JarFileRef> jarFileRefs();
+ ListIterable<JarFileRef> getJarFileRefs();
/**
* Return the size of the persistence unit's list of JAR file refs.
*/
- int jarFileRefsSize();
+ int getJarFileRefsSize();
/**
* Add a new JAR file ref to the persistence unit;
@@ -300,13 +299,13 @@ public interface PersistenceUnit
* Return the persistence unit's list of class refs,
* both specified and implied.
*/
- Iterator<ClassRef> classRefs();
+ Iterable<ClassRef> getClassRefs();
/**
* Return the size of the persistence unit's list of class refs,
* both specified and implied.
*/
- int classRefsSize();
+ int getClassRefsSize();
// ********** specified class refs **********
@@ -320,12 +319,12 @@ public interface PersistenceUnit
/**
* Return the persistence unit's list of specified class refs.
*/
- ListIterator<ClassRef> specifiedClassRefs();
+ ListIterable<ClassRef> getSpecifiedClassRefs();
/**
* Return the size of the persistence unit's list of specified mapping file refs.
*/
- int specifiedClassRefsSize();
+ int getSpecifiedClassRefsSize();
/**
* Add a new specified class ref to the persistence unit;
@@ -361,12 +360,12 @@ public interface PersistenceUnit
/**
* Return the persistence unit's list of implied class refs.
*/
- Iterator<ClassRef> impliedClassRefs();
+ Iterable<ClassRef> getImpliedClassRefs();
/**
* Return the size of the persistence unit's list of implied class refs.
*/
- int impliedClassRefsSize();
+ int getImpliedClassRefsSize();
// ********** exclude unlisted classes **********
@@ -415,12 +414,12 @@ public interface PersistenceUnit
/**
* Return the persistence unit's list of properties.
*/
- ListIterator<Property> properties();
+ ListIterable<Property> getProperties();
/**
* Return the size of the persistence unit's list of properties.
*/
- int propertiesSize();
+ int getPropertiesSize();
/**
* Return the *first* property in the persistence unit's property list with
@@ -440,7 +439,7 @@ public interface PersistenceUnit
* Return the persistence unit's properties with names beginning with the
* specified prefix.
*/
- Iterator<Property> propertiesWithNamePrefix(String propertyNamePrefix);
+ Iterable<Property> getPropertiesWithNamePrefix(String propertyNamePrefix);
/**
* Add a new property to the persistence unit;
@@ -628,22 +627,14 @@ public interface PersistenceUnit
* whose corresponding mapping file mapping (or mapping file) is marked
* "metadata complete" is ignored.
*/
- // TODO bjv change to getGeneratorNames() etc.
- Iterator<Generator> generators();
+ Iterable<Generator> getGenerators();
/**
* Return the number of "active" generators defined within the persistence
* unit's scope.
- * @see #generators()
+ * @see #getGenerators()
*/
- int generatorsSize();
-
- /**
- * Add the specified generator (that is defined elsewhere) to the
- * list of generators defined within the persistence unit's scope.
- */
- // TODO bjv remove
- void addGenerator(Generator generator);
+ int getGeneratorsSize();
/**
* Return the names of the "active" generators defined in the persistence
@@ -664,17 +655,16 @@ public interface PersistenceUnit
* Return the "active" queries defined within the persistence unit's scope,
* including queries with duplicate names. These are very similar to
* generators.
- * @see #generators()
+ * @see #getGenerators()
*/
- // TODO bjv change to getQueryNames() etc.
- Iterator<Query> queries();
+ Iterable<Query> getQueries();
/**
* Return the number of "active" queries defined within the persistence
* unit's scope.
- * @see #queries()
+ * @see #getQueries()
*/
- int queriesSize();
+ int getQueriesSize();
/**
* Add the specified query (that is defined elsewhere) to the
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java
index 98ef23c467..1ff70d585a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,8 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context.persistence;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.jpa.core.context.java.JarFile;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java
index 9912509ddb..12efe74491 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,19 +10,16 @@
package org.eclipse.jpt.jpa.core.internal;
import java.util.ArrayList;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
public abstract class AbstractJpaAnnotationDefinitionProvider
implements JpaAnnotationDefinitionProvider
{
- protected ArrayList<AnnotationDefinition> typeAnnotationDefinitions;
+ protected ArrayList<AnnotationDefinition> annotationDefinitions;
- protected ArrayList<AnnotationDefinition> typeMappingAnnotationDefinitions;
-
- protected ArrayList<AnnotationDefinition> attributeAnnotationDefinitions;
-
- private ArrayList<AnnotationDefinition> packageAnnotationDefinitions;
+ protected ArrayList<NestableAnnotationDefinition> nestableAnnotationDefinitions;
protected AbstractJpaAnnotationDefinitionProvider() {
@@ -30,74 +27,40 @@ public abstract class AbstractJpaAnnotationDefinitionProvider
}
- // ********** type annotation definitions **********
+ // ********** annotation definitions **********
- public synchronized Iterable<AnnotationDefinition> getTypeAnnotationDefinitions() {
- if (this.typeAnnotationDefinitions == null) {
- this.typeAnnotationDefinitions = this.buildTypeAnnotationDefinitions();
+ public synchronized Iterable<AnnotationDefinition> getAnnotationDefinitions() {
+ if (this.annotationDefinitions == null) {
+ this.annotationDefinitions = this.buildAnnotationDefinitions();
}
- return this.typeAnnotationDefinitions;
+ return this.annotationDefinitions;
}
- protected ArrayList<AnnotationDefinition> buildTypeAnnotationDefinitions() {
+ protected ArrayList<AnnotationDefinition> buildAnnotationDefinitions() {
ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
- this.addTypeAnnotationDefinitionsTo(definitions);
+ this.addAnnotationDefinitionsTo(definitions);
return definitions;
}
- protected abstract void addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
+ protected abstract void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
- // ********** type mapping annotation definitions **********
+ // ********** nestable annotation definitions **********
- public synchronized Iterable<AnnotationDefinition> getTypeMappingAnnotationDefinitions() {
- if (this.typeMappingAnnotationDefinitions == null) {
- this.typeMappingAnnotationDefinitions = this.buildTypeMappingAnnotationDefinitions();
+ public synchronized Iterable<NestableAnnotationDefinition> getNestableAnnotationDefinitions() {
+ if (this.nestableAnnotationDefinitions == null) {
+ this.nestableAnnotationDefinitions = this.buildNestableAnnotationDefinitions();
}
- return this.typeMappingAnnotationDefinitions;
+ return this.nestableAnnotationDefinitions;
}
- protected ArrayList<AnnotationDefinition> buildTypeMappingAnnotationDefinitions() {
- ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
- this.addTypeMappingAnnotationDefinitionsTo(definitions);
+ protected ArrayList<NestableAnnotationDefinition> buildNestableAnnotationDefinitions() {
+ ArrayList<NestableAnnotationDefinition> definitions = new ArrayList<NestableAnnotationDefinition>();
+ this.addNestableAnnotationDefinitionsTo(definitions);
return definitions;
}
- protected abstract void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
-
-
- // ********** attribute annotation definitions **********
-
- public synchronized Iterable<AnnotationDefinition> getAttributeAnnotationDefinitions() {
- if (this.attributeAnnotationDefinitions == null) {
- this.attributeAnnotationDefinitions = this.buildAttributeAnnotationDefinitions();
- }
- return this.attributeAnnotationDefinitions;
- }
-
- protected ArrayList<AnnotationDefinition> buildAttributeAnnotationDefinitions() {
- ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
- this.addAttributeAnnotationDefinitionsTo(definitions);
- return definitions;
- }
+ protected abstract void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions);
- protected abstract void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
-
-
- // ********** package annotation definitions **********
-
- public synchronized Iterable<AnnotationDefinition> getPackageAnnotationDefinitions() {
- if (this.packageAnnotationDefinitions == null) {
- this.packageAnnotationDefinitions = this.buildPackageAnnotationDefinitions();
- }
- return this.packageAnnotationDefinitions;
- }
-
- protected ArrayList<AnnotationDefinition> buildPackageAnnotationDefinitions() {
- ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
- this.addPackageAnnotationDefinitionsTo(definitions);
- return definitions;
- }
-
- protected abstract void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
}
+
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
index a94704b588..bdc509a362 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
@@ -12,6 +12,9 @@ package org.eclipse.jpt.jpa.core.internal;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.JpaDataSource;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.JpaFile;
@@ -24,6 +27,7 @@ import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
import org.eclipse.jpt.jpa.core.context.Table;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
+import org.eclipse.jpt.jpa.core.context.java.Accessor;
import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
@@ -143,8 +147,6 @@ import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
@@ -206,14 +208,22 @@ public abstract class AbstractJpaFactory
// ********** Java Context Model **********
- public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) {
- return new GenericJavaPersistentType(owner, jrpt);
+ public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourceType jrt) {
+ return new GenericJavaPersistentType(owner, jrt);
}
-
- public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) {
- return new GenericJavaPersistentAttribute(parent, jrpa);
+
+ public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, Accessor accessor) {
+ return new GenericJavaPersistentAttribute(parent, accessor);
}
-
+
+ public JavaPersistentAttribute buildJavaPersistentField(PersistentType parent, JavaResourceField resourceField) {
+ return new GenericJavaPersistentAttribute(parent, resourceField);
+ }
+
+ public JavaPersistentAttribute buildJavaPersistentProperty(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
+ return new GenericJavaPersistentAttribute(parent, resourceGetter, resourceSetter);
+ }
+
public JavaTypeMapping buildJavaNullTypeMapping(JavaPersistentType parent) {
return new JavaNullTypeMapping(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
index ff1c226e10..534e84c352 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
@@ -9,13 +9,22 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
+import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.common.core.internal.utility.jdt.JDTModifiedDeclaration.Adapter;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport;
import org.eclipse.jpt.common.utility.internal.model.ChangeSupport;
@@ -27,6 +36,7 @@ import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.Database;
@@ -222,4 +232,341 @@ public abstract class AbstractJpaNode
* Useful for building validation messages.
*/
protected static final String[] EMPTY_STRING_ARRAY = StringTools.EMPTY_STRING_ARRAY;
+
+
+ /**
+ * Adapter used to synchronize a context collection container with its corresponding
+ * resource container.
+ * @param <C> the type of context elements
+ * @param <R> the type of resource elements
+ */
+ protected abstract class CollectionContainer<C, R> {
+
+ protected final Vector<C> contextElements = new Vector<C>();
+
+ protected CollectionContainer() {
+ super();
+ this.initializeContextElements();
+ }
+
+ /**
+ * Return the container's current set of resource elements.
+ * These are what the context elements will be synchronized to.
+ */
+ protected abstract Iterable<R> getResourceElements();
+
+ /**
+ * Return the resource element corresponding to the specified context
+ * element.
+ */
+ protected abstract R getResourceElement(C contextElement);
+
+ /**
+ * Build and return a context element for the given resource element
+ */
+ protected abstract C buildContextElement(R resourceElement);
+
+ /**
+ * Return the property name for event notification when the collection is changed.
+ */
+ protected abstract String getContextElementsPropertyName();
+
+ protected void initializeContextElements() {
+ for (R resourceElement : this.getResourceElements()) {
+ this.contextElements.add(this.buildContextElement(resourceElement));
+ }
+ }
+
+ /**
+ * Return an Iterable of the context elements
+ */
+ public Iterable<C> getContextElements() {
+ return new LiveCloneIterable<C>(this.contextElements);
+ }
+
+ /**
+ * Return the size of the context elements collection
+ */
+ public int getContextElementsSize() {
+ return this.contextElements.size();
+ }
+
+ /**
+ * Add a context element for the specified resource element at the
+ * specified index.
+ */
+ public C addContextElement(int index, R resourceElement) {
+ return this.addContextElement_(index, this.buildContextElement(resourceElement));
+ }
+
+ /**
+ * Add the specified context element to the collection ignoring
+ * the specified index as we only have a collection
+ */
+ protected C addContextElement_(@SuppressWarnings("unused") int index, C contextElement) {
+ AbstractJpaNode.this.addItemToCollection(contextElement, this.contextElements, this.getContextElementsPropertyName());
+ return contextElement;
+ }
+
+ /**
+ * Remove the specified context element from the container.
+ */
+ public void removeContextElement(C element) {
+ AbstractJpaNode.this.removeItemFromCollection(element, this.contextElements, this.getContextElementsPropertyName());
+ }
+
+ @SuppressWarnings("unused")
+ protected void moveContextElement(int index, C element) {
+ //no-op, not a list
+ }
+ }
+
+ /**
+ * Adapter used to synchronize a context collection container with its corresponding
+ * resource container.
+ * @param <C> the type of context elements
+ * @param <R> the type of resource elements
+ */
+ protected abstract class ContextCollectionContainer<C extends JpaContextNode, R> extends CollectionContainer<C, R> {
+
+ protected ContextCollectionContainer() {
+ super();
+ }
+
+ /**
+ * Using the specified adapter, synchronize a context container with its
+ * corresponding resource container: moving, removing, and adding elements
+ * as necessary.
+ * <p>
+ * We can do this because:<ul>
+ * <li>the XML translators will <em>move</em> the EMF elements when
+ * appropriate (as opposed to simply rebuilding them in place).
+ * <li>the Java resource model will re-use existing annotations when
+ * appropriate (as opposed to simply rebuilding them in place).
+ * </ul>
+ */
+ public void synchronizeWithResourceModel() {
+ sync(true); // true = sync
+ }
+
+ /**
+ * @see #synchronizeWithResourceModel(Adapter)
+ */
+ public void update() {
+ sync(false); // false = update
+ }
+
+ /**
+ * The specified <code>sync</code> flag controls whether any surviving
+ * context nodes are either <em>synchronized</em> (<code>true</code>) or
+ * <em>updated</em> (<code>false</code>).
+ */
+ protected void sync(boolean sync) {
+ HashSet<C> contextElements = CollectionTools.set(this.getContextElements());
+ ArrayList<C> contextElementsToSync = new ArrayList<C>(contextElements.size());
+ int resourceIndex = 0;
+
+ for (R resourceElement : this.getResourceElements()) {
+ boolean match = false;
+ for (Iterator<C> stream = contextElements.iterator(); stream.hasNext(); ) {
+ C contextElement = stream.next();
+ if (Tools.valuesAreEqual(this.getResourceElement(contextElement), resourceElement)) {
+ // we don't know the source index because the element has been moved by previously moved elements
+ this.moveContextElement(resourceIndex, contextElement);
+ stream.remove();
+ // TODO perform update here someday...
+ contextElementsToSync.add(contextElement);
+ match = true;
+ break;
+ }
+ }
+ if ( ! match) {
+ // added elements are sync'ed during construction or will be
+ // updated during the next "update" (which is triggered by
+ // their addition to the model)
+ this.addContextElement(resourceIndex, resourceElement);
+ }
+ resourceIndex++;
+ }
+ // remove any leftover context elements
+ for (C contextElement : contextElements) {
+ removeContextElement(contextElement);
+ }
+ // TODO bjv
+ // take care of the structural changes before sync'ing the remaining elements;
+ // we might be able to do this inline once we get rid of the "list change" events
+ // and go with only add, remove, etc. list events
+ // (these syncs will trigger "list change" events with list aspect adapters, which
+ // trigger refreshes of UI adapters (e.g. TableModelAdapter) which will prematurely
+ // discover any structural changes... :( )
+ // see ItemAspectListValueModelAdapter.itemAspectChanged(EventObject)
+ for (C contextElement : contextElementsToSync) {
+ if (sync) {
+ contextElement.synchronizeWithResourceModel();
+ } else {
+ contextElement.update();
+ }
+ }
+ }
+ }
+
+ /**
+ * Adapter used to synchronize a context list container with its corresponding
+ * resource container.
+ * @param <C> the type of context elements
+ * @param <R> the type of resource elements
+ */
+ protected abstract class ListContainer<C, R>
+ extends CollectionContainer<C, R> {
+
+ protected ListContainer() {
+ super();
+ }
+
+ @Override
+ public ListIterable<C> getContextElements() {
+ return new LiveCloneListIterable<C>(this.contextElements);
+ }
+
+ @Override
+ protected abstract ListIterable<R> getResourceElements();
+
+ /**
+ * Return the index of the specified context element.
+ */
+ public int indexOfContextElement(C contextElement) {
+ return this.contextElements.indexOf(contextElement);
+ }
+
+ public C getContextElement(int index) {
+ return this.contextElements.elementAt(index);
+ }
+
+ /**
+ * Add a context element for the specified resource element at the
+ * specified index.
+ */
+ @Override
+ protected C addContextElement_(int index, C contextElement) {
+ AbstractJpaNode.this.addItemToList(index, contextElement, this.contextElements, this.getContextElementsPropertyName());
+ return contextElement;
+ }
+
+ /**
+ * Move the context element at the specified target index to the
+ * specified source index.
+ */
+ public void moveContextElement(int targetIndex, int sourceIndex) {
+ this.moveContextElement(targetIndex, this.contextElements.get(sourceIndex));
+ }
+
+ /**
+ * Move the specified context element to the specified index.
+ */
+ @Override
+ public void moveContextElement(int index, C element) {
+ AbstractJpaNode.this.moveItemInList(index, element, this.contextElements, this.getContextElementsPropertyName());
+ }
+
+ /**
+ * Remove the context element at the specified index from the container.
+ */
+ public void removeContextElement(int index) {
+ AbstractJpaNode.this.removeItemFromList(index, this.contextElements, this.getContextElementsPropertyName());
+ }
+
+ public void synchronizeWithResourceModel() {
+ ListIterable<R> resourceElements = getResourceElements();
+
+ int index = 0;
+ for (R resourceElement : resourceElements) {
+ if (this.getContextElementsSize() > index) {
+ if (this.getContextElement(index) != resourceElement) {
+ this.addContextElement(index, resourceElement);
+ }
+ }
+ else {
+ this.addContextElement(index, resourceElement);
+ }
+ index++;
+ }
+
+ for ( ; index < this.getContextElementsSize(); ) {
+ this.removeContextElement(index);
+ }
+ }
+ }
+
+ /**
+ * Adapter used to synchronize a context list container with its corresponding
+ * resource container.
+ * @param <C> the type of context elements
+ * @param <R> the type of resource elements
+ */
+ protected abstract class ContextListContainer<C extends JpaContextNode, R>
+ extends ContextCollectionContainer<C, R> {
+
+ protected ContextListContainer() {
+ super();
+ }
+
+ @Override
+ public ListIterable<C> getContextElements() {
+ return new LiveCloneListIterable<C>(this.contextElements);
+ }
+
+ @Override
+ protected abstract ListIterable<R> getResourceElements();
+
+ /**
+ * Return the index of the specified context element.
+ */
+ public int indexOfContextElement(C contextElement) {
+ return this.contextElements.indexOf(contextElement);
+ }
+
+ public C getContextElement(int index) {
+ return this.contextElements.elementAt(index);
+ }
+
+ /**
+ * Add a context element for the specified resource element at the
+ * specified index.
+ */
+ @Override
+ protected C addContextElement_(int index, C contextElement) {
+ AbstractJpaNode.this.addItemToList(index, contextElement, this.contextElements, this.getContextElementsPropertyName());
+ return contextElement;
+ }
+
+ /**
+ * Move the context element at the specified target index to the
+ * specified source index.
+ */
+ public void moveContextElement(int targetIndex, int sourceIndex) {
+ this.moveContextElement(targetIndex, this.contextElements.get(sourceIndex));
+ }
+
+ /**
+ * clear the list of context elements
+ */
+ public void clearContextList() {
+ AbstractJpaNode.this.clearList(this.contextElements, getContextElementsPropertyName());
+ }
+
+ /**
+ * Move the specified context element to the specified index.
+ */
+ @Override
+ public void moveContextElement(int index, C element) {
+ AbstractJpaNode.this.moveItemInList(index, element, this.contextElements, this.getContextElementsPropertyName());
+ }
+
+ /**
+ * Remove the context element at the specified index from the container.
+ */
+ public C removeContextElement(int index) {
+ return AbstractJpaNode.this.removeItemFromList(index, this.contextElements, this.getContextElementsPropertyName());
+ }
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
index 827e4f921e..80cc559c31 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.internal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -41,11 +40,20 @@ import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceModel;
import org.eclipse.jpt.common.core.JptResourceModelListener;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryTypeCache;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceTypeCompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.ResourceLocator;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageInfoCompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceTypeCache;
import org.eclipse.jpt.common.utility.Command;
import org.eclipse.jpt.common.utility.CommandExecutor;
import org.eclipse.jpt.common.utility.Filter;
@@ -59,7 +67,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.common.utility.internal.synchronizers.CallbackSynchronousSynchronizer;
import org.eclipse.jpt.common.utility.internal.synchronizers.SynchronousSynchronizer;
@@ -72,21 +79,12 @@ import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPersistentTypeCache;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTypeCompilationUnit;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageInfoCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentTypeCache;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
@@ -146,9 +144,9 @@ public abstract class AbstractJpaProject
protected final Vector<JavaResourceCompilationUnit> externalJavaResourceCompilationUnits = new Vector<JavaResourceCompilationUnit>();
/**
- * The "external" Java resource persistent types (binary). Populated upon demand.
+ * The "external" Java resource types (binary). Populated upon demand.
*/
- protected final JavaResourcePersistentTypeCache externalJavaResourcePersistentTypeCache;
+ protected final JavaResourceTypeCache externalJavaResourceTypeCache;
/**
* Resource models notify this listener when they change. A project update
@@ -251,7 +249,7 @@ public abstract class AbstractJpaProject
InitialResourceProxyVisitor visitor = this.buildInitialResourceProxyVisitor();
visitor.visitProject(this.project);
- this.externalJavaResourcePersistentTypeCache = this.buildExternalJavaResourcePersistentTypeCache();
+ this.externalJavaResourceTypeCache = this.buildExternalJavaResourceTypeCache();
if (this.isJpa2_0Compatible()) {
this.metamodelSourceFolderName = ((JpaProject2_0.Config) config).getMetamodelSourceFolderName();
@@ -271,7 +269,7 @@ public abstract class AbstractJpaProject
// start listening to this cache once the context model has been built
// and all the external types are faulted in
- this.externalJavaResourcePersistentTypeCache.addResourceModelListener(this.resourceModelListener);
+ this.externalJavaResourceTypeCache.addResourceModelListener(this.resourceModelListener);
}
@Override
@@ -284,8 +282,8 @@ public abstract class AbstractJpaProject
return this.project;
}
- protected JavaResourcePersistentTypeCache buildExternalJavaResourcePersistentTypeCache() {
- return new BinaryPersistentTypeCache(this.jpaPlatform.getAnnotationProvider());
+ protected JavaResourceTypeCache buildExternalJavaResourceTypeCache() {
+ return new BinaryTypeCache(this.jpaPlatform.getAnnotationProvider());
}
protected JpaRootContextNode buildRootContextNode() {
@@ -624,11 +622,11 @@ public abstract class AbstractJpaProject
}
- // ********** external Java resource persistent types (source or binary) **********
+ // ********** external Java resource types (source or binary) **********
- protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(String typeName) {
+ protected JavaResourceAbstractType buildExternalJavaResourceType(String typeName) {
IType jdtType = this.findType(typeName);
- return (jdtType == null) ? null : this.buildPersistableExternalJavaResourcePersistentType(jdtType);
+ return (jdtType == null) ? null : this.buildExternalJavaResourceType(jdtType);
}
protected IType findType(String typeName) {
@@ -639,28 +637,22 @@ public abstract class AbstractJpaProject
}
}
- protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(IType jdtType) {
- JavaResourcePersistentType jrpt = this.buildExternalJavaResourcePersistentType(jdtType);
- return ((jrpt != null) && jrpt.isPersistable()) ? jrpt : null;
- }
-
- protected JavaResourcePersistentType buildExternalJavaResourcePersistentType(IType jdtType) {
+ protected JavaResourceAbstractType buildExternalJavaResourceType(IType jdtType) {
return jdtType.isBinary() ?
- this.buildBinaryExternalJavaResourcePersistentType(jdtType) :
- this.buildSourceExternalJavaResourcePersistentType(jdtType);
+ this.buildBinaryExternalJavaResourceType(jdtType) :
+ this.buildSourceExternalJavaResourceType(jdtType);
}
- protected JavaResourcePersistentType buildBinaryExternalJavaResourcePersistentType(IType jdtType) {
- return this.externalJavaResourcePersistentTypeCache.addPersistentType(jdtType);
+ protected JavaResourceAbstractType buildBinaryExternalJavaResourceType(IType jdtType) {
+ return this.externalJavaResourceTypeCache.addType(jdtType);
}
- protected JavaResourcePersistentType buildSourceExternalJavaResourcePersistentType(IType jdtType) {
+ protected JavaResourceAbstractType buildSourceExternalJavaResourceType(IType jdtType) {
JavaResourceCompilationUnit jrcu = this.getExternalJavaResourceCompilationUnit(jdtType.getCompilationUnit());
String jdtTypeName = jdtType.getFullyQualifiedName('.'); // JDT member type names use '$'
- for (Iterator<JavaResourcePersistentType> stream = jrcu.persistentTypes(); stream.hasNext(); ) {
- JavaResourcePersistentType jrpt = stream.next();
- if (jrpt.getQualifiedName().equals(jdtTypeName)) {
- return jrpt;
+ for (JavaResourceAbstractType jrat : jrcu.getTypes()) {
+ if (jrat.getQualifiedName().equals(jdtTypeName)) {
+ return jrat;
}
}
// we can get here if the project JRE is removed;
@@ -672,8 +664,8 @@ public abstract class AbstractJpaProject
// ********** external Java resource persistent types (binary) **********
- public JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache() {
- return this.externalJavaResourcePersistentTypeCache;
+ public JavaResourceTypeCache getExternalJavaResourceTypeCache() {
+ return this.externalJavaResourceTypeCache;
}
@@ -791,10 +783,10 @@ public abstract class AbstractJpaProject
// ********** annotated Java source classes **********
public Iterable<String> getAnnotatedJavaSourceClassNames() {
- return new TransformationIterable<JavaResourcePersistentType, String>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
+ return new TransformationIterable<JavaResourceAbstractType, String>(this.getInternalAnnotatedSourceJavaResourceTypes()) {
@Override
- protected String transform(JavaResourcePersistentType jrpType) {
- return jrpType.getQualifiedName();
+ protected String transform(JavaResourceAbstractType jraType) {
+ return jraType.getQualifiedName();
}
};
}
@@ -805,11 +797,11 @@ public abstract class AbstractJpaProject
* <code>persistence.xml</code>.
* @see org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools.TypeAdapter)
*/
- protected Iterable<JavaResourcePersistentType> getInternalAnnotatedSourceJavaResourcePersistentTypes() {
- return new FilteringIterable<JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) {
+ protected Iterable<JavaResourceAbstractType> getInternalAnnotatedSourceJavaResourceTypes() {
+ return new FilteringIterable<JavaResourceAbstractType>(this.getInternalSourceJavaResourceTypes()) {
@Override
- protected boolean accept(JavaResourcePersistentType jrpType) {
- return jrpType.isPersistable() && jrpType.isAnnotated(); // i.e. the type is valid and has a valid type annotation
+ protected boolean accept(JavaResourceAbstractType jraType) {
+ return jraType.isAnnotated(); // i.e. the type has a valid type annotation
}
};
}
@@ -821,10 +813,10 @@ public abstract class AbstractJpaProject
* those in JARs referenced in <code>persistence.xml</code>.
*/
public Iterable<String> getMappedJavaSourceClassNames() {
- return new TransformationIterable<JavaResourcePersistentType, String>(this.getInternalMappedSourceJavaResourcePersistentTypes()) {
+ return new TransformationIterable<JavaResourceAbstractType, String>(this.getInternalMappedSourceJavaResourceTypes()) {
@Override
- protected String transform(JavaResourcePersistentType jrpType) {
- return jrpType.getQualifiedName();
+ protected String transform(JavaResourceAbstractType jraType) {
+ return jraType.getQualifiedName();
}
};
}
@@ -835,22 +827,22 @@ public abstract class AbstractJpaProject
* persistent types that are directly part of the JPA project, ignoring
* those in JARs referenced in <code>persistence.xml</code>.
*/
- protected Iterable<JavaResourcePersistentType> getInternalMappedSourceJavaResourcePersistentTypes() {
- return new FilteringIterable<JavaResourcePersistentType>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
+ protected Iterable<JavaResourceAbstractType> getInternalMappedSourceJavaResourceTypes() {
+ return new FilteringIterable<JavaResourceAbstractType>(this.getInternalAnnotatedSourceJavaResourceTypes()) {
@Override
- protected boolean accept(JavaResourcePersistentType jrpType) {
- return jrpType.isMapped(); // i.e. the type is already persistable and annotated
+ protected boolean accept(JavaResourceAbstractType jraType) {
+ return jraType.isAnnotatedWith(getTypeMappingAnnotations());
}
};
}
- /**
- * Return only those Java resource persistent types that are directly
- * part of the JPA project, ignoring those in JARs referenced in
- * <code>persistence.xml</code>
- */
- protected Iterable<JavaResourcePersistentType2_0> getInternalSourceJavaResourcePersistentTypes2_0() {
- return new SubIterableWrapper<JavaResourcePersistentType, JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes());
+ public Iterable<String> getTypeMappingAnnotations() {
+ return new TransformationIterable<JavaTypeMappingDefinition, String>(getJpaPlatform().getJavaTypeMappingDefinitions()) {
+ @Override
+ protected String transform(JavaTypeMappingDefinition o) {
+ return o.getAnnotationName();
+ }
+ };
}
/**
@@ -858,8 +850,8 @@ public abstract class AbstractJpaProject
* part of the JPA project, ignoring those in JARs referenced in
* <code>persistence.xml</code>
*/
- protected Iterable<JavaResourcePersistentType> getInternalSourceJavaResourcePersistentTypes() {
- return new CompositeIterable<JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypeLists());
+ protected Iterable<JavaResourceAbstractType> getInternalSourceJavaResourceTypes() {
+ return new CompositeIterable<JavaResourceAbstractType>(this.getInternalSourceJavaResourceTypeLists());
}
/**
@@ -867,15 +859,11 @@ public abstract class AbstractJpaProject
* part of the JPA project, ignoring those in JARs referenced in
* <code>persistence.xml</code>
*/
- protected Iterable<Iterable<JavaResourcePersistentType>> getInternalSourceJavaResourcePersistentTypeLists() {
- return new TransformationIterable<JavaResourceCompilationUnit, Iterable<JavaResourcePersistentType>>(this.getInternalJavaResourceCompilationUnits()) {
+ protected Iterable<Iterable<JavaResourceAbstractType>> getInternalSourceJavaResourceTypeLists() {
+ return new TransformationIterable<JavaResourceCompilationUnit, Iterable<JavaResourceAbstractType>>(this.getInternalJavaResourceCompilationUnits()) {
@Override
- protected Iterable<JavaResourcePersistentType> transform(final JavaResourceCompilationUnit compilationUnit) {
- return new Iterable<JavaResourcePersistentType>() {
- public Iterator<JavaResourcePersistentType> iterator() {
- return compilationUnit.persistentTypes(); // *all* the types in the compilation unit
- }
- };
+ protected Iterable<JavaResourceAbstractType> transform(final JavaResourceCompilationUnit compilationUnit) {
+ return compilationUnit.getTypes(); // *all* the types in the compilation unit
}
};
}
@@ -902,51 +890,42 @@ public abstract class AbstractJpaProject
// ********** Java resource persistent type look-up **********
- public JavaResourcePersistentType getJavaResourcePersistentType(String typeName) {
- for (JavaResourcePersistentType jrpType : this.getPersistableJavaResourcePersistentTypes()) {
- if (jrpType.getQualifiedName().equals(typeName)) {
- return jrpType;
+ public JavaResourceAbstractType getJavaResourceType(String typeName) {
+ for (JavaResourceAbstractType jraType : this.getJavaResourceTypes()) {
+ if (jraType.getQualifiedName().equals(typeName)) {
+ return jraType;
}
}
// if we don't have a type already, try to build new one from the project classpath
- return this.buildPersistableExternalJavaResourcePersistentType(typeName);
+ return this.buildExternalJavaResourceType(typeName);
}
- /**
- * return *all* the "persistable" Java resource persistent types, including those in JARs referenced in
- * persistence.xml
- * @see org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools.TypeAdapter)
- */
- protected Iterable<JavaResourcePersistentType> getPersistableJavaResourcePersistentTypes() {
- return new FilteringIterable<JavaResourcePersistentType>(this.getJavaResourcePersistentTypes()) {
- @Override
- protected boolean accept(JavaResourcePersistentType jrpType) {
- return jrpType.isPersistable();
- }
- };
+ public JavaResourceAbstractType getJavaResourceType(String typeName, JavaResourceAbstractType.Kind kind) {
+ JavaResourceAbstractType resourceType = getJavaResourceType(typeName);
+ if (resourceType == null || resourceType.getKind() != kind) {
+ return null;
+ }
+ return resourceType;
}
+
/**
* return *all* the Java resource persistent types, including those in JARs referenced in
* persistence.xml
*/
- protected Iterable<JavaResourcePersistentType> getJavaResourcePersistentTypes() {
- return new CompositeIterable<JavaResourcePersistentType>(this.getJavaResourcePersistentTypeSets());
+ protected Iterable<JavaResourceAbstractType> getJavaResourceTypes() {
+ return new CompositeIterable<JavaResourceAbstractType>(this.getJavaResourceTypeSets());
}
/**
* return *all* the Java resource persistent types, including those in JARs referenced in
* persistence.xml
*/
- protected Iterable<Iterable<JavaResourcePersistentType>> getJavaResourcePersistentTypeSets() {
- return new TransformationIterable<JavaResourceNode.Root, Iterable<JavaResourcePersistentType>>(this.getJavaResourceNodeRoots()) {
+ protected Iterable<Iterable<JavaResourceAbstractType>> getJavaResourceTypeSets() {
+ return new TransformationIterable<JavaResourceNode.Root, Iterable<JavaResourceAbstractType>>(this.getJavaResourceNodeRoots()) {
@Override
- protected Iterable<JavaResourcePersistentType> transform(final JavaResourceNode.Root root) {
- return new Iterable<JavaResourcePersistentType>() {
- public Iterator<JavaResourcePersistentType> iterator() {
- return root.persistentTypes(); // *all* the types held by the root
- }
- };
+ protected Iterable<JavaResourceAbstractType> transform(final JavaResourceNode.Root root) {
+ return root.getTypes(); // *all* the types held by the root
}
};
}
@@ -957,7 +936,7 @@ public abstract class AbstractJpaProject
this.getInternalJavaResourceCompilationUnits(),
this.getInternalJavaResourcePackageFragmentRoots(),
this.getExternalJavaResourceCompilationUnits(),
- Collections.singleton(this.externalJavaResourcePersistentTypeCache)
+ Collections.singleton(this.externalJavaResourceTypeCache)
);
}
@@ -1033,31 +1012,29 @@ public abstract class AbstractJpaProject
// ********** metamodel **********
- public Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTopLevelTypes() {
+ public Iterable<JavaResourceAbstractType> getGeneratedMetamodelTopLevelTypes() {
if (this.metamodelSourceFolderName == null) {
return EmptyIterable.instance();
}
final IPackageFragmentRoot genSourceFolder = this.getMetamodelPackageFragmentRoot();
- return new FilteringIterable<JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes2_0()) {
+ return new FilteringIterable<JavaResourceAbstractType>(this.getInternalSourceJavaResourceTypes()) {
@Override
- protected boolean accept(JavaResourcePersistentType2_0 jrpt) {
- return jrpt.isGeneratedMetamodelTopLevelType(genSourceFolder);
+ protected boolean accept(JavaResourceAbstractType jrat) {
+ return MetamodelTools.isGeneratedMetamodelTopLevelType(jrat, genSourceFolder);
}
};
}
- public JavaResourcePersistentType2_0 getGeneratedMetamodelTopLevelType(IFile file) {
+ public JavaResourceAbstractType getGeneratedMetamodelTopLevelType(IFile file) {
JavaResourceCompilationUnit jrcu = this.getJavaResourceCompilationUnit(file);
if (jrcu == null) {
return null; // hmmm...
}
- // TODO add API to JRCU to get top-level persistent type
- Iterator<JavaResourcePersistentType> types = jrcu.persistentTypes();
- if ( ! types.hasNext()) {
+ JavaResourceAbstractType primaryType = jrcu.getPrimaryType();
+ if (primaryType == null) {
return null; // no types in the file
}
- JavaResourcePersistentType2_0 jrpt = (JavaResourcePersistentType2_0) types.next();
- return jrpt.isGeneratedMetamodelTopLevelType() ? jrpt : null;
+ return MetamodelTools.isGeneratedMetamodelTopLevelType(primaryType) ? primaryType : null;
}
protected JavaResourceCompilationUnit getJavaResourceCompilationUnit(IFile file) {
@@ -1688,7 +1665,7 @@ public abstract class AbstractJpaProject
return this.removeExternalJavaResourceCompilationUnit(file);
}
if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return this.externalJavaResourcePersistentTypeCache.removePersistentTypes(file);
+ return this.externalJavaResourceTypeCache.removeTypes(file);
}
return false;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java
index f86051c5cf..e1193d854a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,8 @@
package org.eclipse.jpt.jpa.core.internal;
import java.util.ArrayList;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverrideAnnotationDefinition;
@@ -54,7 +56,6 @@ import org.eclipse.jpt.jpa.core.internal.resource.java.TableGeneratorAnnotationD
import org.eclipse.jpt.jpa.core.internal.resource.java.TemporalAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.TransientAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.VersionAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
public class GenericJpaAnnotationDefinitionProvider
extends AbstractJpaAnnotationDefinitionProvider
@@ -78,76 +79,42 @@ public class GenericJpaAnnotationDefinitionProvider
}
@Override
- protected void addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, TYPE_ANNOTATION_DEFINITIONS);
+ protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS);
}
- protected static final AnnotationDefinition[] TYPE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
- AssociationOverrideAnnotationDefinition.instance(),
+ protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
AssociationOverridesAnnotationDefinition.instance(),
- AttributeOverrideAnnotationDefinition.instance(),
AttributeOverridesAnnotationDefinition.instance(),
+ BasicAnnotationDefinition.instance(),
+ ColumnAnnotationDefinition.instance(),
DiscriminatorColumnAnnotationDefinition.instance(),
DiscriminatorValueAnnotationDefinition.instance(),
EmbeddableAnnotationDefinition.instance(),
- EntityAnnotationDefinition.instance(),
- IdClassAnnotationDefinition.instance(),
- InheritanceAnnotationDefinition.instance(),
- MappedSuperclassAnnotationDefinition.instance(),
- NamedQueryAnnotationDefinition.instance(),
- NamedQueriesAnnotationDefinition.instance(),
- NamedNativeQueryAnnotationDefinition.instance(),
- NamedNativeQueriesAnnotationDefinition.instance(),
- PrimaryKeyJoinColumnAnnotationDefinition.instance(),
- PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
- SecondaryTableAnnotationDefinition.instance(),
- SecondaryTablesAnnotationDefinition.instance(),
- SequenceGeneratorAnnotationDefinition.instance(),
- TableAnnotationDefinition.instance(),
- TableGeneratorAnnotationDefinition.instance()
- };
-
- @Override
- protected void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, TYPE_MAPPING_ANNOTATION_DEFINITIONS);
- }
-
- protected static final AnnotationDefinition[] TYPE_MAPPING_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
- EmbeddableAnnotationDefinition.instance(),
- EntityAnnotationDefinition.instance(),
- MappedSuperclassAnnotationDefinition.instance()
- };
-
- @Override
- protected void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, ATTRIBUTE_ANNOTATION_DEFINITIONS);
- }
-
- protected static final AnnotationDefinition[] ATTRIBUTE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
- AssociationOverrideAnnotationDefinition.instance(),
- AssociationOverridesAnnotationDefinition.instance(),
- AttributeOverrideAnnotationDefinition.instance(),
- AttributeOverridesAnnotationDefinition.instance(),
- BasicAnnotationDefinition.instance(),
- ColumnAnnotationDefinition.instance(),
EmbeddedAnnotationDefinition.instance(),
EmbeddedIdAnnotationDefinition.instance(),
+ EntityAnnotationDefinition.instance(),
EnumeratedAnnotationDefinition.instance(),
GeneratedValueAnnotationDefinition.instance(),
IdAnnotationDefinition.instance(),
- JoinColumnAnnotationDefinition.instance(),
+ IdClassAnnotationDefinition.instance(),
+ InheritanceAnnotationDefinition.instance(),
JoinColumnsAnnotationDefinition.instance(),
JoinTableAnnotationDefinition.instance(),
LobAnnotationDefinition.instance(),
ManyToManyAnnotationDefinition.instance(),
ManyToOneAnnotationDefinition.instance(),
MapKeyAnnotationDefinition.instance(),
+ MappedSuperclassAnnotationDefinition.instance(),
+ NamedQueriesAnnotationDefinition.instance(),
+ NamedNativeQueriesAnnotationDefinition.instance(),
OneToManyAnnotationDefinition.instance(),
OneToOneAnnotationDefinition.instance(),
OrderByAnnotationDefinition.instance(),
- PrimaryKeyJoinColumnAnnotationDefinition.instance(),
PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
+ SecondaryTablesAnnotationDefinition.instance(),
SequenceGeneratorAnnotationDefinition.instance(),
+ TableAnnotationDefinition.instance(),
TableGeneratorAnnotationDefinition.instance(),
TemporalAnnotationDefinition.instance(),
TransientAnnotationDefinition.instance(),
@@ -155,7 +122,18 @@ public class GenericJpaAnnotationDefinitionProvider
};
@Override
- protected void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- // no package annotations
+ protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS);
}
+
+ protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] {
+ AssociationOverrideAnnotationDefinition.instance(),
+ AttributeOverrideAnnotationDefinition.instance(),
+ JoinColumnAnnotationDefinition.instance(),
+ NamedQueryAnnotationDefinition.instance(),
+ NamedNativeQueryAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnAnnotationDefinition.instance(),
+ SecondaryTableAnnotationDefinition.instance(),
+ };
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java
deleted file mode 100644
index 62a7cfe743..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * Delegate to annotation definition providers.
- * The platform factory will build an instance of this annotation provider,
- * passing in the appropriate array of annotation definition providers necessary
- * to build the annotations for the platform (vendor and/or version).
- */
-public class GenericJpaAnnotationProvider
- implements JpaAnnotationProvider
-{
- private final Iterable<JpaAnnotationDefinitionProvider> annotationDefinitionProviders;
-
-
- public GenericJpaAnnotationProvider(JpaAnnotationDefinitionProvider... annotationDefinitionProviders) {
- super();
- this.annotationDefinitionProviders = new ArrayIterable<JpaAnnotationDefinitionProvider>(annotationDefinitionProviders);
- }
-
-
- // ********** type annotations **********
-
- public Iterator<String> typeAnnotationNames() {
- return this.convertToNames(this.getTypeAnnotationDefinitions()).iterator();
- }
-
- protected Iterable<AnnotationDefinition> getTypeAnnotationDefinitions() {
- return new CompositeIterable<AnnotationDefinition> (
- new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
- @Override
- protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.getTypeAnnotationDefinitions();
- }
- }
- );
- }
-
- public Iterator<String> typeMappingAnnotationNames() {
- return this.convertToNames(this.getTypeMappingAnnotationDefinitions()).iterator();
- }
-
- protected Iterable<AnnotationDefinition> getTypeMappingAnnotationDefinitions() {
- return new CompositeIterable<AnnotationDefinition> (
- new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
- @Override
- protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.getTypeMappingAnnotationDefinitions();
- }
- }
- );
- }
-
- public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, Type type, String annotationName) {
- return this.getTypeAnnotationDefinition(annotationName).buildAnnotation(parent, type);
- }
-
- public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- return this.getTypeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
- }
-
- protected AnnotationDefinition getTypeAnnotationDefinition(String annotationName) {
- AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getTypeAnnotationDefinitions(), annotationName);
- if (annotationDefinition == null) {
- throw new IllegalArgumentException("unsupported type annotation: " + annotationName); //$NON-NLS-1$
- }
- return annotationDefinition;
- }
-
- public Annotation buildNullTypeAnnotation(JavaResourcePersistentType parent, String annotationName) {
- return this.getTypeAnnotationDefinition(annotationName).buildNullAnnotation(parent);
- }
-
-
- // ********** attribute annotations **********
-
- public Iterator<String> attributeAnnotationNames() {
- return this.convertToNames(this.getAttributeAnnotationDefinitions()).iterator();
- }
-
- protected Iterable<AnnotationDefinition> getAttributeAnnotationDefinitions() {
- return new CompositeIterable<AnnotationDefinition> (
- new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
- @Override
- protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.getAttributeAnnotationDefinitions();
- }
- }
- );
- }
-
- public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) {
- return this.getAttributeAnnotationDefinition(annotationName).buildAnnotation(parent, attribute);
- }
-
- public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- return this.getAttributeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
- }
-
- public Annotation buildNullAttributeAnnotation(JavaResourcePersistentAttribute parent, String annotationName) {
- return this.getAttributeAnnotationDefinition(annotationName).buildNullAnnotation(parent);
- }
-
- protected AnnotationDefinition getAttributeAnnotationDefinition(String annotationName) {
- AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getAttributeAnnotationDefinitions(), annotationName);
- if (annotationDefinition == null) {
- throw new IllegalArgumentException("unsupported attribute annotation: " + annotationName); //$NON-NLS-1$
- }
- return annotationDefinition;
- }
-
-
- // ********** package annotations **********
-
- public Iterator<String> packageAnnotationNames() {
- return this.convertToNames(this.getPackageAnnotationDefinitions()).iterator();
- }
-
- protected Iterable<AnnotationDefinition> getPackageAnnotationDefinitions() {
- return new CompositeIterable<AnnotationDefinition> (
- new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
- @Override
- protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.getPackageAnnotationDefinitions();
- }
- }
- );
- }
-
- public Annotation buildPackageAnnotation(JavaResourcePackage parent, AnnotatedPackage pkg, String annotationName) {
- return this.getPackageAnnotationDefinition(annotationName).buildAnnotation(parent, pkg);
- }
-
- public Annotation buildPackageAnnotation(JavaResourcePackage parent, IAnnotation jdtAnnotation) {
- return this.getPackageAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
- }
-
- public Annotation buildNullPackageAnnotation(JavaResourcePackage parent, String annotationName) {
- return this.getPackageAnnotationDefinition(annotationName).buildNullAnnotation(parent);
- }
-
- protected AnnotationDefinition getPackageAnnotationDefinition(String annotationName) {
- AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getPackageAnnotationDefinitions(), annotationName);
- if (annotationDefinition == null) {
- throw new IllegalArgumentException("unsupported package annotation: " + annotationName); //$NON-NLS-1$
- }
- return annotationDefinition;
- }
-
-
- // ********** convenience methods **********
-
- protected Iterable<String> convertToNames(Iterable<AnnotationDefinition> annotationDefinitions) {
- return new TransformationIterable<AnnotationDefinition, String>(annotationDefinitions) {
- @Override
- protected String transform(AnnotationDefinition annotationDefinition) {
- return annotationDefinition.getAnnotationName();
- }
- };
- }
-
- protected AnnotationDefinition selectAnnotationDefinition(Iterable<AnnotationDefinition> annotationDefinitions, String annotationName) {
- for (AnnotationDefinition annotationDefinition : annotationDefinitions) {
- if (annotationDefinition.getAnnotationName().equals(annotationName)) {
- return annotationDefinition;
- }
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
index c8e5bf9efd..405d0914aa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,13 +11,13 @@ package org.eclipse.jpt.jpa.core.internal;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceModel;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.DefaultAnnotationEditFormatter;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaPlatform;
@@ -47,19 +47,19 @@ public class GenericJpaPlatform
private final JpaFactory jpaFactory;
- private final JpaAnnotationProvider annotationProvider;
+ private final AnnotationProvider annotationProvider;
private final JpaPlatformProvider platformProvider;
private final JpaPlatformVariation jpaVariation;
- public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, JpaAnnotationProvider jpaAnnotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation) {
+ public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, AnnotationProvider annotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation) {
super();
this.id = id;
this.jpaVersion = jpaVersion;
this.jpaFactory = jpaFactory;
- this.annotationProvider = jpaAnnotationProvider;
+ this.annotationProvider = annotationProvider;
this.jpaVariation = jpaVariation;
this.platformProvider = platformProvider;
}
@@ -127,7 +127,7 @@ public class GenericJpaPlatform
// ********** Java annotations **********
- public JpaAnnotationProvider getAnnotationProvider() {
+ public AnnotationProvider getAnnotationProvider() {
return this.annotationProvider;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
index be8f3e7f80..c3cacc7ae6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -36,7 +36,7 @@ public class GenericJpaPlatformFactory
id,
this.buildJpaVersion(),
new GenericJpaFactory(),
- new GenericJpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
+ new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
GenericJpaPlatformProvider.instance(),
this.buildJpaPlatformVariation());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
index 0299725cf2..c7c8b0e4b3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,11 +13,11 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.core.JptResourceModel;
import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryPackageFragmentRoot;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPackageFragmentRoot;
/**
* JAR files
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
index 4cde45e05f..ed5673c996 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,10 +13,10 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourcePackageInfoCompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePackageInfoCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
/**
* Java package-info.java source code
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
index bd0623255c..d248f7680e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,10 +13,10 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceTypeCompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTypeCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
/**
* Java source code
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaAnnotationProvider.java
new file mode 100644
index 0000000000..2bcbb2c023
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaAnnotationProvider.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.AnnotationProvider;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
+
+/**
+ * Delegate to annotation definition providers.
+ * The platform factory will build an instance of this annotation provider,
+ * passing in the appropriate array of annotation definition providers necessary
+ * to build the annotations for the platform (vendor and/or version).
+ */
+public class JpaAnnotationProvider
+ implements AnnotationProvider
+{
+ private final Iterable<JpaAnnotationDefinitionProvider> annotationDefinitionProviders;
+
+
+ public JpaAnnotationProvider(JpaAnnotationDefinitionProvider... annotationDefinitionProviders) {
+ super();
+ this.annotationDefinitionProviders = new ArrayIterable<JpaAnnotationDefinitionProvider>(annotationDefinitionProviders);
+ }
+
+
+ // ********** type annotations **********
+
+
+ public Iterable<String> getAnnotationNames() {
+ return new TransformationIterable<AnnotationDefinition, String>(getAnnotationDefinitions()) {
+ @Override
+ protected String transform(AnnotationDefinition annotationDefinition) {
+ return annotationDefinition.getAnnotationName();
+ }
+ };
+ }
+
+ public Iterable<String> getContainerAnnotationNames() {
+ return new TransformationIterable<NestableAnnotationDefinition, String>(getNestableAnnotationDefinitions()) {
+ @Override
+ protected String transform(NestableAnnotationDefinition annotationDefinition) {
+ return annotationDefinition.getContainerAnnotationName();
+ }
+ };
+ }
+
+ public Iterable<String> getNestableAnnotationNames() {
+ return new TransformationIterable<NestableAnnotationDefinition, String>(getNestableAnnotationDefinitions()) {
+ @Override
+ protected String transform(NestableAnnotationDefinition annotationDefinition) {
+ return annotationDefinition.getNestableAnnotationName();
+ }
+ };
+ }
+
+ protected Iterable<AnnotationDefinition> getAnnotationDefinitions() {
+ return new CompositeIterable<AnnotationDefinition> (
+ new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
+ @Override
+ protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ return annotationDefinitionProvider.getAnnotationDefinitions();
+ }
+ }
+ );
+ }
+
+ protected Iterable<NestableAnnotationDefinition> getNestableAnnotationDefinitions() {
+ return new CompositeIterable<NestableAnnotationDefinition> (
+ new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<NestableAnnotationDefinition>>(this.annotationDefinitionProviders) {
+ @Override
+ protected Iterable<NestableAnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ return annotationDefinitionProvider.getNestableAnnotationDefinitions();
+ }
+ }
+ );
+ }
+
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName) {
+ return this.getAnnotationDefinition(annotationName).buildAnnotation(parent, element);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent, String annotationName) {
+ return this.getAnnotationDefinition(annotationName).buildNullAnnotation(parent);
+ }
+
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ return this.getAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
+ }
+
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return this.getNestableAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation, index);
+ }
+
+ protected AnnotationDefinition getAnnotationDefinition(String annotationName) {
+ AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getAnnotationDefinitions(), annotationName);
+ if (annotationDefinition == null) {
+ throw new IllegalArgumentException("unsupported annotation: " + annotationName); //$NON-NLS-1$
+ }
+ return annotationDefinition;
+ }
+
+
+ protected NestableAnnotationDefinition getNestableAnnotationDefinition(String annotationName) {
+ NestableAnnotationDefinition annotationDefinition = this.selectNestableAnnotationDefinition(this.getNestableAnnotationDefinitions(), annotationName);
+ if (annotationDefinition == null) {
+ throw new IllegalArgumentException("unsupported nsetable annotation: " + annotationName); //$NON-NLS-1$
+ }
+ return annotationDefinition;
+ }
+
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName, int index) {
+ return this.getNestableAnnotationDefinition(annotationName).buildAnnotation(parent, element, index);
+ }
+
+ public String getNestableAnnotationName(String containerAnnotationName) {
+ return getNestableAnnotationDefinitionForContainer(containerAnnotationName).getNestableAnnotationName();
+ }
+
+ public String getContainerAnnotationName(String nestableAnnotationName) {
+ return getNestableAnnotationDefinition(nestableAnnotationName).getContainerAnnotationName();
+ }
+
+ public String getNestableElementName(String nestableAnnotationName) {
+ return getNestableAnnotationDefinition(nestableAnnotationName).getElementName();
+ }
+
+ private NestableAnnotationDefinition getNestableAnnotationDefinitionForContainer(String containerAnnotationName) {
+ for (NestableAnnotationDefinition nestableAnnotationDefinition : getNestableAnnotationDefinitions()) {
+ if (nestableAnnotationDefinition.getContainerAnnotationName().equals(containerAnnotationName)) {
+ return nestableAnnotationDefinition;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** convenience methods **********
+
+ protected AnnotationDefinition selectAnnotationDefinition(Iterable<AnnotationDefinition> annotationDefinitions, String annotationName) {
+ for (AnnotationDefinition annotationDefinition : annotationDefinitions) {
+ if (annotationDefinition.getAnnotationName().equals(annotationName)) {
+ return annotationDefinition;
+ }
+ }
+ return null;
+ }
+
+ protected NestableAnnotationDefinition selectNestableAnnotationDefinition(Iterable<NestableAnnotationDefinition> annotationDefinitions, String annotationName) {
+ for (NestableAnnotationDefinition annotationDefinition : annotationDefinitions) {
+ if (annotationDefinition.getNestableAnnotationName().equals(annotationName)) {
+ return annotationDefinition;
+ }
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
index b105998e43..cf7add0a1e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
@@ -140,7 +140,7 @@ public final class MappingTools {
* @see #buildJoinTableDefaultName(ReadOnlyRelationship)
*/
public static String buildJoinColumnDefaultName(ReadOnlyJoinColumn joinColumn, ReadOnlyJoinColumn.Owner owner) {
- if (owner.joinColumnsSize() != 1) {
+ if (owner.getJoinColumnsSize() != 1) {
return null;
}
String prefix = owner.getAttributeName();
@@ -188,7 +188,7 @@ public final class MappingTools {
if (targetEntity == null) {
return null;
}
- for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(targetEntity.getPersistentType().allAttributes())) {
+ for (ReadOnlyPersistentAttribute attribute : targetEntity.getPersistentType().getAllAttributes()) {
if (attribute.getMapping().isOwnedBy(relationshipMapping)) {
return attribute.getName();
}
@@ -204,7 +204,7 @@ public final class MappingTools {
* We are assuming that the primary key column is defined by the mappings instead of the database.
*/
public static String buildJoinColumnDefaultReferencedColumnName(ReadOnlyJoinColumn.Owner joinColumnOwner) {
- if (joinColumnOwner.joinColumnsSize() != 1) {
+ if (joinColumnOwner.getJoinColumnsSize() != 1) {
return null;
}
Entity targetEntity = joinColumnOwner.getRelationshipTarget();
@@ -218,8 +218,7 @@ public final class MappingTools {
if ((attributeName == null) || (persistentType == null)) {
return null;
}
- for (Iterator<ReadOnlyPersistentAttribute> stream = persistentType.allAttributes(); stream.hasNext(); ) {
- ReadOnlyPersistentAttribute persAttribute = stream.next();
+ for (ReadOnlyPersistentAttribute persAttribute : persistentType.getAllAttributes()) {
if (attributeName.equals(persAttribute.getName())) {
if (persAttribute.getMapping() instanceof ColumnMapping) {
return (ColumnMapping) persAttribute.getMapping();
@@ -370,8 +369,7 @@ public final class MappingTools {
public static String getPrimaryKeyColumnName(Entity entity) {
String pkColumnName = null;
- for (Iterator<ReadOnlyPersistentAttribute> stream = entity.getPersistentType().allAttributes(); stream.hasNext(); ) {
- ReadOnlyPersistentAttribute attribute = stream.next();
+ for (ReadOnlyPersistentAttribute attribute : entity.getPersistentType().getAllAttributes()) {
String current = attribute.getPrimaryKeyColumnName();
if (current != null) {
// 229423 - if the attribute is a primary key, but it has an attribute override,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractAccessor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractAccessor.java
new file mode 100644
index 0000000000..6b330606f3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractAccessor.java
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import java.util.HashMap;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNode;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.Accessor;
+
+public abstract class AbstractAccessor
+ extends AbstractJavaJpaContextNode
+ implements Accessor
+{
+
+ protected AbstractAccessor(ReadOnlyPersistentAttribute parent) {
+ super(parent);
+ }
+
+
+ // ********** unannotated Java resource member **********
+
+ /**
+ * Wrap another Java resource member and suppress all its annotations.
+ */
+ protected abstract class UnannotatedJavaResourceMember<M extends JavaResourceMember>
+ extends SourceNode
+ implements JavaResourceMember
+ {
+ protected final M member;
+
+ /**
+ * these are built as needed
+ */
+ protected final HashMap<String, Annotation> nullAnnotationsCache = new HashMap<String, Annotation>();
+
+
+ protected UnannotatedJavaResourceMember(M member) {
+ super(member.getParent());
+ this.member = member;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // NOP
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ // NOP
+ }
+
+
+ // ********** annotations **********
+
+ public Iterable<Annotation> getAnnotations() {
+ return EmptyIterable.instance();
+ }
+
+ public int getAnnotationsSize() {
+ return 0;
+ }
+
+ public Annotation getAnnotation(String annotationName) {
+ return null;
+ }
+
+ public synchronized Annotation getNonNullAnnotation(String annotationName) {
+ Annotation annotation = this.nullAnnotationsCache.get(annotationName);
+ if (annotation == null) {
+ annotation = this.buildNullAnnotation(annotationName);
+ this.nullAnnotationsCache.put(annotationName, annotation);
+ }
+ return annotation;
+ }
+
+ protected abstract Annotation buildNullAnnotation(String annotationName);
+
+ public ListIterable<NestableAnnotation> getAnnotations(String nestableAnnotationName) {
+ return EmptyListIterable.instance();
+ }
+
+ public int getAnnotationsSize(String nestableAnnotationName) {
+ return 0;
+ }
+
+ public NestableAnnotation getAnnotation(int index, String nestableAnnotationName) {
+ return null;
+ }
+
+ public Annotation addAnnotation(String annotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public NestableAnnotation addAnnotation(int index, String nestableAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation(String annotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation(int index, String nestableAnnotationName) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** misc **********
+
+ public boolean isAnnotated() {
+ return false;
+ }
+
+ public boolean isAnnotatedWith(Iterable<String> annotationNames) {
+ return false;
+ }
+
+ public boolean isFinal() {
+ return this.member.isFinal();
+ }
+
+ public boolean isPublic() {
+ return this.member.isPublic();
+ }
+
+ public boolean isStatic() {
+ return this.member.isStatic();
+ }
+
+ public boolean isTransient() {
+ return this.member.isTransient();
+ }
+
+ public boolean isFor(String memberName, int occurrence) {
+ return this.member.isFor(memberName, occurrence);
+ }
+
+ public TextRange getTextRange(CompilationUnit astRoot) {
+ // should never be null
+ return this.member.getTextRange(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ // should never be null
+ return this.member.getNameTextRange(astRoot);
+ }
+
+ public void resolveTypes(CompilationUnit astRoot) {
+ // NOP
+ }
+ }
+
+ // ********** unannotated Java resource attribute **********
+
+ /**
+ * Wrap another Java resource attribute and suppress all its annotations.
+ */
+ protected abstract class UnannotatedJavaResourceAttribute<A extends JavaResourceAttribute>
+ extends UnannotatedJavaResourceMember<A>
+ implements JavaResourceAttribute
+ {
+ public UnannotatedJavaResourceAttribute(A attribute){
+ super(attribute);
+ }
+
+ // ********** annotations **********
+
+ @Override
+ public Annotation buildNullAnnotation(String annotationName) {
+ return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
+ }
+
+ private Annotation buildNullAnnotation_(String annotationName) {
+ return this.getAnnotationProvider().buildNullAnnotation(this, annotationName);
+ }
+
+
+ // ********** delegated behavior **********
+
+ @Override
+ public JavaResourceType getParent() {
+ return this.member.getParent();
+ }
+
+ public JavaResourceType getResourceType() {
+ return this.member.getResourceType();
+ }
+
+ public String getName() {
+ return this.member.getName();
+ }
+
+ public boolean typeIsSubTypeOf(String tn) {
+ return this.member.typeIsSubTypeOf(tn);
+ }
+
+ public boolean typeIsVariablePrimitive() {
+ return this.member.typeIsVariablePrimitive();
+ }
+
+ public int getModifiers() {
+ return this.member.getModifiers();
+ }
+
+ public String getTypeName() {
+ return this.member.getTypeName();
+ }
+
+ public boolean typeIsInterface() {
+ return this.member.typeIsInterface();
+ }
+
+ public boolean typeIsEnum() {
+ return this.member.typeIsEnum();
+ }
+
+ public boolean typeIsArray() {
+ return this.member.typeIsArray();
+ }
+
+ public ListIterable<String> getTypeSuperclassNames() {
+ return this.member.getTypeSuperclassNames();
+ }
+
+ public Iterable<String> getTypeInterfaceNames() {
+ return this.member.getTypeInterfaceNames();
+ }
+
+ public ListIterable<String> getTypeTypeArgumentNames() {
+ return this.member.getTypeTypeArgumentNames();
+ }
+
+ public int getTypeTypeArgumentNamesSize() {
+ return this.member.getTypeTypeArgumentNamesSize();
+ }
+
+ public String getTypeTypeArgumentName(int index) {
+ return this.member.getTypeTypeArgumentName(index);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
index 3d56fe46cc..d1cfdbf5aa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
@@ -13,6 +13,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.Transformer;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
@@ -33,8 +35,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -90,7 +90,7 @@ public abstract class AbstractJavaAttributeMapping<A extends Annotation>
}
protected Annotation getAnnotation_() {
- return this.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName());
+ return this.getResourceAttribute().getAnnotation(this.getAnnotationName());
}
protected abstract String getAnnotationName();
@@ -149,8 +149,8 @@ public abstract class AbstractJavaAttributeMapping<A extends Annotation>
return this.getPersistentAttribute().getOwningTypeMapping();
}
- public JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getPersistentAttribute().getResourcePersistentAttribute();
+ public JavaResourceAttribute getResourceAttribute() {
+ return this.getPersistentAttribute().getResourceAttribute();
}
public String getPrimaryKeyColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
index 725f71f64f..1ae854a3cd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
@@ -12,6 +12,8 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.Transformer;
@@ -44,8 +46,6 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddedId
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -245,8 +245,8 @@ public abstract class AbstractJavaBaseEmbeddedMapping<A extends Annotation>
protected abstract class AttributeOverrideContainerOwner
implements JavaAttributeOverrideContainer2_0.Owner
{
- public JavaResourcePersistentMember getResourcePersistentMember() {
- return AbstractJavaBaseEmbeddedMapping.this.getResourcePersistentAttribute();
+ public JavaResourceMember getResourceMember() {
+ return AbstractJavaBaseEmbeddedMapping.this.getResourceAttribute();
}
public TypeMapping getTypeMapping() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java
index 33535405d9..56c7ce458b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java
@@ -12,6 +12,8 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.Association;
import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
@@ -35,10 +37,8 @@ import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -228,7 +228,7 @@ public abstract class AbstractJavaBasicMapping
* <code>null</code>, remove <em>all</em> the converter annotations.
*/
protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
- JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
if (adapter != converterAdapter) {
adapter.removeConverterAnnotation(resourceAttribute);
@@ -270,7 +270,7 @@ public abstract class AbstractJavaBasicMapping
* adapter. Return <code>null</code> if there are no converter annotations.
*/
protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() {
- JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
if (annotation != null) {
@@ -324,11 +324,11 @@ public abstract class AbstractJavaBasicMapping
// ********** JavaColumn.Owner implementation **********
public ColumnAnnotation getColumnAnnotation() {
- return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ return (ColumnAnnotation) this.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
public void removeColumnAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
public String getDefaultColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
index f8af81331e..c4e9df0dcd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
@@ -12,9 +12,11 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -27,12 +29,11 @@ import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper;
-import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper;
import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation.Supported;
import org.eclipse.jpt.jpa.core.MappingKeys;
@@ -79,7 +80,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
import org.eclipse.jpt.jpa.core.context.java.JavaTable;
import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
@@ -112,15 +112,8 @@ import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideContainer2_0;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -144,13 +137,11 @@ public abstract class AbstractJavaEntity
protected boolean specifiedTableIsAllowed;
protected boolean tableIsUndefined;
- protected final Vector<JavaSecondaryTable> specifiedSecondaryTables = new Vector<JavaSecondaryTable>();
- protected final SpecifiedSecondaryTableContainerAdapter specifiedSecondaryTableContainerAdapter = new SpecifiedSecondaryTableContainerAdapter();
+ protected final ContextListContainer<JavaSecondaryTable, SecondaryTableAnnotation> specifiedSecondaryTableContainer;
protected final Table.Owner specifiedSecondaryTableOwner;
protected final PrimaryKeyJoinColumnOwner primaryKeyJoinColumnOwner;
- protected final Vector<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<JavaPrimaryKeyJoinColumn>();
- protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected final ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation> specifiedPrimaryKeyJoinColumnContainer;
protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
protected InheritanceType specifiedInheritanceStrategy;
@@ -180,9 +171,9 @@ public abstract class AbstractJavaEntity
this.idClassReference = this.buildIdClassReference();
this.table = this.buildTable();
this.specifiedSecondaryTableOwner = this.buildSpecifiedSecondaryTableOwner();
- this.initializeSpecifiedSecondaryTables();
+ this.specifiedSecondaryTableContainer = this.buildSpecifiedSecondaryTableContainer();
this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.initializeSpecifiedPrimaryKeyJoinColumns();
+ this.specifiedPrimaryKeyJoinColumnContainer = this.buildSpecifiedPrimaryKeyJoinColumnContainer();
this.specifiedInheritanceStrategy = this.buildSpecifiedInheritanceStrategy();
this.specifiedDiscriminatorValue = this.getDiscriminatorValueAnnotation().getValue();
this.discriminatorColumn = this.buildDiscriminatorColumn();
@@ -230,10 +221,10 @@ public abstract class AbstractJavaEntity
this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed());
this.setTableIsUndefined(this.buildTableIsUndefined());
- this.updateNodes(this.getSecondaryTables());
+ this.updateSpecifiedSecondaryTables();
this.updateDefaultPrimaryKeyJoinColumn();
- this.updateNodes(this.getPrimaryKeyJoinColumns());
+ this.updateSpecifiedPrimaryKeyJoinColumns();
this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy());
@@ -286,7 +277,7 @@ public abstract class AbstractJavaEntity
}
protected String buildDefaultName() {
- return this.getResourcePersistentType().getName();
+ return this.getJavaResourceType().getName();
}
@@ -437,68 +428,50 @@ public abstract class AbstractJavaEntity
// ********** secondary tables **********
- public ListIterator<JavaSecondaryTable> secondaryTables() {
- return this.specifiedSecondaryTables();
- }
-
- protected ListIterable<JavaSecondaryTable> getSecondaryTables() {
+ public ListIterable<JavaSecondaryTable> getSecondaryTables() {
return this.getSpecifiedSecondaryTables();
}
- public int secondaryTablesSize() {
- return this.specifiedSecondaryTablesSize();
+ public int getSecondaryTablesSize() {
+ return this.getSpecifiedSecondaryTablesSize();
}
// ********** specified secondary tables **********
- public ListIterator<JavaSecondaryTable> specifiedSecondaryTables() {
- return this.getSpecifiedSecondaryTables().iterator();
- }
-
- protected ListIterable<JavaSecondaryTable> getSpecifiedSecondaryTables() {
- return new LiveCloneListIterable<JavaSecondaryTable>(this.specifiedSecondaryTables);
+ public ListIterable<JavaSecondaryTable> getSpecifiedSecondaryTables() {
+ return this.specifiedSecondaryTableContainer.getContextElements();
}
- public int specifiedSecondaryTablesSize() {
- return this.specifiedSecondaryTables.size();
+ public int getSpecifiedSecondaryTablesSize() {
+ return this.specifiedSecondaryTableContainer.getContextElementsSize();
}
public JavaSecondaryTable addSpecifiedSecondaryTable() {
- return this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size());
+ return this.addSpecifiedSecondaryTable(this.getSpecifiedSecondaryTablesSize());
}
public JavaSecondaryTable addSpecifiedSecondaryTable(int index) {
- SecondaryTableAnnotation annotation = this.buildSecondaryTableAnnotation(index);
- return this.addSpecifiedSecondaryTable_(index, annotation);
+ SecondaryTableAnnotation annotation = this.addSecondaryTableAnnotation(index);
+ return this.specifiedSecondaryTableContainer.addContextElement(index, annotation);
}
- protected SecondaryTableAnnotation buildSecondaryTableAnnotation(int index) {
- return (SecondaryTableAnnotation) this.getResourcePersistentType().addAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ protected SecondaryTableAnnotation addSecondaryTableAnnotation(int index) {
+ return (SecondaryTableAnnotation) this.getJavaResourceType().addAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME);
}
public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) {
- this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTables.indexOf(secondaryTable));
+ this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTableContainer.indexOfContextElement((JavaSecondaryTable) secondaryTable));
}
public void removeSpecifiedSecondaryTable(int index) {
- this.getResourcePersistentType().removeAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
- this.removeSpecifiedSecondaryTable_(index);
- }
-
- protected void removeSpecifiedSecondaryTable_(int index) {
- this.removeItemFromList(index, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ this.getJavaResourceType().removeAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME);
+ this.specifiedSecondaryTableContainer.removeContextElement(index);
}
public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
- this.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, SecondaryTablesAnnotation.ANNOTATION_NAME);
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
- }
-
- protected void initializeSpecifiedSecondaryTables() {
- for (SecondaryTableAnnotation annotation : this.getSecondaryTableAnnotations()) {
- this.specifiedSecondaryTables.add(this.buildSecondaryTable(annotation));
- }
+ this.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, SecondaryTableAnnotation.ANNOTATION_NAME);
+ this.specifiedSecondaryTableContainer.moveContextElement(targetIndex, sourceIndex);
}
protected JavaSecondaryTable buildSecondaryTable(SecondaryTableAnnotation secondaryTableAnnotation) {
@@ -506,63 +479,51 @@ public abstract class AbstractJavaEntity
}
protected void syncSpecifiedSecondaryTables() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedSecondaryTableContainerAdapter);
- }
-
- protected Iterable<SecondaryTableAnnotation> getSecondaryTableAnnotations() {
- return CollectionTools.iterable(this.secondaryTableAnnotations());
- }
-
- protected Iterator<SecondaryTableAnnotation> secondaryTableAnnotations() {
- return new SuperIteratorWrapper<SecondaryTableAnnotation>(this.nestableSecondaryTableAnnotations());
+ this.specifiedSecondaryTableContainer.synchronizeWithResourceModel();
}
- protected Iterator<NestableSecondaryTableAnnotation> nestableSecondaryTableAnnotations() {
- return new SubIteratorWrapper<NestableAnnotation, NestableSecondaryTableAnnotation>(this.nestableSecondaryTableAnnotations_());
+ protected void updateSpecifiedSecondaryTables() {
+ this.specifiedSecondaryTableContainer.update();
}
- protected Iterator<NestableAnnotation> nestableSecondaryTableAnnotations_() {
- return this.getResourceAnnotatedElement().annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ protected ListIterable<SecondaryTableAnnotation> getSecondaryTableAnnotations() {
+ return this.getSecondaryTableAnnotations_();
}
- protected void moveSpecifiedSecondaryTable_(int index, JavaSecondaryTable secondaryTable) {
- this.moveItemInList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ protected ListIterable<SecondaryTableAnnotation> getSecondaryTableAnnotations_() {
+ return new SubListIterableWrapper<NestableAnnotation, SecondaryTableAnnotation>(this.getNestableSecondaryTableAnnotations_());
}
- protected JavaSecondaryTable addSpecifiedSecondaryTable_(int index, SecondaryTableAnnotation secondaryTableAnnotation) {
- JavaSecondaryTable secondaryTable = this.buildSecondaryTable(secondaryTableAnnotation);
- this.addItemToList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
- return secondaryTable;
+ protected ListIterable<NestableAnnotation> getNestableSecondaryTableAnnotations_() {
+ return this.getResourceAnnotatedElement().getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME);
}
- protected void removeSpecifiedSecondaryTable_(JavaSecondaryTable secondaryTable) {
- this.removeSpecifiedSecondaryTable_(this.specifiedSecondaryTables.indexOf(secondaryTable));
+ protected ContextListContainer<JavaSecondaryTable, SecondaryTableAnnotation> buildSpecifiedSecondaryTableContainer() {
+ return new SpecifiedSecondaryTableContainer();
}
/**
- * specified secondary table container adapter
+ * specified secondary table container
*/
- protected class SpecifiedSecondaryTableContainerAdapter
- implements ContextContainerTools.Adapter<JavaSecondaryTable, SecondaryTableAnnotation>
+ protected class SpecifiedSecondaryTableContainer
+ extends ContextListContainer<JavaSecondaryTable, SecondaryTableAnnotation>
{
- public Iterable<JavaSecondaryTable> getContextElements() {
- return AbstractJavaEntity.this.getSpecifiedSecondaryTables();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_SECONDARY_TABLES_LIST;
+ }
+ @Override
+ protected JavaSecondaryTable buildContextElement(SecondaryTableAnnotation resourceElement) {
+ return AbstractJavaEntity.this.buildSecondaryTable(resourceElement);
}
- public Iterable<SecondaryTableAnnotation> getResourceElements() {
+ @Override
+ protected ListIterable<SecondaryTableAnnotation> getResourceElements() {
return AbstractJavaEntity.this.getSecondaryTableAnnotations();
}
- public SecondaryTableAnnotation getResourceElement(JavaSecondaryTable contextElement) {
+ @Override
+ protected SecondaryTableAnnotation getResourceElement(JavaSecondaryTable contextElement) {
return contextElement.getTableAnnotation();
}
- public void moveContextElement(int index, JavaSecondaryTable element) {
- AbstractJavaEntity.this.moveSpecifiedSecondaryTable_(index, element);
- }
- public void addContextElement(int index, SecondaryTableAnnotation resourceElement) {
- AbstractJavaEntity.this.addSpecifiedSecondaryTable_(index, resourceElement);
- }
- public void removeContextElement(JavaSecondaryTable element) {
- AbstractJavaEntity.this.removeSpecifiedSecondaryTable_(element);
- }
}
protected Table.Owner buildSpecifiedSecondaryTableOwner() {
@@ -572,143 +533,112 @@ public abstract class AbstractJavaEntity
// ********** primary key join columns **********
- public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumns().iterator();
- }
-
- protected ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ public ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
}
- public int primaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.defaultPrimaryKeyJoinColumnsSize();
+ public int getPrimaryKeyJoinColumnsSize() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
}
// ********** specified primary key join columns **********
- public ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
+ public ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
}
- protected ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<JavaPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
- }
-
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
+ public int getSpecifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
}
protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumns.size() != 0;
+ return this.getSpecifiedPrimaryKeyJoinColumnsSize() != 0;
}
public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
+ return this.addSpecifiedPrimaryKeyJoinColumn(this.getSpecifiedPrimaryKeyJoinColumnsSize());
}
public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- PrimaryKeyJoinColumnAnnotation annotation = this.buildPrimaryKeyJoinColumnAnnotation(index);
- return this.addSpecifiedPrimaryKeyJoinColumn_(index, annotation);
+ PrimaryKeyJoinColumnAnnotation annotation = this.addPrimaryKeyJoinColumnAnnotation(index);
+ return this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(index, annotation);
}
- protected PrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumnAnnotation(int index) {
- return (PrimaryKeyJoinColumnAnnotation) this.getResourcePersistentType().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ protected PrimaryKeyJoinColumnAnnotation addPrimaryKeyJoinColumnAnnotation(int index) {
+ return (PrimaryKeyJoinColumnAnnotation) this.getJavaResourceType().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
}
- public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn));
+ public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
+ this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumnContainer.indexOfContextElement((JavaPrimaryKeyJoinColumn) joinColumn));
}
public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- this.getResourcePersistentType().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- this.removeSpecifiedPrimaryKeyJoinColumn_(index);
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.getJavaResourceType().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
+ this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(index);
}
public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.getResourcePersistentType().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected PrimaryKeyJoinColumnOwner buildPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- protected void initializeSpecifiedPrimaryKeyJoinColumns() {
- for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) {
- this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation));
- }
- }
-
- protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnAnnotation) {
- return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, primaryKeyJoinColumnAnnotation);
+ this.getJavaResourceType().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
+ this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
}
protected void syncSpecifiedPrimaryKeyJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ this.specifiedPrimaryKeyJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
- return CollectionTools.iterable(this.primaryKeyJoinColumnAnnotations());
+ protected void updateSpecifiedPrimaryKeyJoinColumns() {
+ this.specifiedPrimaryKeyJoinColumnContainer.update();
}
- protected Iterator<PrimaryKeyJoinColumnAnnotation> primaryKeyJoinColumnAnnotations() {
- return new SuperIteratorWrapper<PrimaryKeyJoinColumnAnnotation>(this.nestablePrimaryKeyJoinColumnAnnotations());
+ protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
+ return getPrimaryKeyJoinColumnAnnotations_();
}
- protected Iterator<NestablePrimaryKeyJoinColumnAnnotation> nestablePrimaryKeyJoinColumnAnnotations() {
- return new SubIteratorWrapper<NestableAnnotation, NestablePrimaryKeyJoinColumnAnnotation>(this.nestablePrimaryKeyJoinColumnAnnotations_());
+ protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations_() {
+ return new SubListIterableWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>(this.getNestablePrimaryKeyJoinColumnAnnotations_());
}
- protected Iterator<NestableAnnotation> nestablePrimaryKeyJoinColumnAnnotations_() {
- return this.getResourceAnnotatedElement().annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ protected ListIterable<NestableAnnotation> getNestablePrimaryKeyJoinColumnAnnotations_() {
+ return this.getResourceAnnotatedElement().getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
}
- protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.moveItemInList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ protected PrimaryKeyJoinColumnOwner buildPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
}
- protected JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnAnnotation) {
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = this.buildPrimaryKeyJoinColumn(primaryKeyJoinColumnAnnotation);
- this.addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return primaryKeyJoinColumn;
+ protected JavaPrimaryKeyJoinColumn buildSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnAnnotation) {
+ return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, primaryKeyJoinColumnAnnotation);
}
- protected void removeSpecifiedPrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn));
+ protected ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation> buildSpecifiedPrimaryKeyJoinColumnContainer() {
+ return new SpecifiedPrimaryKeyJoinColumnContainer();
}
/**
- * specified primary key join column container adapter
+ * specified primary key join column container
*/
- protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
+ protected class SpecifiedPrimaryKeyJoinColumnContainer
+ extends ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
{
- public Iterable<JavaPrimaryKeyJoinColumn> getContextElements() {
- return AbstractJavaEntity.this.getSpecifiedPrimaryKeyJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected JavaPrimaryKeyJoinColumn buildContextElement(PrimaryKeyJoinColumnAnnotation resourceElement) {
+ return AbstractJavaEntity.this.buildSpecifiedPrimaryKeyJoinColumn(resourceElement);
}
- public Iterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
+ @Override
+ protected ListIterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
return AbstractJavaEntity.this.getPrimaryKeyJoinColumnAnnotations();
}
- public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
+ @Override
+ protected PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
return contextElement.getColumnAnnotation();
}
- public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) {
- AbstractJavaEntity.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
- }
- public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) {
- AbstractJavaEntity.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(JavaPrimaryKeyJoinColumn element) {
- AbstractJavaEntity.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
- }
}
-
// ********** default primary key join column **********
public JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
@@ -727,7 +657,7 @@ public abstract class AbstractJavaEntity
EmptyListIterable.<JavaPrimaryKeyJoinColumn>instance();
}
- protected int defaultPrimaryKeyJoinColumnsSize() {
+ protected int getDefaultPrimaryKeyJoinColumnsSize() {
return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
}
@@ -748,7 +678,7 @@ public abstract class AbstractJavaEntity
}
protected JavaPrimaryKeyJoinColumn buildDefaultPrimaryKeyJoinColumn() {
- return this.buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.getResourcePersistentType()));
+ return this.buildSpecifiedPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.getJavaResourceType()));
}
@@ -798,7 +728,7 @@ public abstract class AbstractJavaEntity
// ********** inheritance annotation **********
protected InheritanceAnnotation getInheritanceAnnotation() {
- return (InheritanceAnnotation) this.getResourcePersistentType().getNonNullAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
+ return (InheritanceAnnotation) this.getJavaResourceType().getNonNullAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
}
protected void removeInheritanceAnnotationIfUnset() {
@@ -808,7 +738,7 @@ public abstract class AbstractJavaEntity
}
protected void removeInheritanceAnnotation() {
- this.getResourcePersistentType().removeAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
+ this.getJavaResourceType().removeAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
}
@@ -900,7 +830,7 @@ public abstract class AbstractJavaEntity
// ********** discriminator value annotation **********
protected DiscriminatorValueAnnotation getDiscriminatorValueAnnotation() {
- return (DiscriminatorValueAnnotation) this.getResourcePersistentType().getNonNullAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
+ return (DiscriminatorValueAnnotation) this.getJavaResourceType().getNonNullAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
}
protected void removeDiscriminatorValueAnnotationIfUnset() {
@@ -910,7 +840,7 @@ public abstract class AbstractJavaEntity
}
protected void removeDiscriminatorValueAnnotation() {
- this.getResourcePersistentType().removeAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
+ this.getJavaResourceType().removeAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
}
@@ -1002,8 +932,8 @@ public abstract class AbstractJavaEntity
return this.getJpaFactory().buildJavaGeneratorContainer(this, this);
}
- public JavaResourcePersistentMember getResourceAnnotatedElement() {
- return this.getResourcePersistentType();
+ public JavaResourceType getResourceAnnotatedElement() {
+ return this.getJavaResourceType();
}
@@ -1150,8 +1080,8 @@ public abstract class AbstractJavaEntity
}
@Override
- public JavaResourcePersistentType getResourcePersistentType() {
- return super.getResourcePersistentType();
+ public JavaResourceType getJavaResourceType() {
+ return super.getJavaResourceType();
}
@@ -1259,28 +1189,28 @@ public abstract class AbstractJavaEntity
* Return whether the type is abstract.
*/
protected boolean isAbstract() {
- return this.getResourcePersistentType().isAbstract();
+ return this.getJavaResourceType().isAbstract();
}
/**
* Return whether the entity's type is final.
*/
protected boolean isFinal() {
- return this.getResourcePersistentType().isFinal();
+ return this.getJavaResourceType().isFinal();
}
/**
* Return whether the entity's type is a member of another type.
*/
protected boolean isMember() {
- return this.getResourcePersistentType().isMemberType();
+ return this.getJavaResourceType().isMemberType();
}
/**
* Return whether the entity's type is static.
*/
protected boolean isStatic() {
- return this.getResourcePersistentType().isStatic();
+ return this.getJavaResourceType().isStatic();
}
@@ -1296,13 +1226,13 @@ public abstract class AbstractJavaEntity
if (result != null) {
return result;
}
- for (JavaSecondaryTable secondaryTable : CollectionTools.iterable(this.secondaryTables())) {
+ for (JavaSecondaryTable secondaryTable : this.getSecondaryTables()) {
result = secondaryTable.javaCompletionProposals(pos, filter, astRoot);
if (result != null) {
return result;
}
}
- for (JavaPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
+ for (JavaPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
result = pkJoinColumn.javaCompletionProposals(pos, filter, astRoot);
if (result != null) {
return result;
@@ -1539,8 +1469,8 @@ public abstract class AbstractJavaEntity
protected abstract class OverrideContainerOwner
implements JavaOverrideContainer2_0.Owner
{
- public JavaResourcePersistentMember getResourcePersistentMember() {
- return AbstractJavaEntity.this.getResourcePersistentType();
+ public JavaResourceMember getResourceMember() {
+ return AbstractJavaEntity.this.getJavaResourceType();
}
public AbstractJavaEntity getTypeMapping() {
@@ -1701,8 +1631,8 @@ public abstract class AbstractJavaEntity
return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
}
- public int joinColumnsSize() {
- return AbstractJavaEntity.this.primaryKeyJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return AbstractJavaEntity.this.getPrimaryKeyJoinColumnsSize();
}
public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
@@ -1710,7 +1640,7 @@ public abstract class AbstractJavaEntity
}
public String getDefaultColumnName() {
- if (this.joinColumnsSize() != 1) {
+ if (this.getJoinColumnsSize() != 1) {
return null;
}
Entity parentEntity = AbstractJavaEntity.this.getParentEntity();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java
index 8b10f0d479..43b365a49d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java
@@ -12,6 +12,9 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
@@ -40,12 +43,9 @@ import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.IdMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -147,14 +147,14 @@ public abstract class AbstractJavaIdMapping
}
protected GeneratedValueAnnotation buildGeneratedValueAnnotation() {
- return (GeneratedValueAnnotation) this.getResourcePersistentAttribute().addAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
+ return (GeneratedValueAnnotation) this.getResourceAttribute().addAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
}
public void removeGeneratedValue() {
if (this.generatedValue == null) {
throw new IllegalStateException("generated value does not exist"); //$NON-NLS-1$
}
- this.getResourcePersistentAttribute().removeAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
this.setGeneratedValue(null);
}
@@ -164,7 +164,7 @@ public abstract class AbstractJavaIdMapping
}
protected GeneratedValueAnnotation getGeneratedValueAnnotation() {
- return (GeneratedValueAnnotation) this.getResourcePersistentAttribute().getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
+ return (GeneratedValueAnnotation) this.getResourceAttribute().getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
}
protected JavaGeneratedValue buildGeneratedValue(GeneratedValueAnnotation generatedValueAnnotation) {
@@ -227,7 +227,7 @@ public abstract class AbstractJavaIdMapping
* <code>null</code>, remove <em>all</em> the converter annotations.
*/
protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
- JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
if (adapter != converterAdapter) {
adapter.removeConverterAnnotation(resourceAttribute);
@@ -269,7 +269,7 @@ public abstract class AbstractJavaIdMapping
* adapter. Return <code>null</code> if there are no converter annotations.
*/
protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() {
- JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
if (annotation != null) {
@@ -341,7 +341,7 @@ public abstract class AbstractJavaIdMapping
}
protected boolean columnIsSpecified() {
- return this.getResourcePersistentAttribute().getAnnotation(ColumnAnnotation.ANNOTATION_NAME) != null;
+ return this.getResourceAttribute().getAnnotation(ColumnAnnotation.ANNOTATION_NAME) != null;
}
@Override
@@ -352,19 +352,19 @@ public abstract class AbstractJavaIdMapping
// ********** JavaGeneratorContainer implementation **********
- public JavaResourcePersistentMember getResourceAnnotatedElement() {
- return this.getResourcePersistentAttribute();
+ public JavaResourceMember getResourceAnnotatedElement() {
+ return this.getResourceAttribute();
}
// ********** JavaColumn.Owner implementation **********
public ColumnAnnotation getColumnAnnotation() {
- return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ return (ColumnAnnotation) this.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
public void removeColumnAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
public String getDefaultColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
index f1bc87c247..ab501c9bcf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
@@ -11,14 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.JoinColumn;
@@ -30,7 +26,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationship;
import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -40,8 +35,7 @@ public abstract class AbstractJavaJoinColumnRelationshipStrategy
extends AbstractJavaJpaContextNode
implements JavaJoinColumnRelationshipStrategy
{
- protected final Vector<JavaJoinColumn> specifiedJoinColumns = new Vector<JavaJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter;
+ protected final ContextListContainer<JavaJoinColumn, JoinColumnAnnotation> specifiedJoinColumnContainer;
protected final JavaReadOnlyJoinColumn.Owner joinColumnOwner;
protected JavaJoinColumn defaultJoinColumn;
@@ -49,9 +43,8 @@ public abstract class AbstractJavaJoinColumnRelationshipStrategy
protected AbstractJavaJoinColumnRelationshipStrategy(JavaJoinColumnRelationship parent) {
super(parent);
- this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter();
this.joinColumnOwner = this.buildJoinColumnOwner();
- this.initializeSpecifiedJoinColumns();
+ this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
}
@@ -73,124 +66,90 @@ public abstract class AbstractJavaJoinColumnRelationshipStrategy
// ********** join columns **********
- public ListIterator<JavaJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<JavaJoinColumn> getJoinColumns() {
+ public ListIterable<JavaJoinColumn> getJoinColumns() {
return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
}
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
}
// ********** specified join columns **********
- public ListIterator<JavaJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
+ public ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
+ return this.specifiedJoinColumnContainer.getContextElements();
}
- protected ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<JavaJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
+ public int getSpecifiedJoinColumnsSize() {
+ return this.specifiedJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
+ return this.getSpecifiedJoinColumnsSize() != 0;
}
public JavaJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
+ return this.specifiedJoinColumnContainer.getContextElement(index);
}
public JavaJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
+ return this.addSpecifiedJoinColumn(this.getSpecifiedJoinColumnsSize());
}
public JavaJoinColumn addSpecifiedJoinColumn(int index) {
JoinColumnAnnotation annotation = this.addJoinColumnAnnotation(index);
- return this.addSpecifiedJoinColumn_(index, annotation);
+ return this.specifiedJoinColumnContainer.addContextElement(index, annotation);
}
public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
+ this.removeSpecifiedJoinColumn(this.specifiedJoinColumnContainer.indexOfContextElement((JavaJoinColumn) joinColumn));
}
public void removeSpecifiedJoinColumn(int index) {
this.removeJoinColumnAnnotation(index);
- this.removeSpecifiedJoinColumn_(index);
- }
-
- protected void removeSpecifiedJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.removeContextElement(index);
}
public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
this.moveJoinColumnAnnotation(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected void initializeSpecifiedJoinColumns() {
- for (JoinColumnAnnotation joinColumnAnnotation : this.getJoinColumnAnnotations()) {
- this.specifiedJoinColumns.add(this.buildJoinColumn(joinColumnAnnotation));
- }
+ this.specifiedJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
}
protected void syncSpecifiedJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
+ this.specifiedJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
- return CollectionTools.iterable(this.joinColumnAnnotations());
+ protected void updateSpecifiedJoinColumns() {
+ this.specifiedJoinColumnContainer.update();
}
- protected void moveSpecifiedJoinColumn_(int index, JavaJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected JavaJoinColumn addSpecifiedJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) {
- JavaJoinColumn joinColumn = this.buildJoinColumn(joinColumnAnnotation);
- this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedJoinColumn_(JavaJoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
- }
-
- protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() {
- return new SpecifiedJoinColumnContainerAdapter();
+ protected ContextListContainer<JavaJoinColumn, JoinColumnAnnotation> buildSpecifiedJoinColumnContainer() {
+ return new SpecifiedJoinColumnContainer();
}
/**
- * specified join column container adapter
+ * specified join column container
*/
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaJoinColumn, JoinColumnAnnotation>
+ protected class SpecifiedJoinColumnContainer
+ extends ContextListContainer<JavaJoinColumn, JoinColumnAnnotation>
{
- public Iterable<JavaJoinColumn> getContextElements() {
- return AbstractJavaJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_JOIN_COLUMNS_LIST;
}
- public Iterable<JoinColumnAnnotation> getResourceElements() {
+ @Override
+ protected JavaJoinColumn buildContextElement(JoinColumnAnnotation resourceElement) {
+ return AbstractJavaJoinColumnRelationshipStrategy.this.buildJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<JoinColumnAnnotation> getResourceElements() {
return AbstractJavaJoinColumnRelationshipStrategy.this.getJoinColumnAnnotations();
}
- public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
+ @Override
+ protected JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
return contextElement.getColumnAnnotation();
}
- public void moveContextElement(int index, JavaJoinColumn element) {
- AbstractJavaJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn_(index, element);
- }
- public void addContextElement(int index, JoinColumnAnnotation resourceElement) {
- AbstractJavaJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(JavaJoinColumn element) {
- AbstractJavaJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn_(element);
- }
}
protected abstract JavaReadOnlyJoinColumn.Owner buildJoinColumnOwner();
@@ -238,7 +197,7 @@ public abstract class AbstractJavaJoinColumnRelationshipStrategy
// ********** join column annotations **********
- protected abstract Iterator<JoinColumnAnnotation> joinColumnAnnotations();
+ protected abstract ListIterable<JoinColumnAnnotation> getJoinColumnAnnotations();
protected abstract JoinColumnAnnotation addJoinColumnAnnotation(int index);
@@ -265,13 +224,13 @@ public abstract class AbstractJavaJoinColumnRelationshipStrategy
}
public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldStrategy.specifiedJoinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : oldStrategy.getSpecifiedJoinColumns()) {
this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
}
}
public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy virtualStrategy) {
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualStrategy.joinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : virtualStrategy.getJoinColumns()) {
this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
}
}
@@ -307,13 +266,13 @@ public abstract class AbstractJavaJoinColumnRelationshipStrategy
}
public void addStrategy() {
- if (this.specifiedJoinColumnsSize() == 0) {
+ if (this.getSpecifiedJoinColumnsSize() == 0) {
this.addSpecifiedJoinColumn();
}
}
public void removeStrategy() {
- for (int i = this.specifiedJoinColumns.size(); i-- > 0; ) {
+ for (int i = this.getSpecifiedJoinColumnsSize(); i-- > 0; ) {
this.removeSpecifiedJoinColumn(i);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
index 65dd47a375..8f0bb6b60c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
@@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -54,7 +55,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
import org.eclipse.jpt.jpa.db.Table;
@@ -315,7 +315,7 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi
// ********** map key annotation **********
protected MapKeyAnnotation getMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ return (MapKeyAnnotation) this.getResourceAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
}
protected MapKeyAnnotation getMapKeyAnnotationForUpdate() {
@@ -324,11 +324,11 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi
}
protected MapKeyAnnotation addMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ return (MapKeyAnnotation) this.getResourceAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
}
protected void removeMapKeyAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
}
@@ -428,15 +428,15 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi
}
protected MapKeyClass2_0Annotation getMapKeyClassAnnotation_() {
- return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ return (MapKeyClass2_0Annotation) this.getResourceAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
}
protected MapKeyClass2_0Annotation addMapKeyClassAnnotation() {
- return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ return (MapKeyClass2_0Annotation) this.getResourceAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
}
protected void removeMapKeyClassAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
}
@@ -517,7 +517,7 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi
}
protected MapKeyColumn2_0Annotation getMapKeyColumnAnnotation_() {
- return (MapKeyColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+ return (MapKeyColumn2_0Annotation) this.getResourceAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
}
protected void removeMapKeyColumnAnnotation() {
@@ -529,7 +529,7 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi
}
protected void removeMapKeyColumnAnnotation_() {
- this.getResourcePersistentAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
}
@@ -734,8 +734,8 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi
extends AbstractOwner
implements JavaAttributeOverrideContainer2_0.Owner
{
- public JavaResourcePersistentMember getResourcePersistentMember() {
- return AbstractJavaMultiRelationshipMapping.this.getResourcePersistentAttribute();
+ public JavaResourceAttribute getResourceMember() {
+ return AbstractJavaMultiRelationshipMapping.this.getResourceAttribute();
}
public TypeMapping getOverridableTypeMapping() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
index 5d8967e3c0..2914c80041 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
@@ -13,9 +13,11 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.ClassName;
@@ -29,6 +31,7 @@ import org.eclipse.jpt.jpa.core.context.CollectionMapping;
import org.eclipse.jpt.jpa.core.context.Embeddable;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.context.java.Accessor;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
@@ -40,7 +43,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -51,9 +53,7 @@ public abstract class AbstractJavaPersistentAttribute
extends AbstractJavaJpaContextNode
implements JavaPersistentAttribute2_0
{
- protected final JavaResourcePersistentAttribute resourcePersistentAttribute;
-
- protected String name;
+ protected final Accessor accessor;
protected AccessType defaultAccess;
protected AccessType specifiedAccess;
@@ -61,12 +61,25 @@ public abstract class AbstractJavaPersistentAttribute
protected JavaAttributeMapping mapping; // never null
protected String defaultMappingKey;
+ protected AbstractJavaPersistentAttribute(PersistentType parent, JavaResourceField resourceField) {
+ super(parent);
+ this.accessor = new FieldAccessor(this, resourceField);
+ this.initialize();
+ }
+
+ protected AbstractJavaPersistentAttribute(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
+ super(parent);
+ this.accessor = new PropertyAccessor(this, resourceGetter, resourceSetter);
+ this.initialize();
+ }
- protected AbstractJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ protected AbstractJavaPersistentAttribute(PersistentType parent, Accessor accessor) {
super(parent);
- this.resourcePersistentAttribute = resourcePersistentAttribute;
- this.name = resourcePersistentAttribute.getName();
+ this.accessor = accessor;
+ this.initialize();
+ }
+ protected void initialize() {
// this is determined directly from the resource model
this.defaultAccess = this.buildDefaultAccess();
this.specifiedAccess = this.buildSpecifiedAccess();
@@ -75,13 +88,11 @@ public abstract class AbstractJavaPersistentAttribute
this.mapping = this.buildMapping();
}
-
// ********** synchronize/update **********
@Override
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
- this.setName(this.resourcePersistentAttribute.getName());
// this is determined directly from the resource model
this.setDefaultAccess(this.buildDefaultAccess());
this.setSpecifiedAccess_(this.buildSpecifiedAccess());
@@ -94,20 +105,28 @@ public abstract class AbstractJavaPersistentAttribute
this.updateMapping();
}
-
// ********** name **********
+ /**
+ * name will not change in java, a new persistent attribute will be built.
+ */
public String getName() {
- return this.name;
+ return this.getResourceAttribute().getName();
}
- protected void setName(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
+
+ public Accessor getAccessor() {
+ return this.accessor;
}
+ public boolean isFor(JavaResourceField resourceField) {
+ return this.accessor.isFor(resourceField);
+ }
+ public boolean isFor(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
+ return this.accessor.isFor(resourceGetter, resourceSetter);
+ }
+
// ********** access **********
public AccessType getAccess() {
@@ -126,8 +145,9 @@ public abstract class AbstractJavaPersistentAttribute
}
protected AccessType buildDefaultAccess() {
- return this.resourcePersistentAttribute.isField() ? AccessType.FIELD : AccessType.PROPERTY;
+ return getAccessor().getDefaultAccess();
}
+
public AccessType getSpecifiedAccess() {
return this.specifiedAccess;
}
@@ -159,7 +179,7 @@ public abstract class AbstractJavaPersistentAttribute
}
protected Access2_0Annotation getAccessAnnotation() {
- return (Access2_0Annotation) this.resourcePersistentAttribute.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
+ return (Access2_0Annotation) this.getResourceAttribute().getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
}
@@ -269,7 +289,7 @@ public abstract class AbstractJavaPersistentAttribute
}
protected void setMappingAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
- this.resourcePersistentAttribute.setPrimaryAnnotation(primaryAnnotationName, supportingAnnotationNames);
+ this.getResourceAttribute().setPrimaryAnnotation(primaryAnnotationName, supportingAnnotationNames);
}
protected JavaAttributeMapping buildMapping(JavaAttributeMappingDefinition definition) {
@@ -431,11 +451,11 @@ public abstract class AbstractJavaPersistentAttribute
}
protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.resourcePersistentAttribute.getNameTextRange(astRoot);
+ return this.getResourceAttribute().getNameTextRange(astRoot);
}
protected CompilationUnit buildASTRoot() {
- return this.resourcePersistentAttribute.getJavaResourceCompilationUnit().buildASTRoot();
+ return this.getResourceAttribute().getJavaResourceCompilationUnit().buildASTRoot();
}
public void dispose() {
@@ -494,10 +514,10 @@ public abstract class AbstractJavaPersistentAttribute
if (JDTTools.typeIsOtherValidBasicType(typeName)) {
return true;
}
- if (this.resourcePersistentAttribute.typeIsEnum()) {
+ if (this.getResourceAttribute().typeIsEnum()) {
return true;
}
- if (this.resourcePersistentAttribute.typeIsSubTypeOf(SERIALIZABLE_TYPE_NAME)) {
+ if (this.getResourceAttribute().typeIsSubTypeOf(SERIALIZABLE_TYPE_NAME)) {
return true;
}
return false;
@@ -522,11 +542,11 @@ public abstract class AbstractJavaPersistentAttribute
}
public String getMultiReferenceTargetTypeName() {
- return this.getJpaContainerDefinition().getMultiReferenceTargetTypeName(this.resourcePersistentAttribute);
+ return this.getJpaContainerDefinition().getMultiReferenceTargetTypeName(this.getResourceAttribute());
}
public String getMultiReferenceMapKeyTypeName() {
- return this.getJpaContainerDefinition().getMultiReferenceMapKeyTypeName(this.resourcePersistentAttribute);
+ return this.getJpaContainerDefinition().getMultiReferenceMapKeyTypeName(this.getResourceAttribute());
}
/**
@@ -557,8 +577,8 @@ public abstract class AbstractJavaPersistentAttribute
return this;
}
- public JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.resourcePersistentAttribute;
+ public JavaResourceAttribute getResourceAttribute() {
+ return this.accessor.getResourceAttribute();
}
public String getPrimaryKeyColumnName() {
@@ -566,11 +586,11 @@ public abstract class AbstractJavaPersistentAttribute
}
public String getTypeName() {
- return this.resourcePersistentAttribute.getTypeName();
+ return this.getResourceAttribute().getTypeName();
}
public boolean contains(int offset, CompilationUnit astRoot) {
- TextRange fullTextRange = this.resourcePersistentAttribute.getTextRange(astRoot);
+ TextRange fullTextRange = this.getResourceAttribute().getTextRange(astRoot);
// 'fullTextRange' will be null if the attribute no longer exists in the java;
// the context model can be out of synch with the resource model
// when a selection event occurs before the context model has a
@@ -583,25 +603,9 @@ public abstract class AbstractJavaPersistentAttribute
return (typeName == null) ? null : this.getPersistenceUnit().getEmbeddable(typeName);
}
- public boolean isField() {
- return this.resourcePersistentAttribute.isField();
- }
-
- public boolean isProperty() {
- return this.resourcePersistentAttribute.isProperty();
- }
-
- public boolean isPublic() {
- return Modifier.isPublic(this.resourcePersistentAttribute.getModifiers());
- }
-
- public boolean isFinal() {
- return Modifier.isFinal(this.resourcePersistentAttribute.getModifiers());
- }
-
@Override
public void toString(StringBuilder sb) {
- sb.append(this.name);
+ sb.append(this.getName());
}
@@ -621,10 +625,10 @@ public abstract class AbstractJavaPersistentAttribute
}
protected void validateAttribute(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- this.buildAttibuteValidator(astRoot).validate(messages, reporter);
+ this.buildAttributeValidator(astRoot).validate(messages, reporter);
}
- protected abstract JptValidator buildAttibuteValidator(CompilationUnit astRoot);
+ protected abstract JptValidator buildAttributeValidator(CompilationUnit astRoot);
protected PersistentAttributeTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
return new JavaPersistentAttributeTextRangeResolver(this, astRoot);
@@ -686,7 +690,7 @@ public abstract class AbstractJavaPersistentAttribute
public JpaContainerDefinition getJpaContainerDefinition() {
// 'typeName' may include array brackets ("[]")
// but not generic type arguments (e.g. "<java.lang.String>")
- return this.getJpaContainerDefinition(this.resourcePersistentAttribute.getTypeName());
+ return this.getJpaContainerDefinition(this.getResourceAttribute().getTypeName());
}
/**
@@ -763,13 +767,13 @@ public abstract class AbstractJavaPersistentAttribute
super(collectionClass, staticMetamodelTypeDeclarationTypeName);
}
- public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 1) ?
- resourcePersistentAttribute.getTypeTypeArgumentName(0) :
+ public String getMultiReferenceTargetTypeName(JavaResourceAttribute resourceAttribute) {
+ return (resourceAttribute.getTypeTypeArgumentNamesSize() == 1) ?
+ resourceAttribute.getTypeTypeArgumentName(0) :
null;
}
- public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
+ public String getMultiReferenceMapKeyTypeName(JavaResourceAttribute resourceAttribute) {
return null;
}
@@ -792,15 +796,15 @@ public abstract class AbstractJavaPersistentAttribute
super(mapClass, staticMetamodelTypeDeclarationTypeName);
}
- public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 2) ?
- resourcePersistentAttribute.getTypeTypeArgumentName(1) :
+ public String getMultiReferenceTargetTypeName(JavaResourceAttribute resourceAttribute) {
+ return (resourceAttribute.getTypeTypeArgumentNamesSize() == 2) ?
+ resourceAttribute.getTypeTypeArgumentName(1) :
null;
}
- public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) {
- return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 2) ?
- resourcePersistentAttribute.getTypeTypeArgumentName(0) :
+ public String getMultiReferenceMapKeyTypeName(JavaResourceAttribute resourceAttribute) {
+ return (resourceAttribute.getTypeTypeArgumentNamesSize() == 2) ?
+ resourceAttribute.getTypeTypeArgumentName(0) :
null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
index a572011016..8d59c6a8c2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
@@ -9,20 +9,29 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.java;
+import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNode;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.ClassName;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
@@ -30,7 +39,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.JpaFile;
@@ -44,12 +53,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaStructureNodes;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNode;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -67,7 +71,7 @@ public abstract class AbstractJavaPersistentType
extends AbstractJavaJpaContextNode
implements JavaPersistentType
{
- protected final JavaResourcePersistentType resourcePersistentType;
+ protected final JavaResourceType resourceType;
protected String name;
@@ -79,19 +83,20 @@ public abstract class AbstractJavaPersistentType
protected JavaTypeMapping mapping; // never null
protected final Vector<JavaPersistentAttribute> attributes = new Vector<JavaPersistentAttribute>();
- protected final AttributeContainerAdapter attributeContainerAdapter = new AttributeContainerAdapter();
- protected AbstractJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType resourcePersistentType) {
+ protected AbstractJavaPersistentType(PersistentType.Owner parent, JavaResourceType resourceType) {
super(parent);
- this.resourcePersistentType = resourcePersistentType;
- this.name = resourcePersistentType.getQualifiedName();
+ this.resourceType = resourceType;
+ this.name = this.resourceType.getQualifiedName();
this.specifiedAccess = this.buildSpecifiedAccess();
// keep this non-null
this.defaultAccess = AccessType.FIELD;
this.mapping = this.buildMapping();
+ this.initializeAttributes();
+
}
@@ -100,7 +105,7 @@ public abstract class AbstractJavaPersistentType
@Override
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
- this.setName(this.resourcePersistentType.getQualifiedName());
+ this.setName(this.resourceType.getQualifiedName());
this.setSpecifiedAccess_(this.buildSpecifiedAccess());
this.syncMapping();
this.synchronizeNodesWithResourceModel(this.getAttributes());
@@ -147,9 +152,9 @@ public abstract class AbstractJavaPersistentType
}
protected PersistentType buildSuperPersistentType() {
- HashSet<JavaResourcePersistentType> visited = new HashSet<JavaResourcePersistentType>();
- visited.add(this.resourcePersistentType);
- PersistentType spt = this.resolveSuperPersistentType(this.resourcePersistentType.getSuperclassQualifiedName(), visited);
+ HashSet<JavaResourceType> visited = new HashSet<JavaResourceType>();
+ visited.add(this.resourceType);
+ PersistentType spt = this.resolveSuperPersistentType(this.resourceType.getSuperclassQualifiedName(), visited);
if (spt == null) {
return null;
}
@@ -170,11 +175,11 @@ public abstract class AbstractJavaPersistentType
* stack overflow. Any cycles in the <em>context</em> type inheritance
* hierarchy are handled in {@link #buildSuperPersistentType()}.
*/
- protected PersistentType resolveSuperPersistentType(String typeName, Collection<JavaResourcePersistentType> visited) {
+ protected PersistentType resolveSuperPersistentType(String typeName, Collection<JavaResourceType> visited) {
if (typeName == null) {
return null;
}
- JavaResourcePersistentType resourceType = this.getJpaProject().getJavaResourcePersistentType(typeName);
+ JavaResourceType resourceType = (JavaResourceType) this.getJpaProject().getJavaResourceType(typeName, JavaResourceAnnotatedElement.Kind.TYPE);
if ((resourceType == null) || visited.contains(resourceType)) {
return null;
}
@@ -190,7 +195,7 @@ public abstract class AbstractJavaPersistentType
// ********** access annotation **********
protected Access2_0Annotation getAccessAnnotation() {
- return (Access2_0Annotation) this.resourcePersistentType.getNonNullAnnotation(this.getAccessAnnotationName());
+ return (Access2_0Annotation) this.resourceType.getNonNullAnnotation(this.getAccessAnnotationName());
}
protected void removeAccessAnnotationIfUnset() {
@@ -201,7 +206,7 @@ public abstract class AbstractJavaPersistentType
}
protected void removeAccessAnnotation() {
- this.resourcePersistentType.removeAnnotation(this.getAccessAnnotationName());
+ this.resourceType.removeAnnotation(this.getAccessAnnotationName());
}
protected String getAccessAnnotationName() {
@@ -261,7 +266,7 @@ public abstract class AbstractJavaPersistentType
* </ul>
*/
protected AccessType buildDefaultAccess() {
- AccessType accessType = AccessType.fromJavaResourceModel(JavaResourcePersistentType.Tools.buildAccess(this.resourcePersistentType));
+ AccessType accessType = buildAccess(this.resourceType);
if (accessType != null) {
return accessType;
}
@@ -286,7 +291,6 @@ public abstract class AbstractJavaPersistentType
return AccessType.FIELD;
}
-
// ********** mapping **********
public JavaTypeMapping getMapping() {
@@ -306,11 +310,11 @@ public abstract class AbstractJavaPersistentType
protected JavaTypeMapping buildMapping(String key) {
for (JavaTypeMappingDefinition definition : this.getMappingDefinitions()) {
if (Tools.valuesAreEqual(definition.getKey(), key)) {
- Annotation annotation = this.resourcePersistentType.setPrimaryAnnotation(definition.getAnnotationName(), definition.getSupportingAnnotationNames());
+ Annotation annotation = this.resourceType.setPrimaryAnnotation(definition.getAnnotationName(), definition.getSupportingAnnotationNames());
return definition.buildMapping(this, annotation, this.getJpaFactory());
}
}
- this.resourcePersistentType.setPrimaryAnnotation(null, EmptyIterable.<String>instance());
+ this.resourceType.setPrimaryAnnotation(null, EmptyIterable.<String>instance());
return this.buildNullMapping();
}
@@ -326,7 +330,7 @@ public abstract class AbstractJavaPersistentType
protected JavaTypeMapping buildMapping() {
for (JavaTypeMappingDefinition definition : this.getMappingDefinitions()) {
- Annotation annotation = this.resourcePersistentType.getAnnotation(definition.getAnnotationName());
+ Annotation annotation = this.resourceType.getAnnotation(definition.getAnnotationName());
if (annotation != null) {
return definition.buildMapping(this, annotation, this.getJpaFactory());
}
@@ -339,7 +343,7 @@ public abstract class AbstractJavaPersistentType
Annotation annotation = null;
for (Iterator<JavaTypeMappingDefinition> stream = this.mappingDefinitions(); stream.hasNext(); ) {
definition = stream.next();
- annotation = this.resourcePersistentType.getAnnotation(definition.getAnnotationName());
+ annotation = this.resourceType.getAnnotation(definition.getAnnotationName());
if (annotation != null) {
break;
}
@@ -377,23 +381,15 @@ public abstract class AbstractJavaPersistentType
// ********** attributes **********
- public ListIterator<JavaPersistentAttribute> attributes() {
- return this.getAttributes().iterator();
- }
-
- protected ListIterable<JavaPersistentAttribute> getAttributes() {
+ public ListIterable<JavaPersistentAttribute> getAttributes() {
return new LiveCloneListIterable<JavaPersistentAttribute>(this.attributes);
}
- public int attributesSize() {
+ public int getAttributesSize() {
return this.attributes.size();
}
- public Iterator<String> attributeNames() {
- return this.getAttributeNames().iterator();
- }
-
- protected Iterable<String> getAttributeNames() {
+ public Iterable<String> getAttributeNames() {
return this.convertToNames(this.getAttributes());
}
@@ -402,35 +398,27 @@ public abstract class AbstractJavaPersistentType
return stream.hasNext() ? stream.next() : null;
}
- public JavaPersistentAttribute getAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute) {
+ public JavaPersistentAttribute getAttributeFor(JavaResourceAttribute javaResourceAttribute) {
for (JavaPersistentAttribute javaAttribute : this.getAttributes()) {
- if (javaAttribute.getResourcePersistentAttribute() == javaResourceAttribute) {
+ if (javaAttribute.getResourceAttribute() == javaResourceAttribute) {
return javaAttribute;
}
}
return null;
}
- public Iterator<ReadOnlyPersistentAttribute> allAttributes() {
- return this.getAllAttributes().iterator();
- }
-
- protected Iterable<ReadOnlyPersistentAttribute> getAllAttributes() {
+ public Iterable<ReadOnlyPersistentAttribute> getAllAttributes() {
return new CompositeIterable<ReadOnlyPersistentAttribute>(
new TransformationIterable<PersistentType, Iterable<ReadOnlyPersistentAttribute>>(this.getInheritanceHierarchy()) {
@Override
protected Iterable<ReadOnlyPersistentAttribute> transform(PersistentType pt) {
- return new SnapshotCloneIterable<ReadOnlyPersistentAttribute>(pt.attributes());
+ return new SuperListIterableWrapper<ReadOnlyPersistentAttribute>(pt.getAttributes());
}
}
);
}
- public Iterator<String> allAttributeNames() {
- return this.getAllAttributeNames().iterator();
- }
-
- protected Iterable<String> getAllAttributeNames() {
+ public Iterable<String> getAllAttributeNames() {
return this.convertToNames(this.getAllAttributes());
}
@@ -463,26 +451,100 @@ public abstract class AbstractJavaPersistentType
};
}
- protected Iterator<JavaResourcePersistentAttribute> resourceAttributes() {
- if (this.specifiedAccess != null) {
- return this.resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(this.specifiedAccess));
+ protected JavaPersistentAttribute buildField(JavaResourceField resourceField) {
+ return getJpaFactory().buildJavaPersistentField(this, resourceField);
+ }
+
+ protected JavaPersistentAttribute buildProperty(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
+ return getJpaFactory().buildJavaPersistentProperty(this, resourceGetter, resourceSetter);
+ }
+
+ public boolean hasAnyAnnotatedAttributes() {
+ return this.resourceType.hasAnyAnnotatedFields() || this.resourceType.hasAnyAnnotatedMethods();
+ }
+
+ protected void moveAttribute(int index, JavaPersistentAttribute attribute) {
+ this.moveItemInList(index, attribute, this.attributes, ATTRIBUTES_LIST);
+ }
+
+ protected void addAttribute(int index, JavaPersistentAttribute persistentAttribute) {
+ this.addItemToList(index, persistentAttribute, this.attributes, ATTRIBUTES_LIST);
+ }
+
+ protected void removeAttribute(JavaPersistentAttribute attribute) {
+ this.removeItemFromList(attribute, this.attributes, ATTRIBUTES_LIST);
+ }
+
+ protected void initializeAttributes() {
+ if (getAccess() == AccessType.FIELD) {
+ this.intializeFieldAccessAttributes();
+ }
+ else if (getAccess() == AccessType.PROPERTY) {
+ this.intializePropertyAccessAttributes();
}
+ }
- return (this.getAccess() == AccessType.PROPERTY) ?
- this.resourcePersistentType.persistableProperties() :
- this.resourcePersistentType.persistableFields();
+ /**
+ * Initialize the attributes for AccessType.FIELD
+ * 1. all non-transient, non-static fields
+ * 2. all annotated methods (getters/setters)
+ */
+ private void intializeFieldAccessAttributes() {
+ this.initializeFieldAttributes(buildNonTransientNonStaticResourceFieldsFilter());
+ this.initializeAnnotatedPropertyAttributes();
}
- protected Iterable<JavaResourcePersistentAttribute> getResourceAttributes() {
- return CollectionTools.iterable(this.resourceAttributes());
+ private void initializeFieldAttributes(Filter<JavaResourceField> filter) {
+ for (JavaResourceField resourceField : this.getResourceFields(filter)) {
+ this.attributes.add(this.buildField(resourceField));
+ }
}
- protected JavaPersistentAttribute buildAttribute(JavaResourcePersistentAttribute resourceAttribute) {
- return this.getJpaFactory().buildJavaPersistentAttribute(this, resourceAttribute);
+ /**
+ * Initialize the attributes for XmlAccessType.PROPERTY
+ * 1. all getter/setter javabeans pairs
+ * 2. all annotated fields
+ * 3. all annotated methods getters/setters that don't have a matching pair
+ */
+ private void intializePropertyAccessAttributes() {
+ this.initializeFieldAttributes(ANNOTATED_RESOURCE_FIELDS_FILTER);
+
+ Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ //iterate through all resource methods searching for persistable getters
+ for (JavaResourceMethod getterMethod : this.getResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) {
+ JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods);
+ if (methodsArePersistableProperties(getterMethod, setterMethod)) {
+ this.attributes.add(this.buildProperty(getterMethod, setterMethod));
+ }
+ resourceMethods.remove(getterMethod);
+ resourceMethods.remove(setterMethod);
+ }
+ this.initializeRemainingResourceMethodAttributes(resourceMethods);
}
- public boolean hasAnyAnnotatedAttributes() {
- return this.resourcePersistentType.hasAnyAnnotatedAttributes();
+ private void initializeAnnotatedPropertyAttributes() {
+ Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ //iterate through all resource methods searching for persistable getters
+ for (JavaResourceMethod getterMethod : this.getResourceMethods(buildPersistablePropertyGetterMethodsFilter())) {
+ JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods);
+ if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) {
+ this.attributes.add(this.buildProperty(getterMethod, setterMethod));
+ }
+ resourceMethods.remove(getterMethod);
+ resourceMethods.remove(setterMethod);
+ }
+ this.initializeRemainingResourceMethodAttributes(resourceMethods);
+ }
+
+ private void initializeRemainingResourceMethodAttributes(Collection<JavaResourceMethod> resourceMethods) {
+ //iterate through remaining resource methods and search for those that are annotated.
+ //all getter methods will already be used.
+ for (JavaResourceMethod resourceMethod : resourceMethods) {
+ if (resourceMethod.isAnnotated()) {
+ //annotated setter(or other random method) with no corresponding getter, bring into context model for validation purposes
+ this.attributes.add(this.buildProperty(null, resourceMethod));
+ }
+ }
}
/**
@@ -491,45 +553,319 @@ public abstract class AbstractJavaPersistentType
* which can be controlled in a number of different places....
*/
protected void updateAttributes() {
- ContextContainerTools.update(this.attributeContainerAdapter);
+ if (getAccess() == AccessType.FIELD) {
+ this.syncFieldAccessAttributes();
+ }
+ else if (getAccess() == AccessType.PROPERTY) {
+ this.syncPropertyAccessAttributes();
+ }
}
- protected void moveAttribute(int index, JavaPersistentAttribute attribute) {
- this.moveItemInList(index, attribute, this.attributes, ATTRIBUTES_LIST);
+ /**
+ * Initialize the attributes for AccessType.FIELD
+ * 1. all non-transient, non-static fields
+ * 2. all annotated methods(getters/setters)
+ */
+ private void syncFieldAccessAttributes() {
+ HashSet<JavaPersistentAttribute> contextAttributes = CollectionTools.set(this.getAttributes());
+
+ this.syncFieldAttributes(contextAttributes, this.buildNonTransientNonStaticResourceFieldsFilter());
+ this.syncAnnotatedPropertyAttributes(contextAttributes);
}
- protected void addAttribute(int index, JavaResourcePersistentAttribute resourceAttribute) {
- this.addItemToList(index, this.buildAttribute(resourceAttribute), this.attributes, ATTRIBUTES_LIST);
+ /**
+ * Initialize the attributes for XmlAccessType.PROPERTY
+ * 1. all getter/setter javabeans pairs
+ * 2. all annotated fields
+ * 3. all annotated methods getters/setters that don't have a matching pair
+ */
+ private void syncPropertyAccessAttributes() {
+ HashSet<JavaPersistentAttribute> contextAttributes = CollectionTools.set(this.getAttributes());
+
+ this.syncFieldAttributes(contextAttributes, ANNOTATED_RESOURCE_FIELDS_FILTER);
+
+ Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ //iterate through all resource methods searching for persistable getters
+ for (JavaResourceMethod getterMethod : this.getResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) {
+ JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods);
+ if (methodsArePersistableProperties(getterMethod, setterMethod)) {
+ boolean match = false;
+ for (Iterator<JavaPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
+ JavaPersistentAttribute contextAttribute = stream.next();
+ if (contextAttribute.isFor(getterMethod, setterMethod)) {
+ match = true;
+ contextAttribute.update();
+ stream.remove();
+ break;
+ }
+ }
+ if (!match) {
+ this.addAttribute(getAttributesSize(), this.buildProperty(getterMethod, setterMethod));
+ }
+ }
+ resourceMethods.remove(getterMethod);
+ resourceMethods.remove(setterMethod);
+ }
+ this.syncRemainingResourceMethods(contextAttributes, resourceMethods);
+ }
+
+ private void syncAnnotatedPropertyAttributes(HashSet<JavaPersistentAttribute> contextAttributes) {
+ Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getResourceMethods());
+ //iterate through all resource methods searching for persistable getters
+ for (JavaResourceMethod getterMethod : this.getResourceMethods(buildPersistablePropertyGetterMethodsFilter())) {
+ JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods);
+ if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) {
+ boolean match = false;
+ for (Iterator<JavaPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
+ JavaPersistentAttribute contextAttribute = stream.next();
+ if (contextAttribute.isFor(getterMethod, setterMethod)) {
+ match = true;
+ contextAttribute.update();
+ stream.remove();
+ break;
+ }
+ }
+ if (!match) {
+ this.addAttribute(getAttributesSize(), this.buildProperty(getterMethod, setterMethod));
+ }
+ }
+ resourceMethods.remove(getterMethod);
+ resourceMethods.remove(setterMethod);
+ }
+ this.syncRemainingResourceMethods(contextAttributes, resourceMethods);
+ }
+
+ private void syncFieldAttributes(HashSet<JavaPersistentAttribute> contextAttributes, Filter<JavaResourceField> filter) {
+ for (JavaResourceField resourceField : this.getResourceFields(filter)) {
+ boolean match = false;
+ for (Iterator<JavaPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext(); ) {
+ JavaPersistentAttribute contextAttribute = stream.next();
+ if (contextAttribute.isFor(resourceField)) {
+ match = true;
+ contextAttribute.update();
+ stream.remove();
+ break;
+ }
+ }
+ if (!match) {
+ // added elements are sync'ed during construction or will be
+ // updated during the next "update" (which is triggered by
+ // their addition to the model)
+ this.addAttribute(this.getAttributesSize(), this.buildField(resourceField));
+ }
+ }
}
- protected void removeAttribute(JavaPersistentAttribute attribute) {
- this.removeItemFromList(attribute, this.attributes, ATTRIBUTES_LIST);
+ private void syncRemainingResourceMethods(HashSet<JavaPersistentAttribute> contextAttributes, Collection<JavaResourceMethod> resourceMethods) {
+ //iterate through remaining resource methods and search for those that are annotated.
+ //all getter methods will already be used.
+ for (JavaResourceMethod resourceMethod : resourceMethods) {
+ if (resourceMethod.isAnnotated()) {
+ boolean match = false;
+ //annotated setter(or other random method) with no corresponding getter, bring into context model for validation purposes
+ for (Iterator<JavaPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
+ JavaPersistentAttribute contextAttribute = stream.next();
+ if (contextAttribute.isFor(null, resourceMethod)) {
+ match = true;
+ contextAttribute.update();
+ stream.remove();
+ break;
+ }
+ }
+ if (!match) {
+ this.addAttribute(getAttributesSize(), this.buildProperty(null, resourceMethod));
+ }
+ }
+ }
+
+ // remove any leftover context attributes
+ for (JavaPersistentAttribute contextAttribute : contextAttributes) {
+ this.removeAttribute(contextAttribute);
+ }
+ }
+
+
+ protected Iterable<JavaResourceField> getResourceFields() {
+ return this.resourceType.getFields();
+ }
+
+ protected Iterable<JavaResourceMethod> getResourceMethods() {
+ return this.resourceType.getMethods();
+ }
+
+ protected Iterable<JavaResourceField> getResourceFields(Filter<JavaResourceField> filter) {
+ return new FilteringIterable<JavaResourceField>(getResourceFields(), filter);
+ }
+
+ protected Iterable<JavaResourceMethod> getResourceMethods(Filter<JavaResourceMethod> filter) {
+ return new FilteringIterable<JavaResourceMethod>(getResourceMethods(), filter);
+ }
+
+ public static Filter<JavaResourceField> buildNonTransientNonStaticResourceFieldsFilter() {
+ return new Filter<JavaResourceField>() {
+ public boolean accept(JavaResourceField resourceField) {
+ return memberIsNonTransientNonStatic(resourceField) || resourceField.isAnnotated();
+ }
+ };
+ }
+
+ protected static boolean memberIsNonTransientNonStatic(JavaResourceMember resourceMember) {
+ return !resourceMember.isTransient() && !resourceMember.isStatic();
+ }
+
+ public static Filter<JavaResourceField> ANNOTATED_RESOURCE_FIELDS_FILTER =
+ new Filter<JavaResourceField>() {
+ public boolean accept(JavaResourceField resourceField) {
+ return resourceField.isAnnotated();
+ }
+ };
+
+ protected Filter<JavaResourceMethod> buildPersistablePropertyGetterMethodsFilter() {
+ return new Filter<JavaResourceMethod>() {
+ public boolean accept(JavaResourceMethod resourceMethod) {
+ return methodIsPersistablePropertyGetter(resourceMethod, getResourceMethods());
+ }
+ };
}
/**
- * attribute container adapter
+ * Return whether the specified method is a "getter" method that
+ * represents a property that may be "persisted".
*/
- protected class AttributeContainerAdapter
- implements ContextContainerTools.Adapter<JavaPersistentAttribute, JavaResourcePersistentAttribute>
- {
- public Iterable<JavaPersistentAttribute> getContextElements() {
- return AbstractJavaPersistentType.this.getAttributes();
+ public static boolean methodIsPersistablePropertyGetter(JavaResourceMethod resourceMethod, Iterable<JavaResourceMethod> allMethods) {
+ if (methodHasInvalidModifiers(resourceMethod)) {
+ return false;
}
- public Iterable<JavaResourcePersistentAttribute> getResourceElements() {
- return AbstractJavaPersistentType.this.getResourceAttributes();
+ if (resourceMethod.isConstructor()) {
+ return false;
}
- public JavaResourcePersistentAttribute getResourceElement(JavaPersistentAttribute contextElement) {
- return contextElement.getResourcePersistentAttribute();
+
+ String returnTypeName = resourceMethod.getTypeName();
+ if (returnTypeName == null) {
+ return false; // DOM method bindings can have a null name
}
- public void moveContextElement(int index, JavaPersistentAttribute element) {
- AbstractJavaPersistentType.this.moveAttribute(index, element);
+ if (returnTypeName.equals("void")) { //$NON-NLS-1$
+ return false;
}
- public void addContextElement(int index, JavaResourcePersistentAttribute resourceElement) {
- AbstractJavaPersistentType.this.addAttribute(index, resourceElement);
+ if (methodHasParameters(resourceMethod)) {
+ return false;
}
- public void removeContextElement(JavaPersistentAttribute element) {
- AbstractJavaPersistentType.this.removeAttribute(element);
+
+ boolean booleanGetter = methodIsBooleanGetter(resourceMethod);
+
+ // if the type has both methods:
+ // boolean isProperty()
+ // boolean getProperty()
+ // then #isProperty() takes precedence and we ignore #getProperty();
+ // but only having #getProperty() is OK too
+ // (see the JavaBeans spec 1.01)
+ if (booleanGetter && methodHasValidSiblingIsMethod(resourceMethod, allMethods)) {
+ return false; // since the type also defines #isProperty(), ignore #getProperty()
}
+ return true;
+ }
+
+ private static boolean methodIsBooleanGetter(JavaResourceMethod resourceMethod) {
+ String returnTypeName = resourceMethod.getTypeName();
+ String name = resourceMethod.getMethodName();
+ boolean booleanGetter = false;
+ if (name.startsWith("is")) { //$NON-NLS-1$
+ if (returnTypeName.equals("boolean")) { //$NON-NLS-1$
+ } else {
+ return false;
+ }
+ } else if (name.startsWith("get")) { //$NON-NLS-1$
+ if (returnTypeName.equals("boolean")) { //$NON-NLS-1$
+ booleanGetter = true;
+ }
+ } else {
+ return false;
+ }
+ return booleanGetter;
+ }
+
+ /**
+ * Return whether the method's modifiers prevent it
+ * from being a getter or setter for a "persistent" property.
+ */
+ private static boolean methodHasInvalidModifiers(JavaResourceMethod resourceMethod) {
+ int modifiers = resourceMethod.getModifiers();
+ if (Modifier.isStatic(modifiers)) {
+ return true;
+ }
+ return false;
+ }
+
+ private static boolean methodHasParameters(JavaResourceMethod resourceMethod) {
+ return resourceMethod.getParametersSize() != 0;
+ }
+
+ /**
+ * Return whether the method has a sibling "is" method for the specified
+ * property and that method is valid for a "persistable" property.
+ * Pre-condition: the method is a "boolean getter" (e.g. 'public boolean getProperty()');
+ * this prevents us from returning true when the method itself is an
+ * "is" method.
+ */
+ private static boolean methodHasValidSiblingIsMethod(JavaResourceMethod getMethod, Iterable<JavaResourceMethod> resourceMethods) {
+ String capitalizedAttributeName = StringTools.capitalize(getMethod.getName());
+ for (JavaResourceMethod sibling : resourceMethods) {
+ if ((sibling.getParametersSize() == 0)
+ && sibling.getMethodName().equals("is" + capitalizedAttributeName)) { //$NON-NLS-1$
+ return methodIsValidSibling(sibling, "boolean"); //$NON-NLS-1$
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return whether the method has a sibling "set" method
+ * and that method is valid for a "persistable" property.
+ */
+ public static JavaResourceMethod getValidSiblingSetMethod(JavaResourceMethod getMethod, Iterable<JavaResourceMethod> resourceMethods) {
+ String capitalizedAttributeName = StringTools.capitalize(getMethod.getName());
+ String parameterTypeErasureName = getMethod.getTypeName();
+ for (JavaResourceMethod sibling : resourceMethods) {
+ ListIterable<String> siblingParmTypeNames = sibling.getParameterTypeNames();
+ if ((sibling.getParametersSize() == 1)
+ && sibling.getMethodName().equals("set" + capitalizedAttributeName) //$NON-NLS-1$
+ && siblingParmTypeNames.iterator().next().equals(parameterTypeErasureName)) {
+ return methodIsValidSibling(sibling, "void") ? sibling : null; //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return whether the specified method is a valid sibling with the
+ * specified return type.
+ */
+ private static boolean methodIsValidSibling(JavaResourceMethod resourceMethod, String returnTypeName) {
+ if (resourceMethod == null) {
+ return false;
+ }
+ if (methodHasInvalidModifiers(resourceMethod)) {
+ return false;
+ }
+ if (resourceMethod.isConstructor()) {
+ return false;
+ }
+ String rtName = resourceMethod.getTypeName();
+ if (rtName == null) {
+ return false; // DOM method bindings can have a null name
+ }
+ return rtName.equals(returnTypeName);
+ }
+
+ public static boolean methodsArePersistableProperties(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) {
+ if (setterMethod != null) {
+ return true;
+ }
+ else if (getterMethod.isAnnotated()) {
+ //annotated getter with no corresponding setter, bring into context model for validation purposes
+ return true;
+ }
+ return false;
}
@@ -585,7 +921,7 @@ public abstract class AbstractJavaPersistentType
}
protected boolean contains(int offset, CompilationUnit astRoot) {
- TextRange fullTextRange = this.resourcePersistentType.getTextRange(astRoot);
+ TextRange fullTextRange = this.resourceType.getTextRange(astRoot);
// 'fullTextRange' will be null if the type no longer exists in the java;
// the context model can be out of synch with the resource model
// when a selection event occurs before the context model has a
@@ -598,7 +934,7 @@ public abstract class AbstractJavaPersistentType
}
protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.resourcePersistentType.getNameTextRange(astRoot);
+ return this.resourceType.getNameTextRange(astRoot);
}
public void dispose() {
@@ -654,12 +990,12 @@ public abstract class AbstractJavaPersistentType
// TODO temporary hack since we don't know yet where to put
// any messages for types in another project (e.g. referenced by
// persistence.xml)
- IFile file = this.resourcePersistentType.getFile();
+ IFile file = this.resourceType.getFile();
// 'file' will be null if the type is "external" and binary;
// the file will be in a different project if the type is "external" and source;
// the type will be binary if it is in a JAR in the current project
if ((file != null) && file.getProject().equals(this.getJpaProject().getProject()) &&
- (this.resourcePersistentType instanceof SourceNode)) {
+ (this.resourceType instanceof SourceNode)) {
// build the AST root here to pass down
this.validate(messages, reporter, this.buildASTRoot());
}
@@ -712,11 +1048,11 @@ public abstract class AbstractJavaPersistentType
@Override
public IResource getResource() {
- return this.resourcePersistentType.getFile();
+ return this.resourceType.getFile();
}
- public JavaResourcePersistentType getResourcePersistentType() {
- return this.resourcePersistentType;
+ public JavaResourceType getJavaResourceType() {
+ return this.resourceType;
}
public AccessType getOwnerOverrideAccess() {
@@ -728,11 +1064,11 @@ public abstract class AbstractJavaPersistentType
}
protected CompilationUnit buildASTRoot() {
- return this.resourcePersistentType.getJavaResourceCompilationUnit().buildASTRoot();
+ return this.resourceType.getJavaResourceCompilationUnit().buildASTRoot();
}
protected JpaFile getJpaFile() {
- return this.getJpaFile(this.resourcePersistentType.getFile());
+ return this.getJpaFile(this.resourceType.getFile());
}
public boolean isFor(String typeName) {
@@ -744,11 +1080,45 @@ public abstract class AbstractJavaPersistentType
}
protected String getPackageName() {
- return this.getResourcePersistentType().getPackageName();
+ return this.getJavaResourceType().getPackageName();
}
@Override
public void toString(StringBuilder sb) {
sb.append(this.name);
}
+
+
+ // ********** Access type **********
+
+ /**
+ * Return the access type currently implied by the specified Java source
+ * code or class file:<ul>
+ * <li>if any fields are annotated =>
+ * {@link AccessType#FIELD FIELD}
+ * <li>if only properties are annotated =>
+ * {@link AccessType#PROPERTY PROPERTY}
+ * <li>if neither are annotated =>
+ * <code>null</code>
+ *
+ * </ul>
+ */
+ public static AccessType buildAccess(JavaResourceType jrType) {
+ for (JavaResourceField field : jrType.getFields()) {
+ if (field.isAnnotated()) {
+ // any field is annotated => FIELD
+ return AccessType.FIELD;
+ }
+ }
+
+ for (JavaResourceMethod method : jrType.getMethods()) {
+ if (method.isAnnotated()) {
+ // none of the fields are annotated and any method is annotated => PROPERTY
+ return AccessType.PROPERTY;
+ }
+ }
+
+ // nothing is annotated
+ return null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java
index 47fbf2d288..d1d20d4e7e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java
@@ -9,21 +9,16 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.java;
-import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.context.Query;
import org.eclipse.jpt.jpa.core.context.QueryHint;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
@@ -45,8 +40,7 @@ public abstract class AbstractJavaQuery<A extends QueryAnnotation>
protected String query;
- protected final Vector<JavaQueryHint> hints = new Vector<JavaQueryHint>();
- protected final HintContainerAdapter hintContainerAdapter = new HintContainerAdapter();
+ protected final ContextListContainer<JavaQueryHint, QueryHintAnnotation> queryHintContainer;
protected AbstractJavaQuery(JavaJpaContextNode parent, A queryAnnotation) {
@@ -54,7 +48,7 @@ public abstract class AbstractJavaQuery<A extends QueryAnnotation>
this.queryAnnotation = queryAnnotation;
this.name = queryAnnotation.getName();
this.query = queryAnnotation.getQuery();
- this.initializeHints();
+ this.queryHintContainer = this.buildHintContainer();
}
@@ -114,44 +108,34 @@ public abstract class AbstractJavaQuery<A extends QueryAnnotation>
// ********** hints **********
public ListIterable<JavaQueryHint> getHints() {
- return new LiveCloneListIterable<JavaQueryHint>(this.hints);
+ return this.queryHintContainer.getContextElements();
}
public int getHintsSize() {
- return this.hints.size();
+ return this.queryHintContainer.getContextElementsSize();
}
public JavaQueryHint addHint() {
- return this.addHint(this.hints.size());
+ return this.addHint(this.getHintsSize());
}
public JavaQueryHint addHint(int index) {
QueryHintAnnotation annotation = this.queryAnnotation.addHint(index);
- return this.addHint_(index, annotation);
+ return this.queryHintContainer.addContextElement(index, annotation);
}
public void removeHint(QueryHint hint) {
- this.removeHint(this.hints.indexOf(hint));
+ this.removeHint(this.queryHintContainer.indexOfContextElement((JavaQueryHint) hint));
}
public void removeHint(int index) {
this.queryAnnotation.removeHint(index);
- this.removeHint_(index);
- }
-
- protected void removeHint_(int index) {
- this.removeItemFromList(index, this.hints, HINTS_LIST);
+ this.queryHintContainer.removeContextElement(index);
}
public void moveHint(int targetIndex, int sourceIndex) {
this.queryAnnotation.moveHint(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.hints, HINTS_LIST);
- }
-
- protected void initializeHints() {
- for (Iterator<QueryHintAnnotation> stream = this.queryAnnotation.hints(); stream.hasNext(); ) {
- this.hints.add(this.buildHint(stream.next()));
- }
+ this.queryHintContainer.moveContextElement(targetIndex, sourceIndex);
}
protected JavaQueryHint buildHint(QueryHintAnnotation hintAnnotation) {
@@ -159,51 +143,43 @@ public abstract class AbstractJavaQuery<A extends QueryAnnotation>
}
protected void syncHints() {
- ContextContainerTools.synchronizeWithResourceModel(this.hintContainerAdapter);
+ this.queryHintContainer.synchronizeWithResourceModel();
}
- protected Iterable<QueryHintAnnotation> getHintAnnotations() {
- return CollectionTools.iterable(this.queryAnnotation.hints());
+ protected void updateHints() {
+ this.queryHintContainer.update();
}
- protected void moveHint_(int index, JavaQueryHint hint) {
- this.moveItemInList(index, hint, this.hints, HINTS_LIST);
+ protected ListIterable<QueryHintAnnotation> getHintAnnotations() {
+ return this.queryAnnotation.getHints();
}
- protected JavaQueryHint addHint_(int index, QueryHintAnnotation hintAnnotation) {
- JavaQueryHint hint = this.buildHint(hintAnnotation);
- this.addItemToList(index, hint, this.hints, HINTS_LIST);
- return hint;
- }
-
- protected void removeHint_(JavaQueryHint hint) {
- this.removeHint_(this.hints.indexOf(hint));
+ protected ContextListContainer<JavaQueryHint, QueryHintAnnotation> buildHintContainer() {
+ return new HintContainer();
}
/**
- * hint container adapter
+ * query hint container
*/
- protected class HintContainerAdapter
- implements ContextContainerTools.Adapter<JavaQueryHint, QueryHintAnnotation>
+ protected class HintContainer
+ extends ContextListContainer<JavaQueryHint, QueryHintAnnotation>
{
- public Iterable<JavaQueryHint> getContextElements() {
- return AbstractJavaQuery.this.getHints();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return HINTS_LIST;
+ }
+ @Override
+ protected JavaQueryHint buildContextElement(QueryHintAnnotation resourceElement) {
+ return AbstractJavaQuery.this.buildHint(resourceElement);
}
- public Iterable<QueryHintAnnotation> getResourceElements() {
+ @Override
+ protected ListIterable<QueryHintAnnotation> getResourceElements() {
return AbstractJavaQuery.this.getHintAnnotations();
}
- public QueryHintAnnotation getResourceElement(JavaQueryHint contextElement) {
+ @Override
+ protected QueryHintAnnotation getResourceElement(JavaQueryHint contextElement) {
return contextElement.getQueryHintAnnotation();
}
- public void moveContextElement(int index, JavaQueryHint element) {
- AbstractJavaQuery.this.moveHint_(index, element);
- }
- public void addContextElement(int index, QueryHintAnnotation resourceElement) {
- AbstractJavaQuery.this.addHint_(index, resourceElement);
- }
- public void removeContextElement(JavaQueryHint element) {
- AbstractJavaQuery.this.removeHint_(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
index 77afa0ebf6..19d80b6abb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
@@ -14,7 +14,6 @@ import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
@@ -238,7 +237,7 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
if (entity == null) {
return null;
}
- for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(entity.getPersistentType().allAttributes())) {
+ for (ReadOnlyPersistentAttribute attribute : entity.getPersistentType().getAllAttributes()) {
AttributeMapping mapping = attribute.getMapping();
if (this.isOwnedBy(mapping)) {
return (RelationshipMapping) mapping;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java
index ced9446238..36f512874d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java
@@ -11,18 +11,14 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NameTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
@@ -30,7 +26,6 @@ import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaTable;
import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
@@ -69,8 +64,7 @@ public abstract class AbstractJavaTable<A extends BaseTableAnnotation>
protected String specifiedCatalog;
protected String defaultCatalog;
- protected final Vector<JavaUniqueConstraint> uniqueConstraints = new Vector<JavaUniqueConstraint>();
- protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+ protected final ContextListContainer<JavaUniqueConstraint, UniqueConstraintAnnotation> uniqueConstraintContainer;
protected AbstractJavaTable(JavaJpaContextNode parent, Owner owner) {
@@ -84,7 +78,7 @@ public abstract class AbstractJavaTable<A extends BaseTableAnnotation>
this.specifiedName = this.buildSpecifiedName();
this.specifiedSchema = this.buildSpecifiedSchema();
this.specifiedCatalog = this.buildSpecifiedCatalog();
- this.initializeUniqueConstraints();
+ this.uniqueConstraintContainer = this.buildUniqueConstraintContainer();
}
@@ -264,107 +258,83 @@ public abstract class AbstractJavaTable<A extends BaseTableAnnotation>
// ********** unique constraints **********
-
- public ListIterator<JavaUniqueConstraint> uniqueConstraints() {
- return this.getUniqueConstraints().iterator();
- }
-
- protected ListIterable<JavaUniqueConstraint> getUniqueConstraints() {
- return new LiveCloneListIterable<JavaUniqueConstraint>(this.uniqueConstraints);
+ public ListIterable<JavaUniqueConstraint> getUniqueConstraints() {
+ return this.uniqueConstraintContainer.getContextElements();
}
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
+ public int getUniqueConstraintsSize() {
+ return this.uniqueConstraintContainer.getContextElementsSize();
}
public JavaUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraints.get(index);
+ return this.uniqueConstraintContainer.getContextElement(index);
}
public JavaUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.uniqueConstraints.size());
+ return this.addUniqueConstraint(this.getUniqueConstraintsSize());
}
public JavaUniqueConstraint addUniqueConstraint(int index) {
UniqueConstraintAnnotation annotation = this.getTableAnnotation().addUniqueConstraint(index);
- return this.addUniqueConstraint_(index, annotation);
- }
-
- public void removeUniqueConstraint(UniqueConstraint constraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(constraint));
+ return this.uniqueConstraintContainer.addContextElement(index, annotation);
}
public void removeUniqueConstraint(int index) {
this.getTableAnnotation().removeUniqueConstraint(index);
- this.removeTableAnnotationIfUnset();
- this.removeUniqueConstraint_(index);
+ this.uniqueConstraintContainer.removeContextElement(index);
}
- protected void removeUniqueConstraint_(int index) {
- this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ this.removeUniqueConstraint(this.uniqueConstraintContainer.indexOfContextElement((JavaUniqueConstraint) uniqueConstraint));
}
public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
this.getTableAnnotation().moveUniqueConstraint(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected void initializeUniqueConstraints() {
- for (Iterator<UniqueConstraintAnnotation> stream = this.getTableAnnotation().uniqueConstraints(); stream.hasNext(); ) {
- this.uniqueConstraints.add(this.buildUniqueConstraint(stream.next()));
- }
- }
-
- protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) {
- return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation);
+ this.uniqueConstraintContainer.moveContextElement(targetIndex, sourceIndex);
}
protected void syncUniqueConstraints() {
- ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
+ this.uniqueConstraintContainer.synchronizeWithResourceModel();
}
- protected Iterable<UniqueConstraintAnnotation> getUniqueConstraintAnnotations() {
- return CollectionTools.iterable(this.getTableAnnotation().uniqueConstraints());
+ protected void updateUniqueConstraints() {
+ this.uniqueConstraintContainer.update();
}
- protected void moveUniqueConstraint_(int index, JavaUniqueConstraint constraint) {
- this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) {
+ return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation);
}
- protected JavaUniqueConstraint addUniqueConstraint_(int index, UniqueConstraintAnnotation constraintAnnotation) {
- JavaUniqueConstraint constraint = this.buildUniqueConstraint(constraintAnnotation);
- this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- return constraint;
+ protected ListIterable<UniqueConstraintAnnotation> getUniqueConstraintAnnotations() {
+ return this.getTableAnnotation().getUniqueConstraints();
}
- protected void removeUniqueConstraint_(JavaUniqueConstraint constraint) {
- this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(constraint));
+ protected ContextListContainer<JavaUniqueConstraint, UniqueConstraintAnnotation> buildUniqueConstraintContainer() {
+ return new UniqueConstraintContainer();
}
/**
- * unique constraint container adapter
+ * unique constraint container
*/
- protected class UniqueConstraintContainerAdapter
- implements ContextContainerTools.Adapter<JavaUniqueConstraint, UniqueConstraintAnnotation>
+ protected class UniqueConstraintContainer
+ extends ContextListContainer<JavaUniqueConstraint, UniqueConstraintAnnotation>
{
- public Iterable<JavaUniqueConstraint> getContextElements() {
- return AbstractJavaTable.this.getUniqueConstraints();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return UNIQUE_CONSTRAINTS_LIST;
}
- public Iterable<UniqueConstraintAnnotation> getResourceElements() {
+ @Override
+ protected JavaUniqueConstraint buildContextElement(UniqueConstraintAnnotation resourceElement) {
+ return AbstractJavaTable.this.buildUniqueConstraint(resourceElement);
+ }
+ @Override
+ protected ListIterable<UniqueConstraintAnnotation> getResourceElements() {
return AbstractJavaTable.this.getUniqueConstraintAnnotations();
}
- public UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) {
+ @Override
+ protected UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) {
return contextElement.getUniqueConstraintAnnotation();
}
- public void moveContextElement(int index, JavaUniqueConstraint element) {
- AbstractJavaTable.this.moveUniqueConstraint_(index, element);
- }
- public void addContextElement(int index, UniqueConstraintAnnotation resourceElement) {
- AbstractJavaTable.this.addUniqueConstraint_(index, resourceElement);
- }
- public void removeContextElement(JavaUniqueConstraint element) {
- AbstractJavaTable.this.removeUniqueConstraint_(element);
- }
}
@@ -433,7 +403,7 @@ public abstract class AbstractJavaTable<A extends BaseTableAnnotation>
if (result != null) {
return result;
}
- for (JavaUniqueConstraint constraint : CollectionTools.iterable(this.uniqueConstraints())) {
+ for (JavaUniqueConstraint constraint : this.getUniqueConstraints()) {
result = constraint.javaCompletionProposals(pos, filter, astRoot);
if (result != null) {
return result;
@@ -560,7 +530,7 @@ public abstract class AbstractJavaTable<A extends BaseTableAnnotation>
this.setSpecifiedName(oldTable.getSpecifiedName());
this.setSpecifiedCatalog(oldTable.getSpecifiedCatalog());
this.setSpecifiedSchema(oldTable.getSpecifiedSchema());
- for (ReadOnlyUniqueConstraint constraint : CollectionTools.iterable(oldTable.uniqueConstraints())) {
+ for (ReadOnlyUniqueConstraint constraint : oldTable.getUniqueConstraints()) {
this.addUniqueConstraint().initializeFrom(constraint);
}
}
@@ -578,4 +548,7 @@ public abstract class AbstractJavaTable<A extends BaseTableAnnotation>
protected String buildQualifiedName() {
return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
}
+
+
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java
index 10d2ba19a0..e50ca4a733 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java
@@ -12,6 +12,8 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NotNullFilter;
@@ -36,8 +38,6 @@ import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -70,8 +70,8 @@ public abstract class AbstractJavaTypeMapping<A extends Annotation>
return this.getParent();
}
- public JavaResourcePersistentType getResourcePersistentType() {
- return this.getPersistentType().getResourcePersistentType();
+ public JavaResourceType getJavaResourceType() {
+ return this.getPersistentType().getJavaResourceType();
}
public String getName() {
@@ -165,7 +165,7 @@ public abstract class AbstractJavaTypeMapping<A extends Annotation>
// ********** attribute mappings **********
public Iterator<JavaAttributeMapping> attributeMappings() {
- return new TransformationIterator<JavaPersistentAttribute, JavaAttributeMapping>(this.getPersistentType().attributes()) {
+ return new TransformationIterator<JavaPersistentAttribute, JavaAttributeMapping>(this.getPersistentType().getAttributes()) {
@Override
protected JavaAttributeMapping transform(JavaPersistentAttribute attribute) {
return attribute.getMapping();
@@ -279,7 +279,7 @@ public abstract class AbstractJavaTypeMapping<A extends Annotation>
}
protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) {
- return new GenericTypeMappingValidator(this, this.getResourcePersistentType(), buildTextRangeResolver(astRoot));
+ return new GenericTypeMappingValidator(this, this.getJavaResourceType(), buildTextRangeResolver(astRoot));
}
protected TypeMappingTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java
index 062b3dc591..0ca7807a09 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java
@@ -12,6 +12,8 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.Association;
@@ -35,9 +37,7 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -130,7 +130,7 @@ public abstract class AbstractJavaVersionMapping
* <code>null</code>, remove <em>all</em> the converter annotations.
*/
protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
- JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
if (adapter != converterAdapter) {
adapter.removeConverterAnnotation(resourceAttribute);
@@ -172,7 +172,7 @@ public abstract class AbstractJavaVersionMapping
* adapter. Return <code>null</code> if there are no converter annotations.
*/
protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() {
- JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
if (annotation != null) {
@@ -221,11 +221,11 @@ public abstract class AbstractJavaVersionMapping
// ********** JavaColumn.Owner implementation **********
public ColumnAnnotation getColumnAnnotation() {
- return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ return (ColumnAnnotation) this.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
public void removeColumnAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
public String getDefaultColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
index a5396070c7..f351c8be5c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
@@ -10,21 +10,18 @@
package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
+import org.eclipse.jpt.jpa.core.context.JoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
import org.eclipse.jpt.jpa.core.context.VirtualReferenceTable;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -32,15 +29,15 @@ public abstract class AbstractJavaVirtualReferenceTable<T extends ReadOnlyRefere
extends AbstractJavaVirtualTable<T>
implements VirtualReferenceTable
{
- protected final Vector<JavaVirtualJoinColumn> specifiedJoinColumns = new Vector<JavaVirtualJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
+ protected final ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn> specifiedJoinColumnContainer;
protected final JavaReadOnlyJoinColumn.Owner joinColumnOwner;
protected JavaVirtualJoinColumn defaultJoinColumn;
- protected AbstractJavaVirtualReferenceTable(JavaJpaContextNode parent, Owner owner) {
- super(parent, owner);
+ protected AbstractJavaVirtualReferenceTable(JavaJpaContextNode parent, Owner owner, T overridenTable) {
+ super(parent, owner, overridenTable);
+ this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
this.joinColumnOwner = this.buildJoinColumnOwner();
}
@@ -57,87 +54,79 @@ public abstract class AbstractJavaVirtualReferenceTable<T extends ReadOnlyRefere
// ********** join columns **********
- public ListIterator<JavaVirtualJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<JavaVirtualJoinColumn> getJoinColumns() {
+ public ListIterable<JavaVirtualJoinColumn> getJoinColumns() {
return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
}
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
}
// ********** specified join columns **********
- public ListIterator<JavaVirtualJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
+ public ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns() {
+ return this.specifiedJoinColumnContainer.getContextElements();
}
- protected ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<JavaVirtualJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
+ public int getSpecifiedJoinColumnsSize() {
+ return this.specifiedJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
+ return this.getSpecifiedJoinColumnsSize() != 0;
}
public JavaVirtualJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
+ return this.specifiedJoinColumnContainer.getContextElement(index);
}
protected void updateSpecifiedJoinColumns() {
- ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter);
+ this.specifiedJoinColumnContainer.update();
}
- protected Iterable<ReadOnlyJoinColumn> getOverriddenJoinColumns() {
- return CollectionTools.iterable(this.getOverriddenTable().specifiedJoinColumns());
+ protected ListIterable<ReadOnlyJoinColumn> getOverriddenJoinColumns() {
+ return new SuperListIterableWrapper<ReadOnlyJoinColumn>(this.getOverriddenTable().getSpecifiedJoinColumns());
}
protected void moveSpecifiedJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.moveContextElement(index, joinColumn);
}
- protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- JavaVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn);
- this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return virtualJoinColumn;
+ protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) {
+ return this.specifiedJoinColumnContainer.addContextElement(index, joinColumn);
}
protected void removeSpecifiedJoinColumn(JavaVirtualJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.removeContextElement(joinColumn);
+ }
+
+ protected ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedJoinColumnContainer() {
+ return new SpecifiedJoinColumnContainer();
}
/**
- * specified join column container adapter
+ * specified join column container
*/
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
+ protected class SpecifiedJoinColumnContainer
+ extends ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
{
- public Iterable<JavaVirtualJoinColumn> getContextElements() {
- return AbstractJavaVirtualReferenceTable.this.getSpecifiedJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected JavaVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
+ return AbstractJavaVirtualReferenceTable.this.buildJoinColumn(resourceElement);
}
- public Iterable<ReadOnlyJoinColumn> getResourceElements() {
+ @Override
+ protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
return AbstractJavaVirtualReferenceTable.this.getOverriddenJoinColumns();
}
- public ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
+ @Override
+ protected ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
return contextElement.getOverriddenColumn();
}
- public void moveContextElement(int index, JavaVirtualJoinColumn element) {
- AbstractJavaVirtualReferenceTable.this.moveSpecifiedJoinColumn(index, element);
- }
- public void addContextElement(int index, ReadOnlyJoinColumn element) {
- AbstractJavaVirtualReferenceTable.this.addSpecifiedJoinColumn(index, element);
- }
- public void removeContextElement(JavaVirtualJoinColumn element) {
- AbstractJavaVirtualReferenceTable.this.removeSpecifiedJoinColumn(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java
index ad603db012..3adde36a20 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java
@@ -10,21 +10,17 @@
package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NameTools;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
import org.eclipse.jpt.jpa.core.context.VirtualTable;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
import org.eclipse.jpt.jpa.db.Catalog;
@@ -39,6 +35,8 @@ public abstract class AbstractJavaVirtualTable<T extends ReadOnlyTable>
{
protected final Owner owner;
+ protected final T overriddenTable;
+
protected String specifiedName;
protected String defaultName;
@@ -48,13 +46,14 @@ public abstract class AbstractJavaVirtualTable<T extends ReadOnlyTable>
protected String specifiedCatalog;
protected String defaultCatalog;
- protected final Vector<JavaVirtualUniqueConstraint> uniqueConstraints = new Vector<JavaVirtualUniqueConstraint>();
- protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+ protected final ContextListContainer<JavaVirtualUniqueConstraint, ReadOnlyUniqueConstraint> uniqueConstraintContainer;
- protected AbstractJavaVirtualTable(JavaJpaContextNode parent, Owner owner) {
+ protected AbstractJavaVirtualTable(JavaJpaContextNode parent, Owner owner, T overridenTable) {
super(parent);
this.owner = owner;
+ this.overriddenTable = overridenTable;
+ this.uniqueConstraintContainer = this.buildUniqueConstraintContainer();
}
@@ -82,7 +81,9 @@ public abstract class AbstractJavaVirtualTable<T extends ReadOnlyTable>
/**
* This should never return <code>null</code>.
*/
- public abstract T getOverriddenTable();
+ public T getOverriddenTable() {
+ return this.overriddenTable;
+ }
// ********** name **********
@@ -186,38 +187,32 @@ public abstract class AbstractJavaVirtualTable<T extends ReadOnlyTable>
// ********** unique constraints **********
- public ListIterator<JavaVirtualUniqueConstraint> uniqueConstraints() {
- return this.getUniqueConstraints().iterator();
+ public ListIterable<JavaVirtualUniqueConstraint> getUniqueConstraints() {
+ return this.uniqueConstraintContainer.getContextElements();
}
- protected ListIterable<JavaVirtualUniqueConstraint> getUniqueConstraints() {
- return new LiveCloneListIterable<JavaVirtualUniqueConstraint>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
+ public int getUniqueConstraintsSize() {
+ return this.uniqueConstraintContainer.getContextElementsSize();
}
public JavaVirtualUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraints.get(index);
+ return this.uniqueConstraintContainer.getContextElement(index);
}
protected void updateUniqueConstraints() {
- ContextContainerTools.update(this.uniqueConstraintContainerAdapter);
+ this.uniqueConstraintContainer.update();
}
- protected Iterable<ReadOnlyUniqueConstraint> getOverriddenUniqueConstraints() {
- return CollectionTools.iterable(this.getOverriddenTable().uniqueConstraints());
+ protected ListIterable<ReadOnlyUniqueConstraint> getOverriddenUniqueConstraints() {
+ return new SuperListIterableWrapper<ReadOnlyUniqueConstraint>(this.getOverriddenTable().getUniqueConstraints());
}
protected void moveUniqueConstraint(int index, JavaVirtualUniqueConstraint constraint) {
- this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ this.uniqueConstraintContainer.moveContextElement(index, constraint);
}
protected JavaVirtualUniqueConstraint addUniqueConstraint(int index, ReadOnlyUniqueConstraint uniqueConstraint) {
- JavaVirtualUniqueConstraint virtualConstraint = this.buildUniqueConstraint(uniqueConstraint);
- this.addItemToList(index, virtualConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- return virtualConstraint;
+ return this.uniqueConstraintContainer.addContextElement(index, uniqueConstraint);
}
protected JavaVirtualUniqueConstraint buildUniqueConstraint(ReadOnlyUniqueConstraint uniqueConstraint) {
@@ -225,33 +220,35 @@ public abstract class AbstractJavaVirtualTable<T extends ReadOnlyTable>
}
protected void removeUniqueConstraint(JavaVirtualUniqueConstraint constraint) {
- this.removeItemFromList(constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ this.uniqueConstraintContainer.removeContextElement(constraint);
+ }
+
+ protected ContextListContainer<JavaVirtualUniqueConstraint, ReadOnlyUniqueConstraint> buildUniqueConstraintContainer() {
+ return new UniqueConstraintContainer();
}
/**
- * unique constraint container adapter
+ * unique constraint container
*/
- protected class UniqueConstraintContainerAdapter
- implements ContextContainerTools.Adapter<JavaVirtualUniqueConstraint, ReadOnlyUniqueConstraint>
+ protected class UniqueConstraintContainer
+ extends ContextListContainer<JavaVirtualUniqueConstraint, ReadOnlyUniqueConstraint>
{
- public Iterable<JavaVirtualUniqueConstraint> getContextElements() {
- return AbstractJavaVirtualTable.this.getUniqueConstraints();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return UNIQUE_CONSTRAINTS_LIST;
+ }
+ @Override
+ protected JavaVirtualUniqueConstraint buildContextElement(ReadOnlyUniqueConstraint resourceElement) {
+ return AbstractJavaVirtualTable.this.buildUniqueConstraint(resourceElement);
}
- public Iterable<ReadOnlyUniqueConstraint> getResourceElements() {
+ @Override
+ protected ListIterable<ReadOnlyUniqueConstraint> getResourceElements() {
return AbstractJavaVirtualTable.this.getOverriddenUniqueConstraints();
}
- public ReadOnlyUniqueConstraint getResourceElement(JavaVirtualUniqueConstraint contextElement) {
+ @Override
+ protected ReadOnlyUniqueConstraint getResourceElement(JavaVirtualUniqueConstraint contextElement) {
return contextElement.getOverriddenUniqueConstraint();
}
- public void moveContextElement(int index, JavaVirtualUniqueConstraint element) {
- AbstractJavaVirtualTable.this.moveUniqueConstraint(index, element);
- }
- public void addContextElement(int index, ReadOnlyUniqueConstraint resourceElement) {
- AbstractJavaVirtualTable.this.addUniqueConstraint(index, resourceElement);
- }
- public void removeContextElement(JavaVirtualUniqueConstraint element) {
- AbstractJavaVirtualTable.this.removeUniqueConstraint(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/FieldAccessor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/FieldAccessor.java
new file mode 100644
index 0000000000..cfaffc8afd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/FieldAccessor.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.PersistentFieldValidator;
+
+public class FieldAccessor
+ extends AbstractAccessor
+{
+ private final JavaResourceField resourceField;
+
+ public FieldAccessor(ReadOnlyPersistentAttribute parent, JavaResourceField resourceField) {
+ super(parent);
+ this.resourceField = resourceField;
+ }
+
+ public JavaResourceAttribute getResourceAttribute() {
+ return this.getField();
+ }
+
+ public JavaResourceField getField() {
+ return this.resourceField;
+ }
+
+ public boolean isFor(JavaResourceField resourceField) {
+ return this.resourceField == resourceField;
+ }
+
+ public boolean isFor(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) {
+ return false;
+ }
+
+ public AccessType getDefaultAccess() {
+ return AccessType.FIELD;
+ }
+
+ public boolean isPublic() {
+ return this.resourceField.isPublic();
+ }
+
+ public boolean isFinal() {
+ return this.resourceField.isFinal();
+ }
+
+ public JptValidator buildAttributeValidator(PersistentAttribute persistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) {
+ return new PersistentFieldValidator(persistentAttribute, this, textRangeResolver);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getResourceAttribute().getNameTextRange(astRoot);
+ }
+
+ public JavaPersistentAttribute buildUnannotatedJavaAttribute(PersistentType parent) {
+ return this.buildJavaAttribute(parent, this.buildUnannotatedJavaResourceField());
+ }
+
+ /**
+ * Build a Java resource field that wraps the original Java resource
+ * field and behaves as though it has no annotations. This will cause
+ * all the settings in the Java <em>context</em> attribute to default.
+ */
+ protected JavaResourceField buildUnannotatedJavaResourceField() {
+ return new UnannotatedJavaResourceField(this.getField());
+ }
+
+ protected JavaPersistentAttribute buildJavaAttribute(PersistentType parent, JavaResourceField resourceField) {
+ return this.getJpaFactory().buildJavaPersistentField(parent, resourceField);
+ }
+
+
+ // ********** unannotated Java resource field **********
+
+ /**
+ * Wrap another Java resource field and suppress all its annotations.
+ */
+ protected class UnannotatedJavaResourceField
+ extends UnannotatedJavaResourceAttribute<JavaResourceField>
+ implements JavaResourceField
+ {
+ protected UnannotatedJavaResourceField(JavaResourceField field){
+ super(field);
+ }
+
+ public Kind getKind() {
+ return Kind.FIELD;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
index 840e0bc0dd..2e00357467 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
@@ -10,8 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.List;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
@@ -20,7 +21,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -107,7 +107,7 @@ public class GenericJavaIdClassReference
* Return <code>null</code> if the annotation does not exists.
*/
protected IdClassAnnotation getIdClassAnnotation() {
- return (IdClassAnnotation) this.getResourcePersistentType().getAnnotation(this.getIdClassAnnotationName());
+ return (IdClassAnnotation) this.getJavaResourceType().getAnnotation(this.getIdClassAnnotationName());
}
/**
@@ -119,7 +119,7 @@ public class GenericJavaIdClassReference
}
protected IdClassAnnotation buildIdClassAnnotation() {
- return (IdClassAnnotation) this.getResourcePersistentType().addAnnotation(this.getIdClassAnnotationName());
+ return (IdClassAnnotation) this.getJavaResourceType().addAnnotation(this.getIdClassAnnotationName());
}
protected void removeIdClassAnnotationIfUnset() {
@@ -129,7 +129,7 @@ public class GenericJavaIdClassReference
}
protected void removeIdClassAnnotation() {
- this.getResourcePersistentType().removeAnnotation(this.getIdClassAnnotationName());
+ this.getJavaResourceType().removeAnnotation(this.getIdClassAnnotationName());
}
protected String getIdClassAnnotationName() {
@@ -168,7 +168,7 @@ public class GenericJavaIdClassReference
}
protected void updateIdClass() {
- JavaResourcePersistentType resourceIdClass = this.resolveResourceIdClass();
+ JavaResourceType resourceIdClass = this.resolveResourceIdClass();
if (resourceIdClass == null) {
if (this.idClass != null) {
this.idClass.dispose();
@@ -178,7 +178,7 @@ public class GenericJavaIdClassReference
if (this.idClass == null) {
this.setIdClass(this.buildIdClass(resourceIdClass));
} else {
- if (this.idClass.getResourcePersistentType() == resourceIdClass) {
+ if (this.idClass.getJavaResourceType() == resourceIdClass) {
this.idClass.update();
} else {
this.idClass.dispose();
@@ -188,15 +188,18 @@ public class GenericJavaIdClassReference
}
}
- protected JavaResourcePersistentType resolveResourceIdClass() {
+ protected JavaResourceType resolveResourceIdClass() {
if (this.fullyQualifiedIdClassName == null) {
return null;
}
- JavaResourcePersistentType jrpt = this.getJpaProject().getJavaResourcePersistentType(this.fullyQualifiedIdClassName);
- return (jrpt == null) ? null : (jrpt.isMapped() ? null : jrpt);
+ JavaResourceType jrt = this.getIdClassJavaResourceType();
+ return (jrt == null) ? null : (jrt.isAnnotatedWith(getJpaProject().getTypeMappingAnnotations()) ? null : jrt);
}
- protected JavaPersistentType buildIdClass(JavaResourcePersistentType resourceClass) {
+ protected JavaResourceType getIdClassJavaResourceType() {
+ return (JavaResourceType) this.getJpaProject().getJavaResourceType(this.fullyQualifiedIdClassName, Kind.TYPE);
+ }
+ protected JavaPersistentType buildIdClass(JavaResourceType resourceClass) {
return this.getJpaFactory().buildJavaPersistentType(this, resourceClass);
}
@@ -220,8 +223,8 @@ public class GenericJavaIdClassReference
return this.getTypeMapping().getPersistentType();
}
- protected JavaResourcePersistentType getResourcePersistentType() {
- return this.getPersistentType().getResourcePersistentType();
+ protected JavaResourceType getJavaResourceType() {
+ return this.getPersistentType().getJavaResourceType();
}
@@ -247,13 +250,13 @@ public class GenericJavaIdClassReference
protected void validateIdClass(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
if (this.isSpecified()) {
- JavaResourcePersistentType jrpt = this.getJpaProject().getJavaResourcePersistentType(this.getFullyQualifiedIdClassName());
- if ((jrpt != null) && (jrpt.isMapped())) {
+ JavaResourceType jrt = this.getIdClassJavaResourceType();
+ if ((jrt != null) && (jrt.isAnnotatedWith(getJpaProject().getTypeMappingAnnotations()))) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
JpaValidationMessages.TYPE_MAPPING_ID_CLASS_NOT_VALID,
- new String[] {jrpt.getName()},
+ new String[] {jrt.getName()},
this,
this.getValidationTextRange(astRoot)
)
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java
index 4000558efe..87b9567cb8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java
@@ -11,9 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper;
-import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
@@ -33,11 +35,7 @@ import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
import org.eclipse.jpt.jpa.db.Table;
public class GenericJavaMappingJoinColumnRelationshipStrategy
@@ -63,43 +61,39 @@ public class GenericJavaMappingJoinColumnRelationshipStrategy
// ********** join column annotations **********
@Override
- protected Iterator<JoinColumnAnnotation> joinColumnAnnotations() {
- return new SuperIteratorWrapper<JoinColumnAnnotation>(this.nestableJoinColumnAnnotations());
+ protected ListIterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
+ return new SubListIterableWrapper<NestableAnnotation, JoinColumnAnnotation>(this.getNestableJoinColumnAnnotations());
}
- protected Iterator<NestableJoinColumnAnnotation> nestableJoinColumnAnnotations() {
- return new SubIteratorWrapper<NestableAnnotation, NestableJoinColumnAnnotation>(this.nestableJoinColumnAnnotations_());
- }
-
- protected Iterator<NestableAnnotation> nestableJoinColumnAnnotations_() {
- return this.getResourcePersistentAttribute().annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
+ protected ListIterable<NestableAnnotation> getNestableJoinColumnAnnotations() {
+ return this.getResourceAttribute().getAnnotations(JoinColumnAnnotation.ANNOTATION_NAME);
}
@Override
protected JoinColumnAnnotation addJoinColumnAnnotation(int index) {
- return (JoinColumnAnnotation) this.getResourcePersistentAttribute().addAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
+ return (JoinColumnAnnotation) this.getResourceAttribute().addAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME);
}
@Override
protected void removeJoinColumnAnnotation(int index) {
- this.getResourcePersistentAttribute().removeAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME);
}
@Override
protected void moveJoinColumnAnnotation(int targetIndex, int sourceIndex) {
- this.getResourcePersistentAttribute().moveAnnotation(targetIndex, sourceIndex, JoinColumnsAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().moveAnnotation(targetIndex, sourceIndex, JoinColumnAnnotation.ANNOTATION_NAME);
}
@Override
protected JoinColumnAnnotation buildNullJoinColumnAnnotation() {
- return new NullJoinColumnAnnotation(this.getResourcePersistentAttribute());
+ return new NullJoinColumnAnnotation(this.getResourceAttribute());
}
// ********** misc **********
- protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getRelationship().getMapping().getResourcePersistentAttribute();
+ protected JavaResourceAttribute getResourceAttribute() {
+ return this.getRelationship().getMapping().getResourceAttribute();
}
@Override
@@ -215,8 +209,8 @@ public class GenericJavaMappingJoinColumnRelationshipStrategy
return GenericJavaMappingJoinColumnRelationshipStrategy.this.defaultJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericJavaMappingJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaMappingJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
}
public TextRange getValidationTextRange(CompilationUnit astRoot) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
index 2d53030855..f714d20f49 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
@@ -202,7 +202,7 @@ public class GenericJavaOneToOneRelationship
public boolean mayHaveDefaultJoinColumn() {
return (this.mappedByStrategy.getMappedByAttribute() == null) &&
- (this.primaryKeyJoinColumnStrategy.primaryKeyJoinColumnsSize() == 0) &&
+ (this.primaryKeyJoinColumnStrategy.getPrimaryKeyJoinColumnsSize() == 0) &&
(this.joinTableStrategy.getJoinTable() == null);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
index 79543b74ed..4b794b9329 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
@@ -10,9 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
-import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
@@ -41,8 +41,8 @@ public class GenericJavaOverrideJoinColumnRelationshipStrategy
// ********** join column annotations **********
@Override
- protected ListIterator<JoinColumnAnnotation> joinColumnAnnotations() {
- return this.getOverrideAnnotation().joinColumns();
+ protected ListIterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
+ return this.getOverrideAnnotation().getJoinColumns();
}
@Override
@@ -218,8 +218,8 @@ public class GenericJavaOverrideJoinColumnRelationshipStrategy
return false;
}
- public int joinColumnsSize() {
- return GenericJavaOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
}
public TextRange getValidationTextRange(CompilationUnit astRoot) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
index cab786efa2..0f0e3c6e0e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
@@ -11,16 +11,13 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper;
-import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
@@ -33,18 +30,13 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationshi
import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingPrimaryKeyJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -53,16 +45,14 @@ public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy
extends AbstractJavaJpaContextNode
implements JavaMappingPrimaryKeyJoinColumnRelationshipStrategy2_0
{
- protected final Vector<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = new Vector<JavaPrimaryKeyJoinColumn>();
- protected final PrimaryKeyJoinColumnContainerAdapter primaryKeyJoinColumnContainerAdapter;
+ protected final ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation> primaryKeyJoinColumnContainer;
protected final JavaReadOnlyJoinColumn.Owner primaryKeyJoinColumnOwner;
public GenericJavaPrimaryKeyJoinColumnRelationshipStrategy(JavaPrimaryKeyJoinColumnRelationship parent) {
super(parent);
- this.primaryKeyJoinColumnContainerAdapter = this.buildPrimaryKeyJoinColumnContainerAdapter();
+ this.primaryKeyJoinColumnContainer = this.buildPrimaryKeyJoinColumnContainer();
this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.initializePrimaryKeyJoinColumns();
}
@@ -77,115 +67,85 @@ public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy
@Override
public void update() {
super.update();
- this.updateNodes(this.getPrimaryKeyJoinColumns());
+ this.updatePrimaryKeyJoinColumns();
}
// ********** primary key join columns **********
- public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumns().iterator();
- }
-
public ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<JavaPrimaryKeyJoinColumn>(this.primaryKeyJoinColumns);
+ return this.primaryKeyJoinColumnContainer.getContextElements();
}
- public int primaryKeyJoinColumnsSize() {
- return this.primaryKeyJoinColumns.size();
+ public int getPrimaryKeyJoinColumnsSize() {
+ return this.primaryKeyJoinColumnContainer.getContextElementsSize();
}
public boolean hasPrimaryKeyJoinColumns() {
- return this.primaryKeyJoinColumns.size() != 0;
+ return this.getPrimaryKeyJoinColumnsSize() != 0;
}
public JavaPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
- return this.primaryKeyJoinColumns.get(index);
+ return this.primaryKeyJoinColumnContainer.getContextElement(index);
}
public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn() {
- return this.addPrimaryKeyJoinColumn(this.primaryKeyJoinColumns.size());
+ return this.addPrimaryKeyJoinColumn(this.getPrimaryKeyJoinColumnsSize());
}
public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) {
PrimaryKeyJoinColumnAnnotation annotation = this.addPrimaryKeyJoinColumnAnnotation(index);
- return this.addPrimaryKeyJoinColumn_(index, annotation);
+ return this.primaryKeyJoinColumnContainer.addContextElement(index, annotation);
}
public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumns.indexOf(joinColumn));
+ this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumnContainer.indexOfContextElement((JavaPrimaryKeyJoinColumn) joinColumn));
}
public void removePrimaryKeyJoinColumn(int index) {
this.removePrimaryKeyJoinColumnAnnotation(index);
- this.removePrimaryKeyJoinColumn_(index);
- }
-
- protected void removePrimaryKeyJoinColumn_(int index) {
- this.removeItemFromList(index, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.primaryKeyJoinColumnContainer.removeContextElement(index);
}
public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
this.movePrimaryKeyJoinColumnAnnotation(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void initializePrimaryKeyJoinColumns() {
- for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) {
- this.primaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation));
- }
+ this.primaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
}
protected void syncPrimaryKeyJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.primaryKeyJoinColumnContainerAdapter);
+ this.primaryKeyJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
- return CollectionTools.iterable(this.primaryKeyJoinColumnAnnotations());
+ protected void updatePrimaryKeyJoinColumns() {
+ this.primaryKeyJoinColumnContainer.update();
}
- protected void movePrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) {
- JavaPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(pkJoinColumnAnnotation);
- this.addItemToList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removePrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn joinColumn) {
- this.removePrimaryKeyJoinColumn_(this.primaryKeyJoinColumns.indexOf(joinColumn));
- }
-
- protected PrimaryKeyJoinColumnContainerAdapter buildPrimaryKeyJoinColumnContainerAdapter() {
- return new PrimaryKeyJoinColumnContainerAdapter();
+ protected ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation> buildPrimaryKeyJoinColumnContainer() {
+ return new PrimaryKeyJoinColumnContainer();
}
/**
- * primary key join column container adapter
+ * primary key join column container
*/
- protected class PrimaryKeyJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
+ protected class PrimaryKeyJoinColumnContainer
+ extends ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
{
- public Iterable<JavaPrimaryKeyJoinColumn> getContextElements() {
- return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return PRIMARY_KEY_JOIN_COLUMNS_LIST;
}
- public Iterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
+ @Override
+ protected JavaPrimaryKeyJoinColumn buildContextElement(PrimaryKeyJoinColumnAnnotation resourceElement) {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.buildPrimaryKeyJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumnAnnotations();
}
- public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
+ @Override
+ protected PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
return contextElement.getColumnAnnotation();
}
- public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) {
- GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.movePrimaryKeyJoinColumn_(index, element);
- }
- public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) {
- GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.addPrimaryKeyJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(JavaPrimaryKeyJoinColumn element) {
- GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.removePrimaryKeyJoinColumn_(element);
- }
}
protected JavaReadOnlyJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
@@ -199,28 +159,24 @@ public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy
// ********** primary key join column annotations **********
- protected Iterator<PrimaryKeyJoinColumnAnnotation> primaryKeyJoinColumnAnnotations() {
- return new SuperIteratorWrapper<PrimaryKeyJoinColumnAnnotation>(this.nestablePrimaryKeyJoinColumnAnnotations());
- }
-
- protected Iterator<NestablePrimaryKeyJoinColumnAnnotation> nestablePrimaryKeyJoinColumnAnnotations() {
- return new SubIteratorWrapper<NestableAnnotation, NestablePrimaryKeyJoinColumnAnnotation>(this.nestablePrimaryKeyJoinColumnAnnotations_());
+ protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
+ return new SubListIterableWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>(this.getNestablePrimaryKeyJoinColumnAnnotations());
}
- protected Iterator<NestableAnnotation> nestablePrimaryKeyJoinColumnAnnotations_() {
- return this.getResourcePersistentAttribute().annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ protected ListIterable<NestableAnnotation> getNestablePrimaryKeyJoinColumnAnnotations() {
+ return this.getResourceAttribute().getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
}
protected PrimaryKeyJoinColumnAnnotation addPrimaryKeyJoinColumnAnnotation(int index) {
- return (PrimaryKeyJoinColumnAnnotation) this.getResourcePersistentAttribute().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ return (PrimaryKeyJoinColumnAnnotation) this.getResourceAttribute().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
}
protected void removePrimaryKeyJoinColumnAnnotation(int index) {
- this.getResourcePersistentAttribute().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
}
protected void movePrimaryKeyJoinColumnAnnotation(int targetIndex, int sourceIndex) {
- this.getResourcePersistentAttribute().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
}
@@ -239,8 +195,8 @@ public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy
return this.getRelationship().getMapping();
}
- protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getRelationship().getMapping().getResourcePersistentAttribute();
+ protected JavaResourceAttribute getResourceAttribute() {
+ return this.getRelationship().getMapping().getResourceAttribute();
}
public String getTableName() {
@@ -272,13 +228,13 @@ public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy
}
public void addStrategy() {
- if (this.primaryKeyJoinColumns.size() == 0) {
+ if (this.getPrimaryKeyJoinColumnsSize() == 0) {
this.addPrimaryKeyJoinColumn();
}
}
public void removeStrategy() {
- for (int i = this.primaryKeyJoinColumns.size(); i-- > 0; ) {
+ for (int i = this.getPrimaryKeyJoinColumnsSize(); i-- > 0; ) {
this.removePrimaryKeyJoinColumn(i);
}
}
@@ -381,8 +337,8 @@ public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy
return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot);
}
- public int joinColumnsSize() {
- return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.primaryKeyJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java
index 283cee058d..e7d23ce94a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java
@@ -11,16 +11,13 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
@@ -35,7 +32,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
@@ -50,19 +46,17 @@ public class GenericJavaVirtualJoinTable
extends AbstractJavaVirtualReferenceTable<ReadOnlyJoinTable>
implements JavaVirtualJoinTable
{
- protected final ReadOnlyJoinTable overriddenTable;
- protected final Vector<JavaVirtualJoinColumn> specifiedInverseJoinColumns = new Vector<JavaVirtualJoinColumn>();
- protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
+ protected final ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn> specifiedInverseJoinColumnContainer;
protected final JavaReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
protected JavaVirtualJoinColumn defaultInverseJoinColumn;
public GenericJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, Owner owner, ReadOnlyJoinTable overriddenTable) {
- super(parent, owner);
- this.overriddenTable = overriddenTable;
+ super(parent, owner, overriddenTable);
this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
+ this.specifiedInverseJoinColumnContainer = this.buildSpecifiedInverseJoinColumnContainer();
}
@@ -76,97 +70,81 @@ public class GenericJavaVirtualJoinTable
}
- // ********** table **********
-
- @Override
- public ReadOnlyJoinTable getOverriddenTable() {
- return this.overriddenTable;
- }
-
-
// ********** inverse join columns **********
- public ListIterator<JavaVirtualJoinColumn> inverseJoinColumns() {
- return this.getInverseJoinColumns().iterator();
- }
-
- protected ListIterable<JavaVirtualJoinColumn> getInverseJoinColumns() {
+ public ListIterable<JavaVirtualJoinColumn> getInverseJoinColumns() {
return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
}
- public int inverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
+ public int getInverseJoinColumnsSize() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
}
// ********** inverse specified join columns **********
- public ListIterator<JavaVirtualJoinColumn> specifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumns().iterator();
+ public ListIterable<JavaVirtualJoinColumn> getSpecifiedInverseJoinColumns() {
+ return this.specifiedInverseJoinColumnContainer.getContextElements();
}
- protected ListIterable<JavaVirtualJoinColumn> getSpecifiedInverseJoinColumns() {
- return new LiveCloneListIterable<JavaVirtualJoinColumn>(this.specifiedInverseJoinColumns);
- }
-
- public int specifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumns.size();
+ public int getSpecifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumns.size() != 0;
+ return this.getSpecifiedInverseJoinColumnsSize() != 0;
}
public JavaVirtualJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumns.get(index);
+ return this.specifiedInverseJoinColumnContainer.getContextElement(index);
}
protected void updateSpecifiedInverseJoinColumns() {
- ContextContainerTools.update(this.specifiedInverseJoinColumnContainerAdapter);
+ this.specifiedInverseJoinColumnContainer.update();
}
- protected Iterable<ReadOnlyJoinColumn> getOverriddenInverseJoinColumns() {
- return CollectionTools.iterable(this.getOverriddenTable().specifiedInverseJoinColumns());
+ protected ListIterable<ReadOnlyJoinColumn> getOverriddenInverseJoinColumns() {
+ return new SuperListIterableWrapper<ReadOnlyJoinColumn>(this.getOverriddenTable().getSpecifiedInverseJoinColumns());
}
protected void moveSpecifiedInverseJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.specifiedInverseJoinColumnContainer.moveContextElement(index, joinColumn);
}
protected JavaVirtualJoinColumn addSpecifiedInverseJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- JavaVirtualJoinColumn virtualJoinColumn = this.buildInverseJoinColumn(joinColumn);
- this.addItemToList(index, virtualJoinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- return virtualJoinColumn;
+ return this.specifiedInverseJoinColumnContainer.addContextElement(index, joinColumn);
}
protected void removeSpecifiedInverseJoinColumn(JavaVirtualJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.specifiedInverseJoinColumnContainer.removeContextElement(joinColumn);
+ }
+
+ protected ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedInverseJoinColumnContainer() {
+ return new SpecifiedInverseJoinColumnContainer();
}
/**
- * specified inverse join column container adapter
+ * specified join column container
*/
- protected class SpecifiedInverseJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
+ protected class SpecifiedInverseJoinColumnContainer
+ extends ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
{
- public Iterable<JavaVirtualJoinColumn> getContextElements() {
- return GenericJavaVirtualJoinTable.this.getSpecifiedInverseJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_INVERSE_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected JavaVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
+ return GenericJavaVirtualJoinTable.this.buildInverseJoinColumn(resourceElement);
}
- public Iterable<ReadOnlyJoinColumn> getResourceElements() {
+ @Override
+ protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
return GenericJavaVirtualJoinTable.this.getOverriddenInverseJoinColumns();
}
- public ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
+ @Override
+ protected ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
return contextElement.getOverriddenColumn();
}
- public void moveContextElement(int index, JavaVirtualJoinColumn element) {
- GenericJavaVirtualJoinTable.this.moveSpecifiedInverseJoinColumn(index, element);
- }
- public void addContextElement(int index, ReadOnlyJoinColumn element) {
- GenericJavaVirtualJoinTable.this.addSpecifiedInverseJoinColumn(index, element);
- }
- public void removeContextElement(JavaVirtualJoinColumn element) {
- GenericJavaVirtualJoinTable.this.removeSpecifiedInverseJoinColumn(element);
- }
}
@@ -349,8 +327,8 @@ public class GenericJavaVirtualJoinTable
return GenericJavaVirtualJoinTable.this.defaultJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericJavaVirtualJoinTable.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaVirtualJoinTable.this.getJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
@@ -389,8 +367,8 @@ public class GenericJavaVirtualJoinTable
return GenericJavaVirtualJoinTable.this.defaultInverseJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericJavaVirtualJoinTable.this.inverseJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaVirtualJoinTable.this.getInverseJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java
index 123325a218..a858697319 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java
@@ -51,7 +51,7 @@ public class JavaBasicMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java
index db5e442034..15b9f51048 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,13 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
public class JavaEmbeddableDefinition
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
index 86d3c1100d..27d7523752 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
@@ -16,8 +16,8 @@ import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
public class JavaEmbeddedIdMappingDefinition
implements JavaAttributeMappingDefinition
@@ -49,7 +49,7 @@ public class JavaEmbeddedIdMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
@@ -58,7 +58,7 @@ public class JavaEmbeddedIdMappingDefinition
private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME,
+ JPA.ATTRIBUTE_OVERRIDES,
};
private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java
index 3a91dc7e71..5d4a57193a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java
@@ -16,8 +16,8 @@ import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefiniti
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
public class JavaEmbeddedMappingDefinition
implements DefaultJavaAttributeMappingDefinition
@@ -49,7 +49,7 @@ public class JavaEmbeddedMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
@@ -58,7 +58,7 @@ public class JavaEmbeddedMappingDefinition
private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME,
+ JPA.ATTRIBUTE_OVERRIDES,
};
private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java
index 3d604b334f..264faad066 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,31 +9,25 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
@@ -74,9 +68,9 @@ public class JavaEntityDefinition
private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
TableAnnotation.ANNOTATION_NAME,
SecondaryTableAnnotation.ANNOTATION_NAME,
- SecondaryTablesAnnotation.ANNOTATION_NAME,
+ JPA.SECONDARY_TABLES,
PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME,
+ JPA.PRIMARY_KEY_JOIN_COLUMNS,
IdClassAnnotation.ANNOTATION_NAME,
InheritanceAnnotation.ANNOTATION_NAME,
DiscriminatorValueAnnotation.ANNOTATION_NAME,
@@ -84,9 +78,9 @@ public class JavaEntityDefinition
SequenceGeneratorAnnotation.ANNOTATION_NAME,
TableGeneratorAnnotation.ANNOTATION_NAME,
NamedQueryAnnotation.ANNOTATION_NAME,
- NamedQueriesAnnotation.ANNOTATION_NAME,
+ JPA.NAMED_QUERIES,
NamedNativeQueryAnnotation.ANNOTATION_NAME,
- NamedNativeQueriesAnnotation.ANNOTATION_NAME,
+ JPA.NAMED_NATIVE_QUERIES,
JPA.SQL_RESULT_SET_MAPPING,
JPA.EXCLUDE_DEFAULT_LISTENERS,
JPA.EXCLUDE_SUPERCLASS_LISTENERS,
@@ -99,9 +93,9 @@ public class JavaEntityDefinition
JPA.POST_UPDATE,
JPA.POST_LOAD,
AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME,
+ JPA.ATTRIBUTE_OVERRIDES,
AssociationOverrideAnnotation.ANNOTATION_NAME,
- AssociationOverridesAnnotation.ANNOTATION_NAME
+ JPA.ASSOCIATION_OVERRIDES
};
private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java
index 6ba589476b..24c22ab227 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java
@@ -52,7 +52,7 @@ public class JavaIdMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java
index 12655a9a88..e430c5f21b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java
@@ -50,7 +50,7 @@ public class JavaManyToManyMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java
index f4c48d6b44..316e2747e5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java
@@ -15,8 +15,8 @@ import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
@@ -50,7 +50,7 @@ public class JavaManyToOneMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
@@ -60,7 +60,7 @@ public class JavaManyToOneMappingDefinition
private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
JoinTableAnnotation.ANNOTATION_NAME,
JoinColumnAnnotation.ANNOTATION_NAME,
- JoinColumnsAnnotation.ANNOTATION_NAME
+ JPA.JOIN_COLUMNS
};
private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java
index 33ba199c08..fc00d7bedd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,13 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
import org.eclipse.jpt.jpa.core.JpaFactory;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java
index b48a3deef0..b6f1f6cfc6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.List;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java
index 4af1e38043..e5562683b5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java
@@ -15,8 +15,8 @@ import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
@@ -52,7 +52,7 @@ public class JavaOneToManyMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
@@ -64,7 +64,7 @@ public class JavaOneToManyMappingDefinition
MapKeyAnnotation.ANNOTATION_NAME,
OrderByAnnotation.ANNOTATION_NAME,
JoinColumnAnnotation.ANNOTATION_NAME,
- JoinColumnsAnnotation.ANNOTATION_NAME
+ JPA.JOIN_COLUMNS
};
private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java
index 727a1f3470..849d052ba5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java
@@ -15,12 +15,11 @@ import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
public class JavaOneToOneMappingDefinition
implements JavaAttributeMappingDefinition
@@ -52,7 +51,7 @@ public class JavaOneToOneMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
@@ -62,9 +61,9 @@ public class JavaOneToOneMappingDefinition
private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
JoinTableAnnotation.ANNOTATION_NAME,
JoinColumnAnnotation.ANNOTATION_NAME,
- JoinColumnsAnnotation.ANNOTATION_NAME,
+ JPA.JOIN_COLUMNS,
PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME
+ JPA.PRIMARY_KEY_JOIN_COLUMNS
};
private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java
index 4618a9ec32..ca1fcc602d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -47,7 +47,7 @@ public class JavaTransientMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java
index 826bc5763a..fde7b35990 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java
@@ -49,7 +49,7 @@ public class JavaVersionMappingDefinition
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PropertyAccessor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PropertyAccessor.java
new file mode 100644
index 0000000000..b8b58c3ffb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PropertyAccessor.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.MethodSignature;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.PersistentPropertyValidator;
+
+public class PropertyAccessor
+ extends AbstractAccessor
+{
+ private final JavaResourceMethod resourceGetter;
+
+ private final JavaResourceMethod resourceSetter;
+
+ public PropertyAccessor(ReadOnlyPersistentAttribute parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
+ super(parent);
+ this.resourceGetter = resourceGetter;
+ this.resourceSetter = resourceSetter;
+ }
+
+ public JavaResourceAttribute getResourceAttribute() {
+ return this.resourceGetter;
+ }
+
+ public boolean isFor(JavaResourceField resourceField) {
+ return false;
+ }
+
+ public boolean isFor(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) {
+ return (this.resourceGetter == getterMethod) && (this.resourceSetter == setterMethod);
+ }
+
+ public AccessType getDefaultAccess() {
+ return AccessType.PROPERTY;
+ }
+
+ public JavaResourceMethod getResourceGetter() {
+ return this.resourceGetter;
+ }
+
+ public JavaResourceMethod getResourceSetter() {
+ return this.resourceSetter;
+ }
+
+ public JavaPersistentAttribute buildUnannotatedJavaAttribute(PersistentType parent) {
+ return this.buildJavaAttribute(parent, this.buildUnannotatedJavaResourceGetter(), this.buildUnannotatedJavaResourceSetter());
+ }
+
+ /**
+ * Build a Java resource method that wraps the original Java resource
+ * getter method and behaves as though it has no annotations. This will cause
+ * all the settings in the Java <em>context</em> attribute to default.
+ */
+ protected JavaResourceMethod buildUnannotatedJavaResourceGetter() {
+ return new UnannotatedJavaResourceMethod(this.getResourceGetter());
+ }
+
+ /**
+ * Build a Java resource method that wraps the original Java resource
+ * setter method and behaves as though it has no annotations. This will cause
+ * all the settings in the Java <em>context</em> attribute to default.
+ */
+ protected JavaResourceMethod buildUnannotatedJavaResourceSetter() {
+ return new UnannotatedJavaResourceMethod(this.getResourceSetter());
+ }
+
+ protected JavaPersistentAttribute buildJavaAttribute(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
+ return this.getJpaFactory().buildJavaPersistentProperty(parent, resourceGetter, resourceSetter);
+ }
+
+
+ public JptValidator buildAttributeValidator(PersistentAttribute persistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) {
+ return new PersistentPropertyValidator(persistentAttribute, this, textRangeResolver);
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getResourceAttribute().getNameTextRange(astRoot);
+ }
+
+
+ // ********** unannotated Java resource method **********
+
+ /**
+ * Wrap another Java resource method and suppress all its annotations.
+ */
+ protected class UnannotatedJavaResourceMethod
+ extends UnannotatedJavaResourceAttribute<JavaResourceMethod>
+ implements JavaResourceMethod
+ {
+ protected UnannotatedJavaResourceMethod(JavaResourceMethod method){
+ super(method);
+ }
+
+ public Kind getKind() {
+ return Kind.METHOD;
+ }
+
+ public String getMethodName() {
+ return this.member.getMethodName();
+ }
+
+ public boolean isFor(MethodSignature methodSignature, int occurrence) {
+ return this.member.isFor(methodSignature, occurrence);
+ }
+
+ public ListIterable<String> getParameterTypeNames() {
+ return this.member.getParameterTypeNames();
+ }
+
+ public int getParametersSize() {
+ return 0;
+ }
+
+ public boolean isConstructor() {
+ return this.member.isConstructor();
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
index 655dffc7a2..e9837e6ba5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
@@ -15,6 +15,7 @@ import java.util.Vector;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.Tools;
@@ -43,7 +44,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
@@ -86,11 +86,9 @@ public abstract class AbstractEntityMappings
protected final Vector<OrmPersistentType> persistentTypes = new Vector<OrmPersistentType>();
protected final PersistentTypeContainerAdapter persistentTypeContainerAdapter = new PersistentTypeContainerAdapter();
- protected final Vector<OrmSequenceGenerator> sequenceGenerators = new Vector<OrmSequenceGenerator>();
- protected final SequenceGeneratorContainerAdapter sequenceGeneratorContainerAdapter = new SequenceGeneratorContainerAdapter();
+ protected final ContextListContainer<OrmSequenceGenerator, XmlSequenceGenerator> sequenceGeneratorContainer;
- protected final Vector<OrmTableGenerator> tableGenerators = new Vector<OrmTableGenerator>();
- protected final TableGeneratorContainerAdapter tableGeneratorContainerAdapter = new TableGeneratorContainerAdapter();
+ protected final ContextListContainer<OrmTableGenerator, XmlTableGenerator> tableGeneratorContainer;
protected final OrmQueryContainer queryContainer;
@@ -109,8 +107,8 @@ public abstract class AbstractEntityMappings
this.persistenceUnitMetadata = this.buildPersistenceUnitMetadata();
this.initializePersistentTypes();
- this.initializeSequenceGenerators();
- this.initializeTableGenerators();
+ this.sequenceGeneratorContainer = this.buildSequenceGeneratorContainer();
+ this.tableGeneratorContainer = this.buildTableGeneratorContainer();
this.queryContainer = this.buildQueryContainer();
}
@@ -471,14 +469,14 @@ public abstract class AbstractEntityMappings
}
public PersistentType resolvePersistentType(String className) {
- return (PersistentType) this.resolvePersistentType(PERSISTENT_TYPE_LOOKUP_ADAPTER, className);
+ return (PersistentType) this.resolveType(PERSISTENT_TYPE_LOOKUP_ADAPTER, className);
}
- public JavaResourcePersistentType resolveJavaResourcePersistentType(String className) {
- return (JavaResourcePersistentType) this.resolvePersistentType(RESOURCE_PERSISTENT_TYPE_LOOKUP_ADAPTER, className);
+ public JavaResourceAbstractType resolveJavaResourceType(String className) {
+ return (JavaResourceAbstractType) this.resolveType(RESOURCE_TYPE_LOOKUP_ADAPTER, className);
}
- protected Object resolvePersistentType(PersistentTypeLookupAdapter adapter, String className) {
+ protected Object resolveType(TypeLookupAdapter adapter, String className) {
if (className == null) {
return null;
}
@@ -487,33 +485,33 @@ public abstract class AbstractEntityMappings
className = className.replace('$', '.');
// first try to resolve using only the locally specified name...
- Object persistentType = adapter.resolvePersistentType(this, className);
- if (persistentType != null) {
- return persistentType;
+ Object type = adapter.resolveType(this, className);
+ if (type != null) {
+ return type;
}
// ...then try to resolve by prepending the global package name
if (this.getPackage() == null) {
return null;
}
- return adapter.resolvePersistentType(this, this.getPackage() + '.' + className);
+ return adapter.resolveType(this, this.getPackage() + '.' + className);
}
- protected interface PersistentTypeLookupAdapter {
- Object resolvePersistentType(EntityMappings entityMappings, String className);
+ protected interface TypeLookupAdapter {
+ Object resolveType(EntityMappings entityMappings, String className);
}
- protected static final PersistentTypeLookupAdapter PERSISTENT_TYPE_LOOKUP_ADAPTER =
- new PersistentTypeLookupAdapter() {
- public Object resolvePersistentType(EntityMappings entityMappings, String className) {
+ protected static final TypeLookupAdapter PERSISTENT_TYPE_LOOKUP_ADAPTER =
+ new TypeLookupAdapter() {
+ public Object resolveType(EntityMappings entityMappings, String className) {
return entityMappings.getPersistenceUnit().getPersistentType(className);
}
};
- protected static final PersistentTypeLookupAdapter RESOURCE_PERSISTENT_TYPE_LOOKUP_ADAPTER =
- new PersistentTypeLookupAdapter() {
- public Object resolvePersistentType(EntityMappings entityMappings, String className) {
- return entityMappings.getJpaProject().getJavaResourcePersistentType(className);
+ protected static final TypeLookupAdapter RESOURCE_TYPE_LOOKUP_ADAPTER =
+ new TypeLookupAdapter() {
+ public Object resolveType(EntityMappings entityMappings, String className) {
+ return entityMappings.getJpaProject().getJavaResourceType(className);
}
};
@@ -647,20 +645,20 @@ public abstract class AbstractEntityMappings
// ********** sequence generators **********
public ListIterable<OrmSequenceGenerator> getSequenceGenerators() {
- return new LiveCloneListIterable<OrmSequenceGenerator>(this.sequenceGenerators);
+ return this.sequenceGeneratorContainer.getContextElements();
}
public int getSequenceGeneratorsSize() {
- return this.sequenceGenerators.size();
+ return this.sequenceGeneratorContainer.getContextElementsSize();
}
public OrmSequenceGenerator addSequenceGenerator() {
- return this.addSequenceGenerator(this.sequenceGenerators.size());
+ return this.addSequenceGenerator(this.getSequenceGeneratorsSize());
}
public OrmSequenceGenerator addSequenceGenerator(int index) {
XmlSequenceGenerator xmlGenerator = this.buildXmlSequenceGenerator();
- OrmSequenceGenerator sequenceGenerator = this.addSequenceGenerator_(index, xmlGenerator);
+ OrmSequenceGenerator sequenceGenerator = this.sequenceGeneratorContainer.addContextElement(index, xmlGenerator);
this.xmlEntityMappings.getSequenceGenerators().add(index, xmlGenerator);
return sequenceGenerator;
}
@@ -674,96 +672,74 @@ public abstract class AbstractEntityMappings
}
public void removeSequenceGenerator(OrmSequenceGenerator sequenceGenerator) {
- this.removeSequenceGenerator(this.sequenceGenerators.indexOf(sequenceGenerator));
+ this.removeSequenceGenerator(this.sequenceGeneratorContainer.indexOfContextElement(sequenceGenerator));
}
public void removeSequenceGenerator(int index) {
- this.removeSequenceGenerator_(index);
+ this.sequenceGeneratorContainer.removeContextElement(index);
this.xmlEntityMappings.getSequenceGenerators().remove(index);
}
- protected void removeSequenceGenerator_(int index) {
- this.removeItemFromList(index, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST);
- }
-
public void moveSequenceGenerator(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST);
+ this.sequenceGeneratorContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlEntityMappings.getSequenceGenerators().move(targetIndex, sourceIndex);
}
- protected void initializeSequenceGenerators() {
- for (XmlSequenceGenerator sequenceGenerator : this.getXmlSequenceGenerators()) {
- this.sequenceGenerators.add(this.buildSequenceGenerator(sequenceGenerator));
- }
- }
-
protected void syncSequenceGenerators() {
- ContextContainerTools.synchronizeWithResourceModel(this.sequenceGeneratorContainerAdapter);
+ this.sequenceGeneratorContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlSequenceGenerator> getXmlSequenceGenerators() {
+ protected ListIterable<XmlSequenceGenerator> getXmlSequenceGenerators() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlSequenceGenerator>(this.xmlEntityMappings.getSequenceGenerators());
- }
-
- protected void moveSequenceGenerator_(int index, OrmSequenceGenerator sequenceGenerator) {
- this.moveItemInList(index, sequenceGenerator, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST);
+ return new LiveCloneListIterable<XmlSequenceGenerator>(this.xmlEntityMappings.getSequenceGenerators());
}
- protected OrmSequenceGenerator addSequenceGenerator_(int index, XmlSequenceGenerator xmlSequenceGenerator) {
- OrmSequenceGenerator sequenceGenerator = this.buildSequenceGenerator(xmlSequenceGenerator);
- this.addItemToList(index, sequenceGenerator, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST);
- return sequenceGenerator;
- }
-
- protected void removeSequenceGenerator_(OrmSequenceGenerator sequenceGenerator) {
- this.removeSequenceGenerator_(this.sequenceGenerators.indexOf(sequenceGenerator));
+ protected ContextListContainer<OrmSequenceGenerator, XmlSequenceGenerator> buildSequenceGeneratorContainer() {
+ return new SequenceGeneratorContainer();
}
/**
- * sequence generator container adapter
+ * sequence generator container
*/
- protected class SequenceGeneratorContainerAdapter
- implements ContextContainerTools.Adapter<OrmSequenceGenerator, XmlSequenceGenerator>
+ protected class SequenceGeneratorContainer
+ extends ContextListContainer<OrmSequenceGenerator, XmlSequenceGenerator>
{
- public Iterable<OrmSequenceGenerator> getContextElements() {
- return AbstractEntityMappings.this.getSequenceGenerators();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SEQUENCE_GENERATORS_LIST;
+ }
+ @Override
+ protected OrmSequenceGenerator buildContextElement(XmlSequenceGenerator resourceElement) {
+ return AbstractEntityMappings.this.buildSequenceGenerator(resourceElement);
}
- public Iterable<XmlSequenceGenerator> getResourceElements() {
+ @Override
+ protected ListIterable<XmlSequenceGenerator> getResourceElements() {
return AbstractEntityMappings.this.getXmlSequenceGenerators();
}
- public XmlSequenceGenerator getResourceElement(OrmSequenceGenerator contextElement) {
+ @Override
+ protected XmlSequenceGenerator getResourceElement(OrmSequenceGenerator contextElement) {
return contextElement.getXmlGenerator();
}
- public void moveContextElement(int index, OrmSequenceGenerator element) {
- AbstractEntityMappings.this.moveSequenceGenerator_(index, element);
- }
- public void addContextElement(int index, XmlSequenceGenerator resourceElement) {
- AbstractEntityMappings.this.addSequenceGenerator_(index, resourceElement);
- }
- public void removeContextElement(OrmSequenceGenerator element) {
- AbstractEntityMappings.this.removeSequenceGenerator_(element);
- }
}
// ********** table generators **********
public ListIterable<OrmTableGenerator> getTableGenerators() {
- return new LiveCloneListIterable<OrmTableGenerator>(this.tableGenerators);
+ return this.tableGeneratorContainer.getContextElements();
}
public int getTableGeneratorsSize() {
- return this.tableGenerators.size();
+ return this.tableGeneratorContainer.getContextElementsSize();
}
public OrmTableGenerator addTableGenerator() {
- return this.addTableGenerator(this.tableGenerators.size());
+ return this.addTableGenerator(this.getTableGeneratorsSize());
}
public OrmTableGenerator addTableGenerator(int index) {
XmlTableGenerator xmlTableGenerator = this.buildXmlTableGenerator();
- OrmTableGenerator tableGenerator = this.addTableGenerator_(index, xmlTableGenerator);
+ OrmTableGenerator tableGenerator = this.tableGeneratorContainer.addContextElement(index, xmlTableGenerator);
this.xmlEntityMappings.getTableGenerators().add(index, xmlTableGenerator);
return tableGenerator;
}
@@ -777,76 +753,54 @@ public abstract class AbstractEntityMappings
}
public void removeTableGenerator(OrmTableGenerator tableGenerator) {
- this.removeTableGenerator(this.tableGenerators.indexOf(tableGenerator));
+ this.removeTableGenerator(this.tableGeneratorContainer.indexOfContextElement(tableGenerator));
}
public void removeTableGenerator(int index) {
- this.removeTableGenerator_(index);
+ this.tableGeneratorContainer.removeContextElement(index);
this.xmlEntityMappings.getTableGenerators().remove(index);
}
- protected void removeTableGenerator_(int index) {
- this.removeItemFromList(index, this.tableGenerators, TABLE_GENERATORS_LIST);
- }
-
public void moveTableGenerator(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.tableGenerators, TABLE_GENERATORS_LIST);
+ this.tableGeneratorContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlEntityMappings.getTableGenerators().move(targetIndex, sourceIndex);
}
- protected void initializeTableGenerators() {
- for (XmlTableGenerator tableGenerator : this.getXmlTableGenerators()) {
- this.tableGenerators.add(this.buildTableGenerator(tableGenerator));
- }
- }
-
protected void syncTableGenerators() {
- ContextContainerTools.synchronizeWithResourceModel(this.tableGeneratorContainerAdapter);
+ this.tableGeneratorContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlTableGenerator> getXmlTableGenerators() {
+ protected ListIterable<XmlTableGenerator> getXmlTableGenerators() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlTableGenerator>(this.xmlEntityMappings.getTableGenerators());
- }
-
- protected void moveTableGenerator_(int index, OrmTableGenerator tableGenerator) {
- this.moveItemInList(index, tableGenerator, this.tableGenerators, TABLE_GENERATORS_LIST);
+ return new LiveCloneListIterable<XmlTableGenerator>(this.xmlEntityMappings.getTableGenerators());
}
- protected OrmTableGenerator addTableGenerator_(int index, XmlTableGenerator xmlTableGenerator) {
- OrmTableGenerator tableGenerator = this.buildTableGenerator(xmlTableGenerator);
- this.addItemToList(index, tableGenerator, this.tableGenerators, TABLE_GENERATORS_LIST);
- return tableGenerator;
- }
-
- protected void removeTableGenerator_(OrmTableGenerator tableGenerator) {
- this.removeTableGenerator_(this.tableGenerators.indexOf(tableGenerator));
+ protected ContextListContainer<OrmTableGenerator, XmlTableGenerator> buildTableGeneratorContainer() {
+ return new TableGeneratorContainer();
}
/**
- * table generator container adapter
+ * table generator container
*/
- protected class TableGeneratorContainerAdapter
- implements ContextContainerTools.Adapter<OrmTableGenerator, XmlTableGenerator>
+ protected class TableGeneratorContainer
+ extends ContextListContainer<OrmTableGenerator, XmlTableGenerator>
{
- public Iterable<OrmTableGenerator> getContextElements() {
- return AbstractEntityMappings.this.getTableGenerators();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return TABLE_GENERATORS_LIST;
+ }
+ @Override
+ protected OrmTableGenerator buildContextElement(XmlTableGenerator resourceElement) {
+ return AbstractEntityMappings.this.buildTableGenerator(resourceElement);
}
- public Iterable<XmlTableGenerator> getResourceElements() {
+ @Override
+ protected ListIterable<XmlTableGenerator> getResourceElements() {
return AbstractEntityMappings.this.getXmlTableGenerators();
}
- public XmlTableGenerator getResourceElement(OrmTableGenerator contextElement) {
+ @Override
+ protected XmlTableGenerator getResourceElement(OrmTableGenerator contextElement) {
return contextElement.getXmlGenerator();
}
- public void moveContextElement(int index, OrmTableGenerator element) {
- AbstractEntityMappings.this.moveTableGenerator_(index, element);
- }
- public void addContextElement(int index, XmlTableGenerator resourceElement) {
- AbstractEntityMappings.this.addTableGenerator_(index, resourceElement);
- }
- public void removeContextElement(OrmTableGenerator element) {
- AbstractEntityMappings.this.removeTableGenerator_(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
index 6db18c8d9f..d6a318600d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
@@ -9,16 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.orm;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
import java.util.Vector;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.ClassName;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -26,14 +23,12 @@ import org.eclipse.jpt.common.utility.internal.NotNullFilter;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
@@ -125,7 +120,6 @@ import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.Inheritance;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
@@ -161,15 +155,11 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected boolean tableIsUndefined;
protected final ReadOnlyTable.Owner secondaryTableOwner;
- protected final Vector<OrmSecondaryTable> specifiedSecondaryTables = new Vector<OrmSecondaryTable>();
- protected final SpecifiedSecondaryTableContainerAdapter specifiedSecondaryTableContainerAdapter = new SpecifiedSecondaryTableContainerAdapter();
-
- protected final Vector<OrmVirtualSecondaryTable> virtualSecondaryTables = new Vector<OrmVirtualSecondaryTable>();
- protected final VirtualSecondaryTableContainerAdapter virtualSecondaryTableContainerAdapter = new VirtualSecondaryTableContainerAdapter();
+ protected final ContextListContainer<OrmSecondaryTable, XmlSecondaryTable> specifiedSecondaryTableContainer;
+ protected final ContextListContainer<OrmVirtualSecondaryTable, JavaSecondaryTable> virtualSecondaryTableContainer;
protected final PrimaryKeyJoinColumnOwner primaryKeyJoinColumnOwner;
- protected final Vector<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
- protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected final ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumnContainer;
// this is the default if there are Java columns
protected final Vector<OrmVirtualPrimaryKeyJoinColumn> virtualPrimaryKeyJoinColumns = new Vector<OrmVirtualPrimaryKeyJoinColumn>();
@@ -205,9 +195,10 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
this.idClassReference = this.buildIdClassReference();
this.table = this.buildTable();
this.secondaryTableOwner = this.buildSecondaryTableOwner();
- this.initializeSpecifiedSecondaryTables();
+ this.specifiedSecondaryTableContainer = this.buildSpecifiedSecondaryTableContainer();
+ this.virtualSecondaryTableContainer = this.buildVirtualSecondaryTableContainer();
this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.initializeSpecifiedPrimaryKeyJoinColumns();
+ this.specifiedPrimaryKeyJoinColumnContainer = this.buildSpecifiedPrimaryKeyJoinColumnContainer();
this.specifiedInheritanceStrategy = this.buildSpecifiedInheritanceStrategy();
this.specifiedDiscriminatorValue = xmlEntity.getDiscriminatorValue();
this.discriminatorColumn = this.buildDiscriminatorColumn();
@@ -505,50 +496,42 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
// ********** secondary tables **********
- public ListIterator<ReadOnlySecondaryTable> secondaryTables() {
- return this.getSecondaryTables().iterator();
- }
-
- protected ListIterable<ReadOnlySecondaryTable> getSecondaryTables() {
- return this.specifiedSecondaryTables.isEmpty() ?
+ public ListIterable<ReadOnlySecondaryTable> getSecondaryTables() {
+ return this.getSpecifiedSecondaryTablesSize() == 0 ?
this.getReadOnlyVirtualSecondaryTables() :
this.getReadOnlySpecifiedSecondaryTables();
}
- public int secondaryTablesSize() {
- return this.specifiedSecondaryTables.isEmpty() ?
- this.virtualSecondaryTables.size() :
- this.specifiedSecondaryTables.size();
+ public int getSecondaryTablesSize() {
+ return this.getSpecifiedSecondaryTablesSize() == 0 ?
+ this.getVirtualSecondaryTablesSize() :
+ this.getSpecifiedSecondaryTablesSize();
}
// ********** specified secondary tables **********
- public ListIterator<OrmSecondaryTable> specifiedSecondaryTables() {
- return this.getSpecifiedSecondaryTables().iterator();
- }
-
- protected ListIterable<OrmSecondaryTable> getSpecifiedSecondaryTables() {
- return new LiveCloneListIterable<OrmSecondaryTable>(this.specifiedSecondaryTables);
+ public ListIterable<OrmSecondaryTable> getSpecifiedSecondaryTables() {
+ return this.specifiedSecondaryTableContainer.getContextElements();
}
protected ListIterable<ReadOnlySecondaryTable> getReadOnlySpecifiedSecondaryTables() {
- return new LiveCloneListIterable<ReadOnlySecondaryTable>(this.specifiedSecondaryTables);
+ return new SuperListIterableWrapper<ReadOnlySecondaryTable>(this.getSpecifiedSecondaryTables());
}
- public int specifiedSecondaryTablesSize() {
- return this.specifiedSecondaryTables.size();
+ public int getSpecifiedSecondaryTablesSize() {
+ return this.specifiedSecondaryTableContainer.getContextElementsSize();
}
public OrmSecondaryTable addSpecifiedSecondaryTable() {
- return this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size());
+ return this.addSpecifiedSecondaryTable(this.getSpecifiedSecondaryTablesSize());
}
/**
* no state check
*/
protected OrmSecondaryTable addSpecifiedSecondaryTable_() {
- return this.addSpecifiedSecondaryTable_(this.specifiedSecondaryTables.size());
+ return this.addSpecifiedSecondaryTable_(this.getSpecifiedSecondaryTablesSize());
}
/**
@@ -566,7 +549,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
*/
protected OrmSecondaryTable addSpecifiedSecondaryTable_(int index) {
XmlSecondaryTable xmlSecondaryTable = this.buildXmlSecondaryTable();
- OrmSecondaryTable secondaryTable = this.addSpecifiedSecondaryTable_(index, xmlSecondaryTable);
+ OrmSecondaryTable secondaryTable = this.specifiedSecondaryTableContainer.addContextElement(index, xmlSecondaryTable);
this.xmlTypeMapping.getSecondaryTables().add(index, xmlSecondaryTable);
return secondaryTable;
}
@@ -576,108 +559,82 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
}
public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) {
- this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTables.indexOf(secondaryTable));
+ this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTableContainer.indexOfContextElement((OrmSecondaryTable) secondaryTable));
}
public void removeSpecifiedSecondaryTable(int index) {
- this.removeSpecifiedSecondaryTable_(index);
+ this.specifiedSecondaryTableContainer.removeContextElement(index);
this.xmlTypeMapping.getSecondaryTables().remove(index);
}
- protected void removeSpecifiedSecondaryTable_(int index) {
- this.removeItemFromList(index, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
- }
-
public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ this.specifiedSecondaryTableContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlTypeMapping.getSecondaryTables().move(targetIndex, sourceIndex);
}
- protected void initializeSpecifiedSecondaryTables() {
- for (XmlSecondaryTable xmlTable : this.getXmlSecondaryTables()) {
- this.specifiedSecondaryTables.add(this.buildSpecifiedSecondaryTable(xmlTable));
- }
- }
-
protected OrmSecondaryTable buildSpecifiedSecondaryTable(XmlSecondaryTable xmlSecondaryTable) {
return this.getContextNodeFactory().buildOrmSecondaryTable(this, this.secondaryTableOwner, xmlSecondaryTable);
}
protected void clearSpecifiedSecondaryTables() {
- this.clearList(this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
+ this.specifiedSecondaryTableContainer.clearContextList();
this.xmlTypeMapping.getSecondaryTables().clear();
}
protected void syncSpecifiedSecondaryTables() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedSecondaryTableContainerAdapter);
+ this.specifiedSecondaryTableContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlSecondaryTable> getXmlSecondaryTables() {
+ protected ListIterable<XmlSecondaryTable> getXmlSecondaryTables() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlSecondaryTable>(this.xmlTypeMapping.getSecondaryTables());
- }
-
- protected void moveSpecifiedSecondaryTable_(int index, OrmSecondaryTable secondaryTable) {
- this.moveItemInList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
- }
-
- protected OrmSecondaryTable addSpecifiedSecondaryTable_(int index, XmlSecondaryTable xmlSecondaryTable) {
- OrmSecondaryTable secondaryTable = this.buildSpecifiedSecondaryTable(xmlSecondaryTable);
- this.addItemToList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST);
- return secondaryTable;
+ return new LiveCloneListIterable<XmlSecondaryTable>(this.xmlTypeMapping.getSecondaryTables());
}
- protected void removeSpecifiedSecondaryTable_(OrmSecondaryTable secondaryTable) {
- this.removeSpecifiedSecondaryTable_(this.specifiedSecondaryTables.indexOf(secondaryTable));
+ protected ContextListContainer<OrmSecondaryTable, XmlSecondaryTable> buildSpecifiedSecondaryTableContainer() {
+ return new SpecifiedSecondaryTableContainer();
}
/**
- * specified secondary table container adapter
+ * specified secondary table container
*/
- protected class SpecifiedSecondaryTableContainerAdapter
- implements ContextContainerTools.Adapter<OrmSecondaryTable, XmlSecondaryTable>
+ protected class SpecifiedSecondaryTableContainer
+ extends ContextListContainer<OrmSecondaryTable, XmlSecondaryTable>
{
- public Iterable<OrmSecondaryTable> getContextElements() {
- return AbstractOrmEntity.this.getSpecifiedSecondaryTables();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_SECONDARY_TABLES_LIST;
+ }
+ @Override
+ protected OrmSecondaryTable buildContextElement(XmlSecondaryTable resourceElement) {
+ return AbstractOrmEntity.this.buildSpecifiedSecondaryTable(resourceElement);
}
- public Iterable<XmlSecondaryTable> getResourceElements() {
+ @Override
+ protected ListIterable<XmlSecondaryTable> getResourceElements() {
return AbstractOrmEntity.this.getXmlSecondaryTables();
}
- public XmlSecondaryTable getResourceElement(OrmSecondaryTable contextElement) {
+ @Override
+ protected XmlSecondaryTable getResourceElement(OrmSecondaryTable contextElement) {
return contextElement.getXmlTable();
}
- public void moveContextElement(int index, OrmSecondaryTable element) {
- AbstractOrmEntity.this.moveSpecifiedSecondaryTable_(index, element);
- }
- public void addContextElement(int index, XmlSecondaryTable resourceElement) {
- AbstractOrmEntity.this.addSpecifiedSecondaryTable_(index, resourceElement);
- }
- public void removeContextElement(OrmSecondaryTable element) {
- AbstractOrmEntity.this.removeSpecifiedSecondaryTable_(element);
- }
}
// ********** virtual secondary tables **********
- public ListIterator<OrmVirtualSecondaryTable> virtualSecondaryTables() {
- return this.getVirtualSecondaryTables().iterator();
- }
-
- protected ListIterable<OrmVirtualSecondaryTable> getVirtualSecondaryTables() {
- return new LiveCloneListIterable<OrmVirtualSecondaryTable>(this.virtualSecondaryTables);
+ public ListIterable<OrmVirtualSecondaryTable> getVirtualSecondaryTables() {
+ return this.virtualSecondaryTableContainer.getContextElements();
}
protected ListIterable<ReadOnlySecondaryTable> getReadOnlyVirtualSecondaryTables() {
- return new LiveCloneListIterable<ReadOnlySecondaryTable>(this.virtualSecondaryTables);
+ return new SuperListIterableWrapper<ReadOnlySecondaryTable>(this.getVirtualSecondaryTables());
}
- public int virtualSecondaryTablesSize() {
- return this.virtualSecondaryTables.size();
+ public int getVirtualSecondaryTablesSize() {
+ return this.virtualSecondaryTableContainer.getContextElementsSize();
}
protected void clearVirtualSecondaryTables() {
- this.clearList(this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST);
+ this.virtualSecondaryTableContainer.clearContextList();
}
/**
@@ -688,27 +645,25 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
* @see #getJavaSecondaryTablesForVirtuals()
*/
protected void updateVirtualSecondaryTables() {
- ContextContainerTools.update(this.virtualSecondaryTableContainerAdapter);
+ this.virtualSecondaryTableContainer.update();
}
- protected Iterable<JavaSecondaryTable> getJavaSecondaryTablesForVirtuals() {
- if (this.specifiedSecondaryTables.size() > 0) {
- return EmptyIterable.instance();
+ protected ListIterable<JavaSecondaryTable> getJavaSecondaryTablesForVirtuals() {
+ if (this.getSpecifiedSecondaryTablesSize() > 0) {
+ return EmptyListIterable.instance();
}
JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
return (javaEntity == null) ?
- EmptyIterable.<JavaSecondaryTable>instance() :
- CollectionTools.iterable(javaEntity.secondaryTables());
+ EmptyListIterable.<JavaSecondaryTable>instance() :
+ javaEntity.getSecondaryTables();
}
protected void moveVirtualSecondaryTable(int index, OrmVirtualSecondaryTable secondaryTable) {
- this.moveItemInList(index, secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST);
+ this.virtualSecondaryTableContainer.moveContextElement(index, secondaryTable);
}
protected OrmVirtualSecondaryTable addVirtualSecondaryTable(int index, JavaSecondaryTable javaSecondaryTable) {
- OrmVirtualSecondaryTable secondaryTable = this.buildVirtualSecondaryTable(javaSecondaryTable);
- this.addItemToList(index, secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST);
- return secondaryTable;
+ return this.virtualSecondaryTableContainer.addContextElement(index, javaSecondaryTable);
}
protected OrmVirtualSecondaryTable buildVirtualSecondaryTable(JavaSecondaryTable javaSecondaryTable) {
@@ -716,33 +671,35 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
}
protected void removeVirtualSecondaryTable(OrmVirtualSecondaryTable secondaryTable) {
- this.removeItemFromList(secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST);
+ this.virtualSecondaryTableContainer.removeContextElement(secondaryTable);
+ }
+
+ protected ContextListContainer<OrmVirtualSecondaryTable, JavaSecondaryTable> buildVirtualSecondaryTableContainer() {
+ return new VirtualSecondaryTableContainer();
}
/**
- * virtual secondary table container adapter
+ * virtual secondary table container
*/
- protected class VirtualSecondaryTableContainerAdapter
- implements ContextContainerTools.Adapter<OrmVirtualSecondaryTable, JavaSecondaryTable>
+ protected class VirtualSecondaryTableContainer
+ extends ContextListContainer<OrmVirtualSecondaryTable, JavaSecondaryTable>
{
- public Iterable<OrmVirtualSecondaryTable> getContextElements() {
- return AbstractOrmEntity.this.getVirtualSecondaryTables();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_SECONDARY_TABLES_LIST;
+ }
+ @Override
+ protected OrmVirtualSecondaryTable buildContextElement(JavaSecondaryTable resourceElement) {
+ return AbstractOrmEntity.this.buildVirtualSecondaryTable(resourceElement);
}
- public Iterable<JavaSecondaryTable> getResourceElements() {
+ @Override
+ protected ListIterable<JavaSecondaryTable> getResourceElements() {
return AbstractOrmEntity.this.getJavaSecondaryTablesForVirtuals();
}
- public JavaSecondaryTable getResourceElement(OrmVirtualSecondaryTable contextElement) {
+ @Override
+ protected JavaSecondaryTable getResourceElement(OrmVirtualSecondaryTable contextElement) {
return contextElement.getOverriddenTable();
}
- public void moveContextElement(int index, OrmVirtualSecondaryTable element) {
- AbstractOrmEntity.this.moveVirtualSecondaryTable(index, element);
- }
- public void addContextElement(int index, JavaSecondaryTable resourceElement) {
- AbstractOrmEntity.this.addVirtualSecondaryTable(index, resourceElement);
- }
- public void removeContextElement(OrmVirtualSecondaryTable element) {
- AbstractOrmEntity.this.removeVirtualSecondaryTable(element);
- }
}
@@ -754,7 +711,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
* all (implying they are defined in XML).
*/
public boolean secondaryTablesAreDefinedInXml() {
- return this.virtualSecondaryTables.isEmpty();
+ return this.getVirtualSecondaryTablesSize() == 0;
}
public void setSecondaryTablesAreDefinedInXml(boolean defineInXml) {
@@ -777,8 +734,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
* before calling {@link #addSpecifiedSecondaryTable()}.
*/
protected void specifySecondaryTablesInXml() {
- Iterable<OrmVirtualSecondaryTable> oldVirtualSecondaryTables = new SnapshotCloneIterable<OrmVirtualSecondaryTable>(this.virtualSecondaryTables);
- for (OrmVirtualSecondaryTable oldVirtualSecondaryTable : oldVirtualSecondaryTables) {
+ for (OrmVirtualSecondaryTable oldVirtualSecondaryTable : getVirtualSecondaryTables()) {
this.addSpecifiedSecondaryTable_().initializeFrom(oldVirtualSecondaryTable);
}
// the virtual secondary tables will be cleared during the update
@@ -804,20 +760,16 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
// ********** primary key join columns **********
- public ListIterator<ReadOnlyPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumns().iterator();
- }
-
- protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumns.isEmpty() ?
+ public ListIterable<ReadOnlyPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return this.getSpecifiedPrimaryKeyJoinColumnsSize() == 0 ?
this.getDefaultPrimaryKeyJoinColumns() :
this.getReadOnlySpecifiedPrimaryKeyJoinColumns();
}
- public int primaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.isEmpty() ?
- this.defaultPrimaryKeyJoinColumnsSize() :
- this.specifiedPrimaryKeyJoinColumnsSize();
+ public int getPrimaryKeyJoinColumnsSize() {
+ return this.getSpecifiedPrimaryKeyJoinColumnsSize() == 0 ?
+ this.getDefaultPrimaryKeyJoinColumnsSize() :
+ this.getSpecifiedPrimaryKeyJoinColumnsSize();
}
protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlPkJoinColumn) {
@@ -827,31 +779,27 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
// ********** specified primary key join columns **********
- public ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
- }
-
- protected ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<OrmPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ public ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
}
protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getReadOnlySpecifiedPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<ReadOnlyPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ return new SuperListIterableWrapper<ReadOnlyPrimaryKeyJoinColumn>(this.getSpecifiedPrimaryKeyJoinColumns());
}
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
+ public int getSpecifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
}
public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
+ return this.addSpecifiedPrimaryKeyJoinColumn(this.getSpecifiedPrimaryKeyJoinColumnsSize());
}
public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
this.clearDefaultPrimaryKeyJoinColumns(); // could leave for update?
XmlPrimaryKeyJoinColumn xmlPkJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn pkJoinColumn = this.addSpecifiedPrimaryKeyJoinColumn_(index, xmlPkJoinColumn);
+ OrmPrimaryKeyJoinColumn pkJoinColumn = this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(index, xmlPkJoinColumn);
this.xmlTypeMapping.getPrimaryKeyJoinColumns().add(index, xmlPkJoinColumn);
return pkJoinColumn;
}
@@ -861,20 +809,16 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
}
public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn));
+ this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumnContainer.indexOfContextElement((OrmPrimaryKeyJoinColumn) primaryKeyJoinColumn));
}
public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- this.removeSpecifiedPrimaryKeyJoinColumn_(index);
+ this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(index);
this.xmlTypeMapping.getPrimaryKeyJoinColumns().remove(index);
}
- protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlTypeMapping.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
}
@@ -882,76 +826,54 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
return new PrimaryKeyJoinColumnOwner();
}
- protected void initializeSpecifiedPrimaryKeyJoinColumns() {
- for (XmlPrimaryKeyJoinColumn xmlPkJoinColumn : this.getXmlPrimaryKeyJoinColumns()) {
- this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlPkJoinColumn));
- }
- }
-
protected void syncSpecifiedPrimaryKeyJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ this.specifiedPrimaryKeyJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
+ protected ListIterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlPrimaryKeyJoinColumn>(this.xmlTypeMapping.getPrimaryKeyJoinColumns());
+ return new LiveCloneListIterable<XmlPrimaryKeyJoinColumn>(this.xmlTypeMapping.getPrimaryKeyJoinColumns());
}
- protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn pkJoinColumn) {
- this.moveItemInList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlPkJoinColumn) {
- OrmPrimaryKeyJoinColumn pkJoinColumn = this.buildPrimaryKeyJoinColumn(xmlPkJoinColumn);
- this.addItemToList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return pkJoinColumn;
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn pkJoinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(pkJoinColumn));
+ protected ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> buildSpecifiedPrimaryKeyJoinColumnContainer() {
+ return new SpecifiedPrimaryKeyJoinColumnContainer();
}
/**
- * specified primary key join column container adapter
+ * specified primary key join column container
*/
- protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
+ protected class SpecifiedPrimaryKeyJoinColumnContainer
+ extends ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
{
- public Iterable<OrmPrimaryKeyJoinColumn> getContextElements() {
- return AbstractOrmEntity.this.getSpecifiedPrimaryKeyJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected OrmPrimaryKeyJoinColumn buildContextElement(XmlPrimaryKeyJoinColumn resourceElement) {
+ return AbstractOrmEntity.this.buildPrimaryKeyJoinColumn(resourceElement);
}
- public Iterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
+ @Override
+ protected ListIterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
return AbstractOrmEntity.this.getXmlPrimaryKeyJoinColumns();
}
- public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
+ @Override
+ protected XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
return contextElement.getXmlColumn();
}
- public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) {
- AbstractOrmEntity.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) {
- AbstractOrmEntity.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmPrimaryKeyJoinColumn element) {
- AbstractOrmEntity.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
- }
}
// ********** default primary key join columns **********
- public ListIterator<ReadOnlyPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
- return this.getDefaultPrimaryKeyJoinColumns().iterator();
- }
-
- protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
+ public ListIterable<ReadOnlyPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
int virtualSize = this.virtualPrimaryKeyJoinColumns.size();
return (virtualSize != 0) ?
this.getReadOnlyVirtualPrimaryKeyJoinColumns() :
this.getReadOnlyDefaultPrimaryKeyJoinColumns();
}
- public int defaultPrimaryKeyJoinColumnsSize() {
+ public int getDefaultPrimaryKeyJoinColumnsSize() {
int virtualSize = this.virtualPrimaryKeyJoinColumns.size();
return (virtualSize != 0) ?
virtualSize :
@@ -982,12 +904,12 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
* Otherwise, there is a single, spec-defined, default pk join column.
*/
protected void updateDefaultPrimaryKeyJoinColumns() {
- if (this.specifiedPrimaryKeyJoinColumns.size() > 0) {
+ if (this.getSpecifiedPrimaryKeyJoinColumnsSize() > 0) {
// specified/java/default => specified
this.clearDefaultPrimaryKeyJoinColumns();
} else {
// specified
- if (this.defaultPrimaryKeyJoinColumnsSize() == 0) {
+ if (this.getDefaultPrimaryKeyJoinColumnsSize() == 0) {
if (this.javaPrimaryKeyJoinColumnsWillBeDefaults()) {
// specified => java
this.initializeVirtualPrimaryKeyJoinColumns();
@@ -1030,7 +952,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
*/
protected boolean javaPrimaryKeyJoinColumnsWillBeDefaults() {
JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
- return (javaEntity != null) && (javaEntity.primaryKeyJoinColumnsSize() > 0);
+ return (javaEntity != null) && (javaEntity.getPrimaryKeyJoinColumnsSize() > 0);
}
@@ -1067,7 +989,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
* @see #javaPrimaryKeyJoinColumnsWillBeDefaults()
*/
protected Iterable<JavaPrimaryKeyJoinColumn> getJavaPrimaryKeyJoinColumnsForVirtuals() {
- return CollectionTools.iterable(this.getJavaTypeMappingForDefaults().primaryKeyJoinColumns());
+ return this.getJavaTypeMappingForDefaults().getPrimaryKeyJoinColumns();
}
protected void moveVirtualPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
@@ -1716,32 +1638,32 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
* Return whether the type is abstract; false if no java type exists.
*/
protected boolean isAbstract() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- return (jrpt != null) && jrpt.isAbstract();
+ JavaResourceType jrt = this.getJavaResourceType();
+ return (jrt != null) && jrt.isAbstract();
}
/**
* Return whether the entity's type is abstract.
*/
protected boolean isFinal() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- return (jrpt != null) && jrpt.isFinal();
+ JavaResourceType jrt = this.getJavaResourceType();
+ return (jrt != null) && jrt.isFinal();
}
/**
* Return whether the entity's type is a member of another type.
*/
protected boolean isMember() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- return (jrpt != null) && jrpt.isMemberType();
+ JavaResourceType jrt = this.getJavaResourceType();
+ return (jrt != null) && jrt.isMemberType();
}
/**
* Return whether the entity's type is static.
*/
protected boolean isStatic() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- return (jrpt != null) && jrpt.isStatic();
+ JavaResourceType jrt = this.getJavaResourceType();
+ return (jrt != null) && jrt.isStatic();
}
@@ -2180,16 +2102,16 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
}
- public int joinColumnsSize() {
- return AbstractOrmEntity.this.primaryKeyJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return AbstractOrmEntity.this.getPrimaryKeyJoinColumnsSize();
}
public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return CollectionTools.contains(AbstractOrmEntity.this.defaultPrimaryKeyJoinColumns(), joinColumn);
+ return CollectionTools.contains(AbstractOrmEntity.this.getDefaultPrimaryKeyJoinColumns(), joinColumn);
}
public String getDefaultColumnName() {
- if (this.joinColumnsSize() != 1) {
+ if (this.getJoinColumnsSize() != 1) {
return null;
}
Entity parentEntity = AbstractOrmEntity.this.getParentEntity();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
index 64532a0496..50adca2b83 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
@@ -11,12 +11,8 @@ package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
@@ -29,7 +25,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationship;
import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer;
@@ -41,8 +36,7 @@ public abstract class AbstractOrmJoinColumnRelationshipStrategy
extends AbstractOrmXmlContextNode
implements OrmJoinColumnRelationshipStrategy
{
- protected final Vector<OrmJoinColumn> specifiedJoinColumns = new Vector<OrmJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter;
+ protected final ContextListContainer<OrmJoinColumn, XmlJoinColumn> specifiedJoinColumnContainer;
protected final OrmReadOnlyJoinColumn.Owner joinColumnOwner;
protected OrmJoinColumn defaultJoinColumn;
@@ -50,9 +44,8 @@ public abstract class AbstractOrmJoinColumnRelationshipStrategy
protected AbstractOrmJoinColumnRelationshipStrategy(OrmJoinColumnRelationship parent) {
super(parent);
- this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter();
+ this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
this.joinColumnOwner = this.buildJoinColumnOwner();
- this.initializeSpecifiedJoinColumns();
}
@@ -67,7 +60,7 @@ public abstract class AbstractOrmJoinColumnRelationshipStrategy
@Override
public void update() {
super.update();
- this.updateNodes(this.getSpecifiedJoinColumns());
+ this.updateNodes(getSpecifiedJoinColumns());
this.updateDefaultJoinColumn();
}
@@ -81,48 +74,40 @@ public abstract class AbstractOrmJoinColumnRelationshipStrategy
// ********** join columns **********
- public ListIterator<OrmJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<OrmJoinColumn> getJoinColumns() {
+ public ListIterable<OrmJoinColumn> getJoinColumns() {
return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
}
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
}
// ********** specified join columns **********
- public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
+ public ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
+ return this.specifiedJoinColumnContainer.getContextElements();
}
- protected ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<OrmJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
+ public int getSpecifiedJoinColumnsSize() {
+ return this.specifiedJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
+ return this.getSpecifiedJoinColumnsSize() != 0;
}
public OrmJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
+ return this.specifiedJoinColumnContainer.getContextElement(index);
}
public OrmJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
+ return this.addSpecifiedJoinColumn(this.getSpecifiedJoinColumnsSize());
}
public OrmJoinColumn addSpecifiedJoinColumn(int index) {
XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
- OrmJoinColumn joinColumn = this.addSpecifiedJoinColumn_(index, xmlJoinColumn);
+ OrmJoinColumn joinColumn = this.specifiedJoinColumnContainer.addContextElement(index, xmlJoinColumn);
this.getXmlJoinColumnContainer().getJoinColumns().add(index, xmlJoinColumn);
return joinColumn;
}
@@ -132,80 +117,54 @@ public abstract class AbstractOrmJoinColumnRelationshipStrategy
}
public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
+ this.removeSpecifiedJoinColumn(this.specifiedJoinColumnContainer.indexOfContextElement((OrmJoinColumn) joinColumn));
}
public void removeSpecifiedJoinColumn(int index) {
- this.removeSpecifiedJoinColumn_(index);
+ this.specifiedJoinColumnContainer.removeContextElement(index);
this.getXmlJoinColumnContainer().getJoinColumns().remove(index);
}
- protected void removeSpecifiedJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
this.getXmlJoinColumnContainer().getJoinColumns().move(targetIndex, sourceIndex);
}
- protected void initializeSpecifiedJoinColumns() {
- for (XmlJoinColumn xmlJoinColumn : this.getXmlJoinColumns()) {
- this.specifiedJoinColumns.add(this.buildJoinColumn(xmlJoinColumn));
- }
- }
-
protected void syncSpecifiedJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
+ this.specifiedJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlJoinColumn> getXmlJoinColumns() {
+ protected ListIterable<XmlJoinColumn> getXmlJoinColumns() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlJoinColumn>(this.getXmlJoinColumnContainer().getJoinColumns());
- }
-
- protected void moveSpecifiedJoinColumn_(int index, OrmJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected OrmJoinColumn addSpecifiedJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) {
- OrmJoinColumn joinColumn = this.buildJoinColumn(xmlJoinColumn);
- this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
+ return new LiveCloneListIterable<XmlJoinColumn>(this.getXmlJoinColumnContainer().getJoinColumns());
}
- protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() {
- return new SpecifiedJoinColumnContainerAdapter();
+ protected ContextListContainer<OrmJoinColumn, XmlJoinColumn> buildSpecifiedJoinColumnContainer() {
+ return new SpecifiedJoinColumnContainer();
}
/**
- * specified join column container adapter
+ * specified join column container
*/
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmJoinColumn, XmlJoinColumn>
+ protected class SpecifiedJoinColumnContainer
+ extends ContextListContainer<OrmJoinColumn, XmlJoinColumn>
{
- public Iterable<OrmJoinColumn> getContextElements() {
- return AbstractOrmJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected OrmJoinColumn buildContextElement(XmlJoinColumn resourceElement) {
+ return AbstractOrmJoinColumnRelationshipStrategy.this.buildJoinColumn(resourceElement);
}
- public Iterable<XmlJoinColumn> getResourceElements() {
+ @Override
+ protected ListIterable<XmlJoinColumn> getResourceElements() {
return AbstractOrmJoinColumnRelationshipStrategy.this.getXmlJoinColumns();
}
- public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
+ @Override
+ protected XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
return contextElement.getXmlColumn();
}
- public void moveContextElement(int index, OrmJoinColumn element) {
- AbstractOrmJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlJoinColumn resourceElement) {
- AbstractOrmJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmJoinColumn element) {
- AbstractOrmJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn_(element);
- }
}
protected abstract OrmReadOnlyJoinColumn.Owner buildJoinColumnOwner();
@@ -267,13 +226,13 @@ public abstract class AbstractOrmJoinColumnRelationshipStrategy
}
public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) {
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldStrategy.specifiedJoinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : oldStrategy.getSpecifiedJoinColumns()) {
this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
}
}
public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy virtualStrategy) {
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualStrategy.joinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : virtualStrategy.getJoinColumns()) {
this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
}
}
@@ -309,13 +268,13 @@ public abstract class AbstractOrmJoinColumnRelationshipStrategy
}
public void addStrategy() {
- if (this.specifiedJoinColumnsSize() == 0) {
+ if (this.getSpecifiedJoinColumnsSize() == 0) {
this.addSpecifiedJoinColumn();
}
}
public void removeStrategy() {
- for (int i = this.specifiedJoinColumns.size(); i-- > 0; ) {
+ for (int i = this.getSpecifiedJoinColumnsSize(); i-- > 0; ) {
this.removeSpecifiedJoinColumn(i);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java
index ca77373f5a..958060d508 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java
@@ -10,18 +10,15 @@
package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.List;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.context.Query;
import org.eclipse.jpt.jpa.core.context.QueryHint;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
@@ -45,8 +42,7 @@ public abstract class AbstractOrmQuery<X extends XmlQuery>
protected String query;
- protected final Vector<OrmQueryHint> hints = new Vector<OrmQueryHint>();
- protected final HintContainerAdapter hintContainerAdapter = new HintContainerAdapter();
+ protected final ContextListContainer<OrmQueryHint, XmlQueryHint> queryHintContainer;
protected AbstractOrmQuery(XmlContextNode parent, X xmlQuery) {
@@ -54,7 +50,7 @@ public abstract class AbstractOrmQuery<X extends XmlQuery>
this.xmlQuery = xmlQuery;
this.name = xmlQuery.getName();
this.query = this.getUnescapedQuery();
- this.initializeHints();
+ this.queryHintContainer = this.buildHintContainer();
}
// ********** synchronize/update **********
@@ -129,20 +125,20 @@ public abstract class AbstractOrmQuery<X extends XmlQuery>
// ********** hints **********
public ListIterable<OrmQueryHint> getHints() {
- return new LiveCloneListIterable<OrmQueryHint>(this.hints);
+ return this.queryHintContainer.getContextElements();
}
public int getHintsSize() {
- return this.hints.size();
+ return this.queryHintContainer.getContextElementsSize();
}
public OrmQueryHint addHint() {
- return this.addHint(this.hints.size());
+ return this.addHint(this.getHintsSize());
}
public OrmQueryHint addHint(int index) {
XmlQueryHint xmlHint = this.buildXmlQueryHint();
- OrmQueryHint hint = this.addHint_(index, xmlHint);
+ OrmQueryHint hint = this.queryHintContainer.addContextElement(index, xmlHint);
this.xmlQuery.getHints().add(index, xmlHint);
return hint;
}
@@ -152,80 +148,58 @@ public abstract class AbstractOrmQuery<X extends XmlQuery>
}
public void removeHint(QueryHint hint) {
- this.removeHint(this.hints.indexOf(hint));
+ this.removeHint(this.queryHintContainer.indexOfContextElement((OrmQueryHint) hint));
}
public void removeHint(int index) {
- this.removeHint_(index);
+ this.queryHintContainer.removeContextElement(index);
this.xmlQuery.getHints().remove(index);
}
- protected void removeHint_(int index) {
- this.removeItemFromList(index, this.hints, HINTS_LIST);
- }
-
public void moveHint(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.hints, HINTS_LIST);
+ this.queryHintContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlQuery.getHints().move(targetIndex, sourceIndex);
}
- protected void initializeHints() {
- for (XmlQueryHint xmlHint : this.getXmlHints()) {
- this.hints.add(this.buildHint(xmlHint));
- }
- }
-
protected OrmQueryHint buildHint(XmlQueryHint xmlHint) {
return this.getContextNodeFactory().buildOrmQueryHint(this, xmlHint);
}
protected void syncHints() {
- ContextContainerTools.synchronizeWithResourceModel(this.hintContainerAdapter);
+ this.queryHintContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlQueryHint> getXmlHints() {
+ protected ListIterable<XmlQueryHint> getXmlHints() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlQueryHint>(this.xmlQuery.getHints());
- }
-
- protected void moveHint_(int index, OrmQueryHint hint) {
- this.moveItemInList(index, hint, this.hints, HINTS_LIST);
+ return new LiveCloneListIterable<XmlQueryHint>(this.xmlQuery.getHints());
}
- protected OrmQueryHint addHint_(int index, XmlQueryHint xmlHint) {
- OrmQueryHint hint = this.buildHint(xmlHint);
- this.addItemToList(index, hint, this.hints, HINTS_LIST);
- return hint;
- }
-
- protected void removeHint_(OrmQueryHint hint) {
- this.removeHint_(this.hints.indexOf(hint));
+ protected ContextListContainer<OrmQueryHint, XmlQueryHint> buildHintContainer() {
+ return new HintContainer();
}
/**
- * hint container adapter
+ * query hint container
*/
- protected class HintContainerAdapter
- implements ContextContainerTools.Adapter<OrmQueryHint, XmlQueryHint>
+ protected class HintContainer
+ extends ContextListContainer<OrmQueryHint, XmlQueryHint>
{
- public Iterable<OrmQueryHint> getContextElements() {
- return AbstractOrmQuery.this.getHints();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return HINTS_LIST;
+ }
+ @Override
+ protected OrmQueryHint buildContextElement(XmlQueryHint resourceElement) {
+ return AbstractOrmQuery.this.buildHint(resourceElement);
}
- public Iterable<XmlQueryHint> getResourceElements() {
+ @Override
+ protected ListIterable<XmlQueryHint> getResourceElements() {
return AbstractOrmQuery.this.getXmlHints();
}
- public XmlQueryHint getResourceElement(OrmQueryHint contextElement) {
+ @Override
+ protected XmlQueryHint getResourceElement(OrmQueryHint contextElement) {
return contextElement.getXmlQueryHint();
}
- public void moveContextElement(int index, OrmQueryHint element) {
- AbstractOrmQuery.this.moveHint_(index, element);
- }
- public void addContextElement(int index, XmlQueryHint resourceElement) {
- AbstractOrmQuery.this.addHint_(index, resourceElement);
- }
- public void removeContextElement(OrmQueryHint element) {
- AbstractOrmQuery.this.removeHint_(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
index f400b4e027..796208c1c7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
@@ -14,7 +14,6 @@ import java.util.List;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
@@ -229,7 +228,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
if (entity == null) {
return null;
}
- for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(entity.getPersistentType().allAttributes())) {
+ for (ReadOnlyPersistentAttribute attribute : entity.getPersistentType().getAllAttributes()) {
AttributeMapping mapping = attribute.getMapping();
if (this.isOwnedBy(mapping)) {
return (RelationshipMapping) mapping;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java
index d7c3600bcc..49f3494e1e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java
@@ -11,14 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NameTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
@@ -27,7 +23,6 @@ import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmTable;
import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable;
@@ -65,8 +60,7 @@ public abstract class AbstractOrmTable<X extends AbstractXmlTable>
protected String specifiedCatalog;
protected String defaultCatalog;
- protected final Vector<OrmUniqueConstraint> uniqueConstraints = new Vector<OrmUniqueConstraint>();
- protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+ protected final UniqueConstraintContainer uniqueConstraintContainer;
// ********** constructor/initialization **********
@@ -82,7 +76,7 @@ public abstract class AbstractOrmTable<X extends AbstractXmlTable>
this.specifiedName = this.buildSpecifiedName();
this.specifiedSchema = this.buildSpecifiedSchema();
this.specifiedCatalog = this.buildSpecifiedCatalog();
- this.initializeUniqueContraints();
+ this.uniqueConstraintContainer = new UniqueConstraintContainer();
}
@@ -277,30 +271,26 @@ public abstract class AbstractOrmTable<X extends AbstractXmlTable>
// ********** unique constraints **********
- public ListIterator<OrmUniqueConstraint> uniqueConstraints() {
- return this.getUniqueConstraints().iterator();
+ public ListIterable<OrmUniqueConstraint> getUniqueConstraints() {
+ return this.uniqueConstraintContainer.getContextElements();
}
- protected ListIterable<OrmUniqueConstraint> getUniqueConstraints() {
- return new LiveCloneListIterable<OrmUniqueConstraint>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
+ public int getUniqueConstraintsSize() {
+ return this.uniqueConstraintContainer.getContextElementsSize();
}
public OrmUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraints.get(index);
+ return this.uniqueConstraintContainer.getContextElement(index);
}
public OrmUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.uniqueConstraints.size());
+ return this.addUniqueConstraint(this.getUniqueConstraintsSize());
}
public OrmUniqueConstraint addUniqueConstraint(int index) {
X xmlTable = this.getXmlTableForUpdate();
XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint();
- OrmUniqueConstraint constraint = this.addUniqueConstraint_(index, xmlConstraint);
+ OrmUniqueConstraint constraint = this.uniqueConstraintContainer.addContextElement(index, xmlConstraint);
xmlTable.getUniqueConstraints().add(index, xmlConstraint);
return constraint;
}
@@ -309,85 +299,58 @@ public abstract class AbstractOrmTable<X extends AbstractXmlTable>
return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
}
- public void removeUniqueConstraint(UniqueConstraint constraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(constraint));
+ public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ this.removeUniqueConstraint(this.uniqueConstraintContainer.indexOfContextElement((OrmUniqueConstraint) uniqueConstraint));
}
public void removeUniqueConstraint(int index) {
- this.removeUniqueConstraint_(index);
+ this.uniqueConstraintContainer.removeContextElement(index);
this.getXmlTable().getUniqueConstraints().remove(index);
this.removeXmlTableIfUnset();
}
- protected void removeUniqueConstraint_(int index) {
- this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ this.uniqueConstraintContainer.moveContextElement(targetIndex, sourceIndex);
this.getXmlTable().getUniqueConstraints().move(targetIndex, sourceIndex);
}
- protected void initializeUniqueContraints() {
- for (XmlUniqueConstraint xmlConstraint : this.getXmlUniqueConstraints()) {
- this.uniqueConstraints.add(this.buildUniqueConstraint(xmlConstraint));
- }
- }
-
protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint xmlConstraint) {
return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, xmlConstraint);
}
protected void syncUniqueConstraints() {
- ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
+ this.uniqueConstraintContainer.synchronizeWithResourceModel();
}
-
- protected Iterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
+ protected ListIterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
X xmlTable = this.getXmlTable();
return (xmlTable == null) ?
- EmptyIterable.<XmlUniqueConstraint>instance() :
+ EmptyListIterable.<XmlUniqueConstraint>instance() :
// clone to reduce chance of concurrency problems
- new LiveCloneIterable<XmlUniqueConstraint>(xmlTable.getUniqueConstraints());
- }
-
- protected void moveUniqueConstraint_(int index, OrmUniqueConstraint constraint) {
- this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected OrmUniqueConstraint addUniqueConstraint_(int index, XmlUniqueConstraint xmlConstraint) {
- OrmUniqueConstraint constraint = this.buildUniqueConstraint(xmlConstraint);
- this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- return constraint;
- }
-
- protected void removeUniqueConstraint_(OrmUniqueConstraint constraint) {
- this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(constraint));
+ new LiveCloneListIterable<XmlUniqueConstraint>(xmlTable.getUniqueConstraints());
}
/**
- * unique constraint container adapter
+ * unique constraint container
*/
- protected class UniqueConstraintContainerAdapter
- implements ContextContainerTools.Adapter<OrmUniqueConstraint, XmlUniqueConstraint>
+ protected class UniqueConstraintContainer
+ extends ContextListContainer<OrmUniqueConstraint, XmlUniqueConstraint>
{
- public Iterable<OrmUniqueConstraint> getContextElements() {
- return AbstractOrmTable.this.getUniqueConstraints();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return UNIQUE_CONSTRAINTS_LIST;
}
- public Iterable<XmlUniqueConstraint> getResourceElements() {
+ @Override
+ protected OrmUniqueConstraint buildContextElement(XmlUniqueConstraint resourceElement) {
+ return AbstractOrmTable.this.buildUniqueConstraint(resourceElement);
+ }
+ @Override
+ protected ListIterable<XmlUniqueConstraint> getResourceElements() {
return AbstractOrmTable.this.getXmlUniqueConstraints();
}
- public XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
+ @Override
+ protected XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
return contextElement.getXmlUniqueConstraint();
}
- public void moveContextElement(int index, OrmUniqueConstraint element) {
- AbstractOrmTable.this.moveUniqueConstraint_(index, element);
- }
- public void addContextElement(int index, XmlUniqueConstraint resourceElement) {
- AbstractOrmTable.this.addUniqueConstraint_(index, resourceElement);
- }
- public void removeContextElement(OrmUniqueConstraint element) {
- AbstractOrmTable.this.removeUniqueConstraint_(element);
- }
}
@@ -516,7 +479,7 @@ public abstract class AbstractOrmTable<X extends AbstractXmlTable>
this.setSpecifiedName(oldTable.getSpecifiedName());
this.setSpecifiedCatalog(oldTable.getSpecifiedCatalog());
this.setSpecifiedSchema(oldTable.getSpecifiedSchema());
- for (ReadOnlyUniqueConstraint constraint : CollectionTools.iterable(oldTable.uniqueConstraints())) {
+ for (ReadOnlyUniqueConstraint constraint : oldTable.getUniqueConstraints()) {
this.addUniqueConstraint().initializeFrom(constraint);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
index de5b1394d1..f0931efcdf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
@@ -13,6 +13,7 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -40,7 +41,6 @@ import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.Table;
@@ -186,9 +186,9 @@ public abstract class AbstractOrmTypeMapping<X extends XmlTypeMapping>
return this.getPersistentType().getJavaPersistentType();
}
- protected JavaResourcePersistentType getJavaResourcePersistentType() {
+ protected JavaResourceType getJavaResourceType() {
JavaPersistentType javaType = this.getJavaPersistentType();
- return (javaType == null) ? null : javaType.getResourcePersistentType();
+ return (javaType == null) ? null : javaType.getJavaResourceType();
}
public boolean isMapped() {
@@ -245,7 +245,7 @@ public abstract class AbstractOrmTypeMapping<X extends XmlTypeMapping>
}
public Iterator<AttributeMapping> attributeMappings() {
- return new TransformationIterator<OrmReadOnlyPersistentAttribute, AttributeMapping>(this.getPersistentType().attributes()) {
+ return new TransformationIterator<OrmReadOnlyPersistentAttribute, AttributeMapping>(this.getPersistentType().getAttributes()) {
@Override
protected AttributeMapping transform(OrmReadOnlyPersistentAttribute attribute) {
return attribute.getMapping();
@@ -467,7 +467,7 @@ public abstract class AbstractOrmTypeMapping<X extends XmlTypeMapping>
}
protected JptValidator buildTypeMappingValidator() {
- return new GenericTypeMappingValidator(this, this.getJavaResourcePersistentType(), this.buildTextRangeResolver());
+ return new GenericTypeMappingValidator(this, this.getJavaResourceType(), this.buildTextRangeResolver());
}
protected TypeMappingTextRangeResolver buildTextRangeResolver() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
index 52387a012a..54bb896f70 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
@@ -10,20 +10,16 @@
package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
import org.eclipse.jpt.jpa.core.context.VirtualReferenceTable;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -31,16 +27,16 @@ public abstract class AbstractOrmVirtualReferenceTable<T extends ReadOnlyReferen
extends AbstractOrmVirtualTable<T>
implements VirtualReferenceTable
{
- protected final Vector<OrmVirtualJoinColumn> specifiedJoinColumns = new Vector<OrmVirtualJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
+ protected final ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> specifiedJoinColumnContainer;
protected final OrmReadOnlyJoinColumn.Owner joinColumnOwner;
protected OrmVirtualJoinColumn defaultJoinColumn;
- protected AbstractOrmVirtualReferenceTable(XmlContextNode parent, Owner owner) {
- super(parent, owner);
+ protected AbstractOrmVirtualReferenceTable(XmlContextNode parent, Owner owner, T overridenTable) {
+ super(parent, owner, overridenTable);
this.joinColumnOwner = this.buildJoinColumnOwner();
+ this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
}
@@ -56,87 +52,79 @@ public abstract class AbstractOrmVirtualReferenceTable<T extends ReadOnlyReferen
// ********** join columns **********
- public ListIterator<OrmVirtualJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<OrmVirtualJoinColumn> getJoinColumns() {
+ public ListIterable<OrmVirtualJoinColumn> getJoinColumns() {
return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
}
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
}
// ********** specified join columns **********
- public ListIterator<OrmVirtualJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
+ public ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns() {
+ return this.specifiedJoinColumnContainer.getContextElements();
}
- protected ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<OrmVirtualJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
+ public int getSpecifiedJoinColumnsSize() {
+ return this.specifiedJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
+ return this.getSpecifiedJoinColumnsSize() != 0;
}
public OrmVirtualJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
+ return this.specifiedJoinColumnContainer.getContextElement(index);
}
protected void updateSpecifiedJoinColumns() {
- ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter);
+ this.specifiedJoinColumnContainer.update();
}
- protected Iterable<ReadOnlyJoinColumn> getOverriddenJoinColumns() {
- return CollectionTools.iterable(this.getOverriddenTable().specifiedJoinColumns());
+ protected ListIterable<ReadOnlyJoinColumn> getOverriddenJoinColumns() {
+ return new SuperListIterableWrapper<ReadOnlyJoinColumn>(this.getOverriddenTable().getSpecifiedJoinColumns());
}
protected void moveSpecifiedJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.moveContextElement(index, joinColumn);
}
protected OrmVirtualJoinColumn addSpecifiedJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- OrmVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn);
- this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return virtualJoinColumn;
+ return this.specifiedJoinColumnContainer.addContextElement(index, joinColumn);
}
protected void removeSpecifiedJoinColumn(OrmVirtualJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.removeContextElement(joinColumn);
+ }
+
+ protected ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedJoinColumnContainer() {
+ return new SpecifiedJoinColumnContainer();
}
/**
- * specified join column container adapter
+ * specified join column container
*/
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
+ protected class SpecifiedJoinColumnContainer
+ extends ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
{
- public Iterable<OrmVirtualJoinColumn> getContextElements() {
- return AbstractOrmVirtualReferenceTable.this.getSpecifiedJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected OrmVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
+ return AbstractOrmVirtualReferenceTable.this.buildJoinColumn(resourceElement);
}
- public Iterable<ReadOnlyJoinColumn> getResourceElements() {
+ @Override
+ protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
return AbstractOrmVirtualReferenceTable.this.getOverriddenJoinColumns();
}
- public ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
+ @Override
+ protected ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
return contextElement.getOverriddenColumn();
}
- public void moveContextElement(int index, OrmVirtualJoinColumn element) {
- AbstractOrmVirtualReferenceTable.this.moveSpecifiedJoinColumn(index, element);
- }
- public void addContextElement(int index, ReadOnlyJoinColumn element) {
- AbstractOrmVirtualReferenceTable.this.addSpecifiedJoinColumn(index, element);
- }
- public void removeContextElement(OrmVirtualJoinColumn element) {
- AbstractOrmVirtualReferenceTable.this.removeSpecifiedJoinColumn(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java
index 451233658e..6024883875 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java
@@ -10,20 +10,16 @@
package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NameTools;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
import org.eclipse.jpt.jpa.core.context.VirtualTable;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
import org.eclipse.jpt.jpa.db.Catalog;
@@ -38,6 +34,8 @@ public abstract class AbstractOrmVirtualTable<T extends ReadOnlyTable>
{
protected final Owner owner;
+ protected final T overriddenTable;
+
protected String specifiedName;
protected String defaultName;
@@ -47,13 +45,14 @@ public abstract class AbstractOrmVirtualTable<T extends ReadOnlyTable>
protected String specifiedCatalog;
protected String defaultCatalog;
- protected final Vector<OrmVirtualUniqueConstraint> uniqueConstraints = new Vector<OrmVirtualUniqueConstraint>();
- protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+ protected final ContextListContainer<OrmVirtualUniqueConstraint, ReadOnlyUniqueConstraint> uniqueConstraintContainer;
- protected AbstractOrmVirtualTable(XmlContextNode parent, Owner owner) {
+ protected AbstractOrmVirtualTable(XmlContextNode parent, Owner owner, T overridenTable) {
super(parent);
this.owner = owner;
+ this.overriddenTable = overridenTable;
+ this.uniqueConstraintContainer = this.buildUniqueConstraintContainer();
}
@@ -81,7 +80,9 @@ public abstract class AbstractOrmVirtualTable<T extends ReadOnlyTable>
/**
* This should never return <code>null</code>.
*/
- public abstract T getOverriddenTable();
+ public T getOverriddenTable() {
+ return this.overriddenTable;
+ }
// ********** name **********
@@ -185,38 +186,32 @@ public abstract class AbstractOrmVirtualTable<T extends ReadOnlyTable>
// ********** unique constraints **********
- public ListIterator<OrmVirtualUniqueConstraint> uniqueConstraints() {
- return this.getUniqueConstraints().iterator();
+ public ListIterable<OrmVirtualUniqueConstraint> getUniqueConstraints() {
+ return this.uniqueConstraintContainer.getContextElements();
}
- protected ListIterable<OrmVirtualUniqueConstraint> getUniqueConstraints() {
- return new LiveCloneListIterable<OrmVirtualUniqueConstraint>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
+ public int getUniqueConstraintsSize() {
+ return this.uniqueConstraintContainer.getContextElementsSize();
}
public OrmVirtualUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraints.get(index);
+ return this.uniqueConstraintContainer.getContextElement(index);
}
protected void updateUniqueConstraints() {
- ContextContainerTools.update(this.uniqueConstraintContainerAdapter);
+ this.uniqueConstraintContainer.update();
}
- protected Iterable<ReadOnlyUniqueConstraint> getOverriddenUniqueConstraints() {
- return CollectionTools.iterable(this.getOverriddenTable().uniqueConstraints());
+ protected ListIterable<ReadOnlyUniqueConstraint> getOverriddenUniqueConstraints() {
+ return new SuperListIterableWrapper<ReadOnlyUniqueConstraint>(this.getOverriddenTable().getUniqueConstraints());
}
protected void moveUniqueConstraint(int index, OrmVirtualUniqueConstraint constraint) {
- this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ this.uniqueConstraintContainer.moveContextElement(index, constraint);
}
protected OrmVirtualUniqueConstraint addUniqueConstraint(int index, ReadOnlyUniqueConstraint uniqueConstraint) {
- OrmVirtualUniqueConstraint virtualConstraint = this.buildUniqueConstraint(uniqueConstraint);
- this.addItemToList(index, virtualConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- return virtualConstraint;
+ return this.uniqueConstraintContainer.addContextElement(index, uniqueConstraint);
}
protected OrmVirtualUniqueConstraint buildUniqueConstraint(ReadOnlyUniqueConstraint uniqueConstraint) {
@@ -224,33 +219,35 @@ public abstract class AbstractOrmVirtualTable<T extends ReadOnlyTable>
}
protected void removeUniqueConstraint(OrmVirtualUniqueConstraint constraint) {
- this.removeItemFromList(constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ this.uniqueConstraintContainer.removeContextElement(constraint);
+ }
+
+ protected ContextListContainer<OrmVirtualUniqueConstraint, ReadOnlyUniqueConstraint> buildUniqueConstraintContainer() {
+ return new UniqueConstraintContainer();
}
/**
- * unique constraint container adapter
+ * unique constraint container
*/
- protected class UniqueConstraintContainerAdapter
- implements ContextContainerTools.Adapter<OrmVirtualUniqueConstraint, ReadOnlyUniqueConstraint>
+ protected class UniqueConstraintContainer
+ extends ContextListContainer<OrmVirtualUniqueConstraint, ReadOnlyUniqueConstraint>
{
- public Iterable<OrmVirtualUniqueConstraint> getContextElements() {
- return AbstractOrmVirtualTable.this.getUniqueConstraints();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return UNIQUE_CONSTRAINTS_LIST;
+ }
+ @Override
+ protected OrmVirtualUniqueConstraint buildContextElement(ReadOnlyUniqueConstraint resourceElement) {
+ return AbstractOrmVirtualTable.this.buildUniqueConstraint(resourceElement);
}
- public Iterable<ReadOnlyUniqueConstraint> getResourceElements() {
+ @Override
+ protected ListIterable<ReadOnlyUniqueConstraint> getResourceElements() {
return AbstractOrmVirtualTable.this.getOverriddenUniqueConstraints();
}
- public ReadOnlyUniqueConstraint getResourceElement(OrmVirtualUniqueConstraint contextElement) {
+ @Override
+ protected ReadOnlyUniqueConstraint getResourceElement(OrmVirtualUniqueConstraint contextElement) {
return contextElement.getOverriddenUniqueConstraint();
}
- public void moveContextElement(int index, OrmVirtualUniqueConstraint element) {
- AbstractOrmVirtualTable.this.moveUniqueConstraint(index, element);
- }
- public void addContextElement(int index, ReadOnlyUniqueConstraint resourceElement) {
- AbstractOrmVirtualTable.this.addUniqueConstraint(index, resourceElement);
- }
- public void removeContextElement(OrmVirtualUniqueConstraint element) {
- AbstractOrmVirtualTable.this.removeUniqueConstraint(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
index 6281f21c9b..7f2099dbe4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.orm;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
@@ -129,7 +131,6 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualOverr
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualUniqueConstraint;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.UnsupportedOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
@@ -197,10 +198,14 @@ public abstract class AbstractOrmXmlContextNodeFactory
return new GenericOrmPersistentAttribute(parent, xmlMapping);
}
- public OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourcePersistentAttribute) {
- return new VirtualOrmPersistentAttribute(parent, javaResourcePersistentAttribute);
+ public OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentField(OrmPersistentType parent, JavaResourceField javaResourceField) {
+ return new VirtualOrmPersistentAttribute(parent, javaResourceField);
}
-
+
+ public OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentProperty(OrmPersistentType parent, JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
+ return new VirtualOrmPersistentAttribute(parent, javaResourceGetter, javaResourceSetter);
+ }
+
public OrmTable buildOrmTable(OrmEntity parent, Table.Owner owner) {
return new GenericOrmTable(parent, owner);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
index c42c4892dc..e0e6b9c98b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
@@ -10,11 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.List;
-
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
@@ -29,7 +31,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer;
@@ -203,7 +204,7 @@ public class GenericOrmIdClassReference
* @see #syncIdClass()
*/
protected void updateIdClass() {
- JavaResourcePersistentType resourceIdClass = this.resolveJavaResourceIdClass();
+ JavaResourceType resourceIdClass = this.resolveJavaResourceIdClass();
if (resourceIdClass == null) {
if (this.idClass != null) {
this.idClass.dispose();
@@ -213,7 +214,7 @@ public class GenericOrmIdClassReference
if (this.idClass == null) {
this.setIdClass(this.buildIdClass(resourceIdClass));
} else {
- if (this.idClass.getResourcePersistentType() == resourceIdClass) {
+ if (this.idClass.getJavaResourceType() == resourceIdClass) {
this.idClass.update();
} else {
this.idClass.dispose();
@@ -225,16 +226,20 @@ public class GenericOrmIdClassReference
// TODO I'm not sure we should be go to the entity mappings to resolve
// our name if it is taken from the Java ID class reference...
- protected JavaResourcePersistentType resolveJavaResourceIdClass() {
+ protected JavaResourceType resolveJavaResourceIdClass() {
String idClassName = this.getIdClassName();
if (idClassName == null) {
return null;
}
- JavaResourcePersistentType jrpt = this.getEntityMappings().resolveJavaResourcePersistentType(idClassName);
- return (jrpt == null) ? null : (jrpt.isMapped() ? null : jrpt);
+ JavaResourceAbstractType jrat = this.getEntityMappings().resolveJavaResourceType(idClassName);
+ if (jrat == null || jrat.getKind() != Kind.TYPE) {
+ return null;
+ }
+ JavaResourceType jrt = (JavaResourceType) jrat;
+ return jrt.isAnnotatedWith(getJpaProject().getTypeMappingAnnotations()) ? null : jrt;
}
- protected JavaPersistentType buildIdClass(JavaResourcePersistentType resourceIdClass) {
+ protected JavaPersistentType buildIdClass(JavaResourceType resourceIdClass) {
return this.getJpaFactory().buildJavaPersistentType(this, resourceIdClass);
}
@@ -328,13 +333,13 @@ public class GenericOrmIdClassReference
protected void validateIdClass(List<IMessage> messages, IReporter reporter) {
IJavaProject javaProject = getJpaProject().getJavaProject();
if (this.isSpecified()) {
- JavaResourcePersistentType jrpt = getJpaProject().getJavaResourcePersistentType(this.getIdClassName());
- if ((jrpt != null) && (jrpt.isMapped())) {
+ JavaResourceType jrt = (JavaResourceType) getJpaProject().getJavaResourceType(this.getIdClassName(), Kind.TYPE);
+ if ((jrt != null) && (jrt.isAnnotatedWith(getJpaProject().getTypeMappingAnnotations()))) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
JpaValidationMessages.TYPE_MAPPING_ID_CLASS_NOT_VALID,
- new String[] {jrpt.getName()},
+ new String[] {jrt.getName()},
this,
this.getValidationTextRange()
)
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
index b686e08619..d05d1c81fb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
@@ -156,8 +156,8 @@ public class GenericOrmMappingJoinColumnRelationshipStrategy
return GenericOrmMappingJoinColumnRelationshipStrategy.this.defaultJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericOrmMappingJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmMappingJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
index 3863f7e8f3..d01a46ca29 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
@@ -197,7 +197,7 @@ public class GenericOrmOneToOneRelationship
public boolean mayHaveDefaultJoinColumn() {
return (this.mappedByStrategy.getMappedByAttribute() == null) &&
- (this.primaryKeyJoinColumnStrategy.primaryKeyJoinColumnsSize() == 0) &&
+ (this.primaryKeyJoinColumnStrategy.getPrimaryKeyJoinColumnsSize() == 0) &&
(this.joinTableStrategy.getJoinTable() == null);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
index 937fbcb0b0..00be65dc16 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
@@ -175,8 +175,8 @@ public class GenericOrmOverrideJoinColumnRelationshipStrategy
return false;
}
- public int joinColumnsSize() {
- return GenericOrmOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
index 62b5d863f7..8112e55410 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
@@ -11,11 +11,8 @@ package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
@@ -29,7 +26,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationship;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator;
@@ -47,16 +43,14 @@ public class GenericOrmPrimaryKeyJoinColumnRelationshipStrategy
extends AbstractOrmXmlContextNode
implements OrmMappingPrimaryKeyJoinColumnRelationshipStrategy2_0
{
- protected final Vector<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
- protected final PrimaryKeyJoinColumnContainerAdapter primaryKeyJoinColumnContainerAdapter;
+ protected final PrimaryKeyJoinColumnContainer primaryKeyJoinColumnContainer;
protected final OrmReadOnlyJoinColumn.Owner primaryKeyJoinColumnOwner;
public GenericOrmPrimaryKeyJoinColumnRelationshipStrategy(OrmPrimaryKeyJoinColumnRelationship parent) {
super(parent);
- this.primaryKeyJoinColumnContainerAdapter = this.buildPrimaryKeyJoinColumnContainerAdapter();
+ this.primaryKeyJoinColumnContainer = new PrimaryKeyJoinColumnContainer();
this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.initializePrimaryKeyJoinColumns();
}
@@ -77,33 +71,29 @@ public class GenericOrmPrimaryKeyJoinColumnRelationshipStrategy
// ********** primary key join columns **********
- public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumns().iterator();
+ public ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ return this.primaryKeyJoinColumnContainer.getContextElements();
}
- protected ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<OrmPrimaryKeyJoinColumn>(this.primaryKeyJoinColumns);
- }
-
- public int primaryKeyJoinColumnsSize() {
- return this.primaryKeyJoinColumns.size();
+ public int getPrimaryKeyJoinColumnsSize() {
+ return this.primaryKeyJoinColumnContainer.getContextElementsSize();
}
public boolean hasPrimaryKeyJoinColumns() {
- return this.primaryKeyJoinColumns.size() != 0;
+ return this.getPrimaryKeyJoinColumnsSize() != 0;
}
public OrmPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
- return this.primaryKeyJoinColumns.get(index);
+ return this.primaryKeyJoinColumnContainer.getContextElement(index);
}
public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn() {
- return this.addPrimaryKeyJoinColumn(this.primaryKeyJoinColumns.size());
+ return this.addPrimaryKeyJoinColumn(this.getPrimaryKeyJoinColumnsSize());
}
public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) {
XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn joinColumn = this.addPrimaryKeyJoinColumn_(index, xmlJoinColumn);
+ OrmPrimaryKeyJoinColumn joinColumn = this.primaryKeyJoinColumnContainer.addContextElement(index, xmlJoinColumn);
this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().add(index, xmlJoinColumn);
return joinColumn;
}
@@ -113,80 +103,51 @@ public class GenericOrmPrimaryKeyJoinColumnRelationshipStrategy
}
public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumns.indexOf(joinColumn));
+ this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumnContainer.indexOfContextElement((OrmPrimaryKeyJoinColumn) joinColumn));
}
public void removePrimaryKeyJoinColumn(int index) {
- this.removePrimaryKeyJoinColumn_(index);
+ this.primaryKeyJoinColumnContainer.removeContextElement(index);
this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().remove(index);
}
- protected void removePrimaryKeyJoinColumn_(int index) {
- this.removeItemFromList(index, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.primaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
}
- protected void initializePrimaryKeyJoinColumns() {
- for (XmlPrimaryKeyJoinColumn xmlJoinColumn : this.getXmlPrimaryKeyJoinColumns()) {
- this.primaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlJoinColumn));
- }
- }
protected void syncPrimaryKeyJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.primaryKeyJoinColumnContainerAdapter);
+ this.primaryKeyJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
+ protected ListIterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlPrimaryKeyJoinColumn>(this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns());
- }
-
- protected void movePrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlJoinColumn) {
- OrmPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(xmlJoinColumn);
- this.addItemToList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removePrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn joinColumn) {
- this.removePrimaryKeyJoinColumn_(this.primaryKeyJoinColumns.indexOf(joinColumn));
- }
-
- protected PrimaryKeyJoinColumnContainerAdapter buildPrimaryKeyJoinColumnContainerAdapter() {
- return new PrimaryKeyJoinColumnContainerAdapter();
+ return new LiveCloneListIterable<XmlPrimaryKeyJoinColumn>(this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns());
}
/**
- * primary key join column container adapter
+ * primary key join column container
*/
- protected class PrimaryKeyJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
+ protected class PrimaryKeyJoinColumnContainer
+ extends ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
{
- public Iterable<OrmPrimaryKeyJoinColumn> getContextElements() {
- return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return PRIMARY_KEY_JOIN_COLUMNS_LIST;
}
- public Iterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
+ @Override
+ protected OrmPrimaryKeyJoinColumn buildContextElement(XmlPrimaryKeyJoinColumn resourceElement) {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.buildPrimaryKeyJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getXmlPrimaryKeyJoinColumns();
}
- public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
+ @Override
+ protected XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
return contextElement.getXmlColumn();
}
- public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) {
- GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.movePrimaryKeyJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) {
- GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.addPrimaryKeyJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmPrimaryKeyJoinColumn element) {
- GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.removePrimaryKeyJoinColumn_(element);
- }
}
protected OrmReadOnlyJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
@@ -242,13 +203,13 @@ public class GenericOrmPrimaryKeyJoinColumnRelationshipStrategy
}
public void addStrategy() {
- if (this.primaryKeyJoinColumns.size() == 0) {
+ if (this.getPrimaryKeyJoinColumnsSize() == 0) {
this.addPrimaryKeyJoinColumn();
}
}
public void removeStrategy() {
- for (int i = this.primaryKeyJoinColumns.size(); i-- > 0; ) {
+ for (int i = this.getPrimaryKeyJoinColumnsSize(); i-- > 0; ) {
this.removePrimaryKeyJoinColumn(i);
}
}
@@ -330,8 +291,8 @@ public class GenericOrmPrimaryKeyJoinColumnRelationshipStrategy
return null;
}
- public int joinColumnsSize() {
- return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.primaryKeyJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumnsSize();
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java
index d4bcbdaca6..ebc7ca07dc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java
@@ -11,15 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
@@ -34,7 +31,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
@@ -49,18 +45,16 @@ public class GenericOrmVirtualJoinTable
extends AbstractOrmVirtualReferenceTable<ReadOnlyJoinTable>
implements OrmVirtualJoinTable
{
- protected final ReadOnlyJoinTable overriddenTable;
- protected final Vector<OrmVirtualJoinColumn> specifiedInverseJoinColumns = new Vector<OrmVirtualJoinColumn>();
- protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
+ protected final ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> specifiedInverseJoinColumnContainer;
protected final OrmReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
protected OrmVirtualJoinColumn defaultInverseJoinColumn;
public GenericOrmVirtualJoinTable(OrmVirtualJoinTableRelationshipStrategy parent, Owner owner, ReadOnlyJoinTable overriddenTable) {
- super(parent, owner);
- this.overriddenTable = overriddenTable;
+ super(parent, owner, overriddenTable);
+ this.specifiedInverseJoinColumnContainer = this.buildSpecifiedInverseJoinColumnContainer();
this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
}
@@ -75,97 +69,81 @@ public class GenericOrmVirtualJoinTable
}
- // ********** table **********
-
- @Override
- public ReadOnlyJoinTable getOverriddenTable() {
- return this.overriddenTable;
- }
-
-
// ********** inverse join columns **********
- public ListIterator<OrmVirtualJoinColumn> inverseJoinColumns() {
- return this.getInverseJoinColumns().iterator();
- }
-
- protected ListIterable<OrmVirtualJoinColumn> getInverseJoinColumns() {
+ public ListIterable<OrmVirtualJoinColumn> getInverseJoinColumns() {
return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
}
- public int inverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
+ public int getInverseJoinColumnsSize() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
}
// ********** specified inverse join columns **********
- public ListIterator<OrmVirtualJoinColumn> specifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumns().iterator();
+ public ListIterable<OrmVirtualJoinColumn> getSpecifiedInverseJoinColumns() {
+ return this.specifiedInverseJoinColumnContainer.getContextElements();
}
- protected ListIterable<OrmVirtualJoinColumn> getSpecifiedInverseJoinColumns() {
- return new LiveCloneListIterable<OrmVirtualJoinColumn>(this.specifiedInverseJoinColumns);
- }
-
- public int specifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumns.size();
+ public int getSpecifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumns.size() != 0;
+ return this.getSpecifiedInverseJoinColumnsSize() != 0;
}
public OrmVirtualJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumns.get(index);
+ return this.specifiedInverseJoinColumnContainer.getContextElement(index);
}
protected void updateSpecifiedInverseJoinColumns() {
- ContextContainerTools.update(this.specifiedInverseJoinColumnContainerAdapter);
+ this.specifiedInverseJoinColumnContainer.update();
}
- protected Iterable<ReadOnlyJoinColumn> getOverriddenInverseJoinColumns() {
- return CollectionTools.iterable(this.getOverriddenTable().specifiedInverseJoinColumns());
+ protected ListIterable<ReadOnlyJoinColumn> getOverriddenInverseJoinColumns() {
+ return new SuperListIterableWrapper<ReadOnlyJoinColumn>(this.getOverriddenTable().getSpecifiedInverseJoinColumns());
}
protected void moveSpecifiedInverseJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.specifiedInverseJoinColumnContainer.moveContextElement(index, joinColumn);
}
protected OrmVirtualJoinColumn addSpecifiedInverseJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- OrmVirtualJoinColumn virtualJoinColumn = this.buildInverseJoinColumn(joinColumn);
- this.addItemToList(index, virtualJoinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- return virtualJoinColumn;
+ return this.specifiedInverseJoinColumnContainer.addContextElement(index, joinColumn);
}
protected void removeSpecifiedInverseJoinColumn(OrmVirtualJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.specifiedInverseJoinColumnContainer.removeContextElement(joinColumn);
+ }
+
+ protected ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedInverseJoinColumnContainer() {
+ return new SpecifiedInverseJoinColumnContainer();
}
/**
- * specified inverse join column container adapter
+ * specified inverse join column container
*/
- protected class SpecifiedInverseJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
+ protected class SpecifiedInverseJoinColumnContainer
+ extends ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
{
- public Iterable<OrmVirtualJoinColumn> getContextElements() {
- return GenericOrmVirtualJoinTable.this.getSpecifiedInverseJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_INVERSE_JOIN_COLUMNS_LIST;
}
- public Iterable<ReadOnlyJoinColumn> getResourceElements() {
+ @Override
+ protected OrmVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
+ return GenericOrmVirtualJoinTable.this.buildInverseJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
return GenericOrmVirtualJoinTable.this.getOverriddenInverseJoinColumns();
}
- public ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
+ @Override
+ protected ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
return contextElement.getOverriddenColumn();
}
- public void moveContextElement(int index, OrmVirtualJoinColumn element) {
- GenericOrmVirtualJoinTable.this.moveSpecifiedInverseJoinColumn(index, element);
- }
- public void addContextElement(int index, ReadOnlyJoinColumn element) {
- GenericOrmVirtualJoinTable.this.addSpecifiedInverseJoinColumn(index, element);
- }
- public void removeContextElement(OrmVirtualJoinColumn element) {
- GenericOrmVirtualJoinTable.this.removeSpecifiedInverseJoinColumn(element);
- }
}
@@ -358,8 +336,8 @@ public class GenericOrmVirtualJoinTable
return GenericOrmVirtualJoinTable.this.defaultJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericOrmVirtualJoinTable.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmVirtualJoinTable.this.getJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
@@ -408,8 +386,8 @@ public class GenericOrmVirtualJoinTable
return GenericOrmVirtualJoinTable.this.defaultInverseJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericOrmVirtualJoinTable.this.inverseJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmVirtualJoinTable.this.getInverseJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
index 17cabbf8c3..5a190d553b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
@@ -11,15 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
@@ -36,7 +32,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.db.Table;
@@ -47,8 +42,7 @@ public class GenericOrmVirtualOverrideJoinColumnRelationshipStrategy
extends AbstractOrmXmlContextNode
implements OrmVirtualJoinColumnRelationshipStrategy
{
- protected final Vector<OrmVirtualJoinColumn> specifiedJoinColumns = new Vector<OrmVirtualJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter;
+ protected final ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> specifiedJoinColumnContainer;
protected final OrmReadOnlyJoinColumn.Owner joinColumnOwner;
protected OrmVirtualJoinColumn defaultJoinColumn;
@@ -56,8 +50,8 @@ public class GenericOrmVirtualOverrideJoinColumnRelationshipStrategy
public GenericOrmVirtualOverrideJoinColumnRelationshipStrategy(OrmVirtualOverrideRelationship parent) {
super(parent);
- this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter();
this.joinColumnOwner = this.buildJoinColumnOwner();
+ this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
}
@@ -73,94 +67,82 @@ public class GenericOrmVirtualOverrideJoinColumnRelationshipStrategy
// ********** join columns **********
- public ListIterator<OrmVirtualJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<OrmVirtualJoinColumn> getJoinColumns() {
+ public ListIterable<OrmVirtualJoinColumn> getJoinColumns() {
return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
}
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
}
// ********** specified join columns **********
- public ListIterator<OrmVirtualJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
- }
-
- protected ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<OrmVirtualJoinColumn>(this.specifiedJoinColumns);
+ public ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns() {
+ return this.specifiedJoinColumnContainer.getContextElements();
}
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
+ public int getSpecifiedJoinColumnsSize() {
+ return this.specifiedJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
+ return this.getSpecifiedJoinColumnsSize() != 0;
}
public OrmVirtualJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
+ return this.specifiedJoinColumnContainer.getContextElement(index);
}
protected void updateSpecifiedJoinColumns() {
- ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter);
+ this.specifiedJoinColumnContainer.update();
}
- protected Iterable<ReadOnlyJoinColumn> getOverriddenSpecifiedJoinColumns() {
+ protected ListIterable<ReadOnlyJoinColumn> getOverriddenSpecifiedJoinColumns() {
ReadOnlyJoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
return (overriddenStrategy == null) ?
- EmptyIterable.<ReadOnlyJoinColumn>instance() :
- CollectionTools.iterable(overriddenStrategy.specifiedJoinColumns());
+ EmptyListIterable.<ReadOnlyJoinColumn>instance() :
+ new SuperListIterableWrapper<ReadOnlyJoinColumn>(overriddenStrategy.getSpecifiedJoinColumns());
}
protected void moveSpecifiedJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.moveContextElement(index, joinColumn);
}
protected OrmVirtualJoinColumn addSpecifiedJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- OrmVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn);
- this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return virtualJoinColumn;
+ return this.specifiedJoinColumnContainer.addContextElement(index, joinColumn);
}
protected void removeSpecifiedJoinColumn(OrmVirtualJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.removeContextElement(joinColumn);
}
- protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() {
- return new SpecifiedJoinColumnContainerAdapter();
+ protected ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedJoinColumnContainer() {
+ return new SpecifiedJoinColumnContainer();
}
/**
- * specified join column container adapter
+ * specified join column container
*/
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
+ protected class SpecifiedJoinColumnContainer
+ extends ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
{
- public Iterable<OrmVirtualJoinColumn> getContextElements() {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_JOIN_COLUMNS_LIST;
}
- public Iterable<ReadOnlyJoinColumn> getResourceElements() {
+ @Override
+ protected OrmVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.buildJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getOverriddenSpecifiedJoinColumns();
}
- public ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
+ @Override
+ protected ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
return contextElement.getOverriddenColumn();
}
- public void moveContextElement(int index, OrmVirtualJoinColumn element) {
- GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn(index, element);
- }
- public void addContextElement(int index, ReadOnlyJoinColumn resourceElement) {
- GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn(index, resourceElement);
- }
- public void removeContextElement(OrmVirtualJoinColumn element) {
- GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn(element);
- }
}
protected OrmReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
@@ -393,8 +375,8 @@ public class GenericOrmVirtualOverrideJoinColumnRelationshipStrategy
return false;
}
- public int joinColumnsSize() {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
index 57b6634afd..40963fec84 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
@@ -10,13 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
@@ -29,7 +25,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable;
import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
@@ -44,19 +39,17 @@ public class GenericOrmVirtualSecondaryTable
extends AbstractOrmVirtualTable<JavaSecondaryTable>
implements OrmVirtualSecondaryTable
{
- protected final JavaSecondaryTable overriddenTable;
- protected final Vector<OrmVirtualPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<OrmVirtualPrimaryKeyJoinColumn>();
- protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected final ContextListContainer<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumnContainer;
protected final OrmReadOnlyBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
protected OrmVirtualPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
public GenericOrmVirtualSecondaryTable(OrmEntity parent, Owner owner, JavaSecondaryTable overriddenTable) {
- super(parent, owner);
- this.overriddenTable = overriddenTable;
+ super(parent, owner, overriddenTable);
this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
+ this.specifiedPrimaryKeyJoinColumnContainer = this.buildSpecifiedPrimaryKeyJoinColumnContainer();
}
@@ -70,97 +63,81 @@ public class GenericOrmVirtualSecondaryTable
}
- // ********** table **********
-
- @Override
- public JavaSecondaryTable getOverriddenTable() {
- return this.overriddenTable;
- }
-
-
// ********** primary key join columns **********
- public ListIterator<OrmVirtualPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumns().iterator();
- }
-
- protected ListIterable<OrmVirtualPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ public ListIterable<OrmVirtualPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
}
- public int primaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
+ public int getPrimaryKeyJoinColumnsSize() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
}
// ********** specified primary key join columns **********
- public ListIterator<OrmVirtualPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
+ public ListIterable<OrmVirtualPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
}
- protected ListIterable<OrmVirtualPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<OrmVirtualPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
- }
-
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
+ public int getSpecifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumns.size() != 0;
+ return this.getSpecifiedPrimaryKeyJoinColumnsSize() != 0;
}
public OrmVirtualPrimaryKeyJoinColumn getSpecifiedPrimaryKeyJoinColumn(int index) {
- return this.specifiedPrimaryKeyJoinColumns.get(index);
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElement(index);
}
protected void updateSpecifiedPrimaryKeyJoinColumns() {
- ContextContainerTools.update(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ this.specifiedPrimaryKeyJoinColumnContainer.update();
}
- protected Iterable<JavaPrimaryKeyJoinColumn> getOverriddenPrimaryKeyJoinColumns() {
- return CollectionTools.iterable(this.getOverriddenTable().specifiedPrimaryKeyJoinColumns());
+ protected ListIterable<JavaPrimaryKeyJoinColumn> getOverriddenPrimaryKeyJoinColumns() {
+ return this.getOverriddenTable().getSpecifiedPrimaryKeyJoinColumns();
}
protected void moveSpecifiedPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
- this.moveItemInList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(index, pkJoinColumn);
}
protected OrmVirtualPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn javaColumn) {
- OrmVirtualPrimaryKeyJoinColumn virtualColumn = this.buildPrimaryKeyJoinColumn(javaColumn);
- this.addItemToList(index, virtualColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return virtualColumn;
+ return this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(index, javaColumn);
}
protected void removeSpecifiedPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
- this.removeItemFromList(pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(pkJoinColumn);
+ }
+
+ protected ContextListContainer<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn> buildSpecifiedPrimaryKeyJoinColumnContainer() {
+ return new SpecifiedPrimaryKeyJoinColumnContainer();
}
/**
- * specified primary key join column container adapter
+ * specified primary key join column container
*/
- protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn>
+ protected class SpecifiedPrimaryKeyJoinColumnContainer
+ extends ContextListContainer<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn>
{
- public Iterable<OrmVirtualPrimaryKeyJoinColumn> getContextElements() {
- return GenericOrmVirtualSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected OrmVirtualPrimaryKeyJoinColumn buildContextElement(JavaPrimaryKeyJoinColumn resourceElement) {
+ return GenericOrmVirtualSecondaryTable.this.buildPrimaryKeyJoinColumn(resourceElement);
}
- public Iterable<JavaPrimaryKeyJoinColumn> getResourceElements() {
+ @Override
+ protected ListIterable<JavaPrimaryKeyJoinColumn> getResourceElements() {
return GenericOrmVirtualSecondaryTable.this.getOverriddenPrimaryKeyJoinColumns();
}
- public JavaPrimaryKeyJoinColumn getResourceElement(OrmVirtualPrimaryKeyJoinColumn contextElement) {
+ @Override
+ protected JavaPrimaryKeyJoinColumn getResourceElement(OrmVirtualPrimaryKeyJoinColumn contextElement) {
return contextElement.getOverriddenColumn();
}
- public void moveContextElement(int index, OrmVirtualPrimaryKeyJoinColumn element) {
- GenericOrmVirtualSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn(index, element);
- }
- public void addContextElement(int index, JavaPrimaryKeyJoinColumn element) {
- GenericOrmVirtualSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn(index, element);
- }
- public void removeContextElement(OrmVirtualPrimaryKeyJoinColumn element) {
- GenericOrmVirtualSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn(element);
- }
}
@@ -282,7 +259,7 @@ public class GenericOrmVirtualSecondaryTable
}
public String getDefaultColumnName() {
- if (this.joinColumnsSize() != 1) {
+ if (this.getJoinColumnsSize() != 1) {
return null;
}
Entity parentEntity = this.getEntity().getParentEntity();
@@ -295,8 +272,8 @@ public class GenericOrmVirtualSecondaryTable
return GenericOrmVirtualSecondaryTable.this.getDbTable();
}
- public int joinColumnsSize() {
- return GenericOrmVirtualSecondaryTable.this.primaryKeyJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmVirtualSecondaryTable.this.getPrimaryKeyJoinColumnsSize();
}
public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
index 3f1fd262d0..6d23dc71b6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
@@ -12,8 +12,14 @@ package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.List;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.CollectionMapping;
@@ -29,13 +35,12 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
import org.eclipse.text.edits.ReplaceEdit;
@@ -173,6 +178,18 @@ public abstract class SpecifiedOrmPersistentAttribute
return this.getJavaPersistentAttribute();
}
+ public JavaResourceAttribute getJavaResourceAttribute() {
+ return this.javaPersistentAttribute == null ? null : this.javaPersistentAttribute.getResourceAttribute();
+ }
+
+ public boolean isFor(JavaResourceField javaResourceField) {
+ return getJavaPersistentAttribute() == null ? false : getJavaPersistentAttribute().isFor(javaResourceField);
+ }
+
+ public boolean isFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
+ return getJavaPersistentAttribute() == null ? false : getJavaPersistentAttribute().isFor(javaResourceGetter, javaResourceSetter);
+ }
+
protected void setJavaPersistentAttribute(JavaPersistentAttribute javaPersistentAttribute) {
JavaPersistentAttribute old = this.javaPersistentAttribute;
this.javaPersistentAttribute = javaPersistentAttribute;
@@ -206,16 +223,32 @@ public abstract class SpecifiedOrmPersistentAttribute
}
protected JavaPersistentAttribute getCachedJavaAttribute() {
- JavaResourcePersistentType javaResourceType = this.getOwningPersistentTypeJavaType().getResourcePersistentType();
- JavaResourcePersistentAttribute javaResourceAttribute = this.getJavaResourceAttribute(javaResourceType);
- if (javaResourceAttribute == null) {
- // nothing in the resource inheritance hierarchy matches our name *and* access type
- this.cachedJavaPersistentAttribute = null;
- } else {
- if ((this.cachedJavaPersistentAttribute == null) ||
- (this.cachedJavaPersistentAttribute.getResourcePersistentAttribute() != javaResourceAttribute)) {
- // cache is stale
- this.cachedJavaPersistentAttribute = this.buildJavaPersistentAttribute(javaResourceAttribute);
+ JavaResourceType javaResourceType = this.getOwningPersistentTypeJavaType().getJavaResourceType();
+ if (getAccess() == AccessType.FIELD) {
+ JavaResourceField javaResourceField = this.getJavaResourceField(javaResourceType);
+ if (javaResourceField == null) {
+ // nothing in the resource inheritance hierarchy matches our name *and* access type
+ this.cachedJavaPersistentAttribute = null;
+ } else {
+ if ((this.cachedJavaPersistentAttribute == null) ||
+ !(this.cachedJavaPersistentAttribute.isFor(javaResourceField))) {
+ // cache is stale
+ this.cachedJavaPersistentAttribute = this.buildJavaPersistentField(javaResourceField);
+ }
+ }
+ }
+ if (getAccess() == AccessType.PROPERTY) {
+ JavaResourceMethod javaResourceGetter = this.getJavaResourceGetter(javaResourceType);
+ JavaResourceMethod javaResourceSetter = AbstractJavaPersistentType.getValidSiblingSetMethod(javaResourceGetter, javaResourceType.getMethods());
+ if (javaResourceGetter == null && javaResourceSetter == null) {
+ // nothing in the resource inheritance hierarchy matches our name *and* access type
+ this.cachedJavaPersistentAttribute = null;
+ } else {
+ if ((this.cachedJavaPersistentAttribute == null) ||
+ !(this.cachedJavaPersistentAttribute.isFor(javaResourceGetter, javaResourceSetter))) {
+ // cache is stale
+ this.cachedJavaPersistentAttribute = this.buildJavaPersistentProperty(javaResourceGetter, javaResourceSetter);
+ }
}
}
return this.cachedJavaPersistentAttribute;
@@ -228,10 +261,10 @@ public abstract class SpecifiedOrmPersistentAttribute
* type does not have a corresponding attribute, search up its inheritance
* hierarchy.
*/
- protected JavaResourcePersistentAttribute getJavaResourceAttribute(JavaResourcePersistentType javaResourceType) {
- for (JavaResourcePersistentAttribute javaResourceAttribute : this.getJavaResourceAttributes(javaResourceType)) {
- if (javaResourceAttribute.getName().equals(this.getName())) {
- return javaResourceAttribute;
+ protected JavaResourceField getJavaResourceField(JavaResourceType javaResourceType) {
+ for (JavaResourceField javaResourceField : this.getJavaResourceFields(javaResourceType)) {
+ if (javaResourceField.getName().equals(this.getName())) {
+ return javaResourceField;
}
}
// climb up inheritance hierarchy
@@ -239,28 +272,74 @@ public abstract class SpecifiedOrmPersistentAttribute
if (superclassName == null) {
return null;
}
- JavaResourcePersistentType superclass = this.getJpaProject().getJavaResourcePersistentType(superclassName);
+ JavaResourceType superclass = (JavaResourceType) this.getJpaProject().getJavaResourceType(superclassName, Kind.TYPE);
if (superclass == null) {
return null;
}
// recurse
- return this.getJavaResourceAttribute(superclass);
+ return this.getJavaResourceField(superclass);
}
/**
* Return the resource attributes with compatible access types.
*/
- protected Iterable<JavaResourcePersistentAttribute> getJavaResourceAttributes(JavaResourcePersistentType javaResourceType) {
- return CollectionTools.iterable(javaResourceType.persistableAttributes(this.getAccess().getJavaAccessType()));
+ protected Iterable<JavaResourceField> getJavaResourceFields(JavaResourceType javaResourceType) {
+ return javaResourceType.getFields();
}
- protected JavaPersistentAttribute buildJavaPersistentAttribute(JavaResourcePersistentAttribute javaResourceAttribute) {
+ /**
+ * Search the specified Java resource type for the resource attribute
+ * corresponding to this <code>orm.xml</code> attribute (i.e. the Java
+ * resource attribute with the same name). If the specified Java resource
+ * type does not have a corresponding attribute, search up its inheritance
+ * hierarchy.
+ */
+ protected JavaResourceMethod getJavaResourceGetter(JavaResourceType javaResourceType) {
+ for (JavaResourceMethod javaResourceGetter : this.getJavaResourceGetters(javaResourceType)) {
+ if (javaResourceGetter.getName().equals(this.getName())) {
+ return javaResourceGetter;
+ }
+ }
+ // climb up inheritance hierarchy
+ String superclassName = javaResourceType.getSuperclassQualifiedName();
+ if (superclassName == null) {
+ return null;
+ }
+ JavaResourceType superclass = (JavaResourceType) this.getJpaProject().getJavaResourceType(superclassName, Kind.TYPE);
+ if (superclass == null) {
+ return null;
+ }
+ // recurse
+ return this.getJavaResourceGetter(superclass);
+ }
+
+ protected Iterable<JavaResourceMethod> getResourceMethods(final JavaResourceType javaResourceType, Filter<JavaResourceMethod> filter) {
+ return new FilteringIterable<JavaResourceMethod>(javaResourceType.getMethods(), filter);
+ }
+
+ protected Filter<JavaResourceMethod> buildPersistablePropertyGetterMethodsFilter(final JavaResourceType javaResourceType) {
+ return new Filter<JavaResourceMethod>() {
+ public boolean accept(JavaResourceMethod resourceMethod) {
+ return AbstractJavaPersistentType.methodIsPersistablePropertyGetter(resourceMethod, javaResourceType.getMethods());
+ }
+ };
+ }
+
+ /**
+ * Return the resource attributes with compatible access types.
+ */
+ protected Iterable<JavaResourceMethod> getJavaResourceGetters(JavaResourceType javaResourceType) {
+ return getResourceMethods(javaResourceType, buildPersistablePropertyGetterMethodsFilter(javaResourceType));
+ }
+
+ protected JavaPersistentAttribute buildJavaPersistentField(JavaResourceField javaResourceField) {
// pass in our parent orm persistent type as the parent to the cached Java attribute...
- return this.getJpaFactory().buildJavaPersistentAttribute(this.getOwningPersistentType(), javaResourceAttribute);
+ return this.getJpaFactory().buildJavaPersistentField(this.getOwningPersistentType(), javaResourceField);
}
- public JavaResourcePersistentAttribute getJavaResourcePersistentAttribute() {
- return (this.javaPersistentAttribute == null) ? null : this.javaPersistentAttribute.getResourcePersistentAttribute();
+ protected JavaPersistentAttribute buildJavaPersistentProperty(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
+ // pass in our parent orm persistent type as the parent to the cached Java attribute...
+ return this.getJpaFactory().buildJavaPersistentProperty(this.getOwningPersistentType(), javaResourceGetter, javaResourceSetter);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java
index e2d1c95a4f..a8adf954b3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java
@@ -9,18 +9,16 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.orm;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.MethodSignature;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.StateChangeListener;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.AccessType;
+import org.eclipse.jpt.jpa.core.context.java.Accessor;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -29,14 +27,10 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNode;
+import org.eclipse.jpt.jpa.core.internal.context.java.FieldAccessor;
+import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmReadOnlyPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -47,7 +41,7 @@ public class VirtualOrmPersistentAttribute
extends AbstractOrmXmlContextNode
implements OrmReadOnlyPersistentAttribute2_0
{
- protected final JavaResourcePersistentAttribute javaResourceAttribute;
+ protected final Accessor javaAccessor;
/**
* This is an "annotated" Java persistent attribute whose state is
@@ -89,9 +83,23 @@ public class VirtualOrmPersistentAttribute
protected JavaAttributeMapping mapping; // never null
- public VirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourceAttribute) {
+ public VirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourceField resourceField) {
super(parent);
- this.javaResourceAttribute = javaResourceAttribute;
+ this.javaAccessor = new FieldAccessor(this, resourceField);
+ this.annotatedJavaAttribute = this.buildAnnotatedJavaAttribute();
+ this.mapping = this.buildMapping();
+ }
+
+ public VirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
+ super(parent);
+ this.javaAccessor = new PropertyAccessor(this, resourceGetter, resourceSetter);
+ this.annotatedJavaAttribute = this.buildAnnotatedJavaAttribute();
+ this.mapping = this.buildMapping();
+ }
+
+ public VirtualOrmPersistentAttribute(OrmPersistentType parent, Accessor javaAccessor) {
+ super(parent);
+ this.javaAccessor = javaAccessor;
this.annotatedJavaAttribute = this.buildAnnotatedJavaAttribute();
this.mapping = this.buildMapping();
}
@@ -157,7 +165,7 @@ public class VirtualOrmPersistentAttribute
public JavaPersistentAttribute resolveJavaPersistentAttribute() {
JavaPersistentType javaType = this.getOwningPersistentType().getJavaPersistentType();
- return (javaType == null) ? null : javaType.getAttributeFor(this.javaResourceAttribute);
+ return (javaType == null) ? null : javaType.getAttributeFor(this.getJavaResourceAttribute());
}
protected JavaPersistentAttribute2_0 getJavaPersistentAttribute2_0() {
@@ -165,7 +173,7 @@ public class VirtualOrmPersistentAttribute
}
protected JavaPersistentAttribute buildAnnotatedJavaAttribute() {
- return this.buildJavaAttribute(this.javaResourceAttribute);
+ return buildJavaAttribute(this.javaAccessor);
}
protected JavaPersistentAttribute getUnannotatedJavaAttribute() {
@@ -176,21 +184,13 @@ public class VirtualOrmPersistentAttribute
}
protected JavaPersistentAttribute buildUnannotatedJavaAttribute() {
- return this.buildJavaAttribute(this.buildUnannotatedJavaResourceAttribute());
- }
-
- /**
- * Build a Java resource attribute that wraps the original Java resource
- * attribute and behaves as though it has no annotations. This will cause
- * all the settings in the Java <em>context</em> attribute to default.
- */
- protected JavaResourcePersistentAttribute buildUnannotatedJavaResourceAttribute() {
- return new UnannotatedJavaResourcePersistentAttribute(this.javaResourceAttribute);
+ // pass in the orm persistent type as the parent...
+ return this.javaAccessor.buildUnannotatedJavaAttribute(this.getOwningPersistentType());
}
- protected JavaPersistentAttribute buildJavaAttribute(JavaResourcePersistentAttribute jrpa) {
+ protected JavaPersistentAttribute buildJavaAttribute(Accessor accessor) {
// pass in the orm persistent type as the parent...
- return this.getJpaFactory().buildJavaPersistentAttribute(this.getOwningPersistentType(), jrpa);
+ return this.getJpaFactory().buildJavaPersistentAttribute(this.getOwningPersistentType(), accessor);
}
protected void syncLocalJavaAttributes() {
@@ -207,10 +207,21 @@ public class VirtualOrmPersistentAttribute
}
}
- public JavaResourcePersistentAttribute getJavaResourcePersistentAttribute() {
- return this.javaResourceAttribute;
+ public Accessor getJavaAccessor() {
+ return this.javaAccessor;
}
+ public JavaResourceAttribute getJavaResourceAttribute() {
+ return this.javaAccessor.getResourceAttribute();
+ }
+
+ public boolean isFor(JavaResourceField javaResourceField) {
+ return this.javaAccessor.isFor(javaResourceField);
+ }
+
+ public boolean isFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
+ return this.javaAccessor.isFor(javaResourceGetter, javaResourceSetter);
+ }
// ********** original Java persistent attribute **********
@@ -367,235 +378,4 @@ public class VirtualOrmPersistentAttribute
public void toString(StringBuilder sb) {
sb.append(this.getName());
}
-
-
- // ********** unannotated Java resource persistent member **********
-
- /**
- * Wrap another Java resource member and suppress all its annotations.
- */
- protected abstract class UnannotatedJavaResourcePersistentMember<M extends JavaResourcePersistentMember>
- extends SourceNode
- implements JavaResourcePersistentMember
- {
- protected final M member;
-
- /**
- * these are built as needed
- */
- protected final HashMap<String, Annotation> nullAnnotationsCache = new HashMap<String, Annotation>();
-
-
- protected UnannotatedJavaResourcePersistentMember(M member) {
- super(member.getParent());
- this.member = member;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // NOP
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // NOP
- }
-
-
- // ********** annotations **********
-
- public Iterator<Annotation> annotations() {
- return EmptyIterator.instance();
- }
-
- public int annotationsSize() {
- return 0;
- }
-
- public Annotation getAnnotation(String annotationName) {
- return null;
- }
-
- public synchronized Annotation getNonNullAnnotation(String annotationName) {
- Annotation annotation = this.nullAnnotationsCache.get(annotationName);
- if (annotation == null) {
- annotation = this.buildNullAnnotation(annotationName);
- this.nullAnnotationsCache.put(annotationName, annotation);
- }
- return annotation;
- }
-
- protected abstract Annotation buildNullAnnotation(String annotationName);
-
- public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
- return EmptyIterator.instance();
- }
-
- public Annotation addAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
- throw new UnsupportedOperationException();
- }
-
- public void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** persistable **********
-
- public boolean isPersistable() {
- return this.member.isPersistable();
- }
-
-
- // ********** misc **********
-
- public boolean isAnnotated() {
- return false;
- }
-
- public boolean isFinal() {
- return this.member.isFinal();
- }
-
- public boolean isFor(String memberName, int occurrence) {
- return this.member.isFor(memberName, occurrence);
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- // should never be null
- return this.member.getTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- // should never be null
- return this.member.getNameTextRange(astRoot);
- }
-
- public void resolveTypes(CompilationUnit astRoot) {
- // NOP
- }
- }
-
-
- // ********** unannotated Java resource persistent member **********
-
- protected class UnannotatedJavaResourcePersistentAttribute
- extends UnannotatedJavaResourcePersistentMember<JavaResourcePersistentAttribute>
- implements JavaResourcePersistentAttribute
- {
- protected UnannotatedJavaResourcePersistentAttribute(JavaResourcePersistentAttribute attribute){
- super(attribute);
- }
-
-
- // ********** annotations **********
-
- @Override
- public Annotation buildNullAnnotation(String annotationName) {
- return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
- }
-
- private Annotation buildNullAnnotation_(String annotationName) {
- return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
- }
-
-
- // ********** delegated behavior **********
-
- @Override
- public JavaResourcePersistentType getParent() {
- return this.member.getParent();
- }
-
- public JavaResourcePersistentType getResourcePersistentType() {
- return this.member.getResourcePersistentType();
- }
-
- public String getName() {
- return this.member.getName();
- }
-
- public boolean isFor(MethodSignature signature, int occurrence) {
- return this.member.isFor(signature, occurrence);
- }
-
- public boolean isField() {
- return this.member.isField();
- }
-
- public boolean isProperty() {
- return this.member.isProperty();
- }
-
- public org.eclipse.jpt.jpa.core.resource.java.AccessType getSpecifiedAccess() {
- return null;
- }
-
- public boolean typeIsSubTypeOf(String tn) {
- return this.member.typeIsSubTypeOf(tn);
- }
-
- public boolean typeIsVariablePrimitive() {
- return this.member.typeIsVariablePrimitive();
- }
-
- public int getModifiers() {
- return this.member.getModifiers();
- }
-
- public String getTypeName() {
- return this.member.getTypeName();
- }
-
- public boolean typeIsInterface() {
- return this.member.typeIsInterface();
- }
-
- public boolean typeIsEnum() {
- return this.member.typeIsEnum();
- }
-
- public ListIterator<String> typeSuperclassNames() {
- return this.member.typeSuperclassNames();
- }
-
- public Iterator<String> typeInterfaceNames() {
- return this.member.typeInterfaceNames();
- }
-
- public ListIterator<String> typeTypeArgumentNames() {
- return this.member.typeTypeArgumentNames();
- }
-
- public int typeTypeArgumentNamesSize() {
- return this.member.typeTypeArgumentNamesSize();
- }
-
- public String getTypeTypeArgumentName(int index) {
- return this.member.getTypeTypeArgumentName(index);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
index 51180c17a1..d38f369ce3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.context.persistence;
import java.util.List;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
@@ -31,7 +31,6 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.common.componentcore.ComponentCore;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
index 9dac1cf5ab..5613b13932 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -16,11 +16,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
@@ -28,6 +26,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.utility.BodySourceWriter;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -38,15 +37,13 @@ import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
@@ -83,7 +80,6 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitTransactionType;
import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
@@ -94,8 +90,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
@@ -133,21 +127,16 @@ public abstract class AbstractPersistenceUnit
protected String jtaDataSource;
protected String nonJtaDataSource;
- protected final Vector<MappingFileRef> specifiedMappingFileRefs = new Vector<MappingFileRef>();
- protected final SpecifiedMappingFileRefContainerAdapter specifiedMappingFileRefContainerAdapter = new SpecifiedMappingFileRefContainerAdapter();
+ protected final ContextListContainer<MappingFileRef, XmlMappingFileRef> specifiedMappingFileRefContainer;
protected MappingFileRef impliedMappingFileRef;
- protected final Vector<JarFileRef> jarFileRefs = new Vector<JarFileRef>();
- protected final JarFileRefContainerAdapter jarFileRefContainerAdapter = new JarFileRefContainerAdapter();
+ protected final ContextListContainer<JarFileRef, XmlJarFileRef> jarFileRefContainer;
- protected final Vector<ClassRef> specifiedClassRefs = new Vector<ClassRef>();
- protected final SpecifiedClassRefContainerAdapter specifiedClassRefContainerAdapter = new SpecifiedClassRefContainerAdapter();
+ protected final ContextListContainer<ClassRef, XmlJavaClassRef> specifiedClassRefContainer;
- protected final Set<ClassRef> impliedClassRefs = Collections.synchronizedSet(new HashSet<ClassRef>());
- protected final ImpliedClassRefContainerAdapter impliedClassRefContainerAdapter = new ImpliedClassRefContainerAdapter();
+ protected final ContextCollectionContainer<ClassRef, String> impliedClassRefContainer;
- protected final Vector<Property> properties = new Vector<Property>();
- protected final PropertyContainerAdapter propertyContainerAdapter = new PropertyContainerAdapter();
+ protected final ContextListContainer<Property, XmlProperty> propertyContainer;
/* global generator definitions, defined elsewhere in model */
protected final Vector<Generator> generators = new Vector<Generator>();
@@ -193,11 +182,13 @@ public abstract class AbstractPersistenceUnit
this.nonJtaDataSource = xmlPersistenceUnit.getNonJtaDataSource();
// initialize the properties early because other things will need them...(?)
+ this.propertyContainer = this.buildPropertyContainer();
this.initializeProperties();
- this.initializeSpecifiedMappingFileRefs();
- this.initializeJarFileRefs();
- this.initializeSpecifiedClassRefs();
+ this.specifiedMappingFileRefContainer = this.buildSpecifiedMappingFileRefContainer();
+ this.jarFileRefContainer = this.buildJarFileRefContainer();
+ this.specifiedClassRefContainer = this.buildSpecifiedClassRefContainer();
+ this.impliedClassRefContainer = this.buildImpliedClassRefContainer();
this.specifiedSharedCacheMode = this.buildSpecifiedSharedCacheMode();
this.specifiedValidationMode = this.buildSpecifiedValidationMode();
@@ -243,18 +234,18 @@ public abstract class AbstractPersistenceUnit
// update specified class refs before mapping file refs because of
// JpaFile root structure nodes - we want the mapping file to "win",
// as it would in a JPA runtime implementation
- this.updateNodes(this.getSpecifiedClassRefs());
+ this.updateSpecifiedClassRefs();
- this.updateNodes(this.getSpecifiedMappingFileRefs());
+ this.updateSpecifiedMappingFileRefs();
this.updateImpliedMappingFileRef();
- this.updateNodes(this.getJarFileRefs());
+ this.updateJarFileRefs();
// update the implied class refs after all the other types, both
// specified here and specified in the mapping files, are in place
this.updateImpliedClassRefs();
- this.updateNodes(this.getProperties());
+ this.updateProperties();
this.updatePersistenceUnitMetadata();
@@ -444,12 +435,8 @@ public abstract class AbstractPersistenceUnit
// ********** mapping file refs **********
- public ListIterator<MappingFileRef> mappingFileRefs() {
- return this.getMappingFileRefs().iterator();
- }
-
- protected Iterator<String> mappingFileRefNames() {
- return new TransformationIterator<MappingFileRef, String>(this.mappingFileRefs()) {
+ protected Iterable<String> getMappingFileRefNames() {
+ return new TransformationIterable<MappingFileRef, String>(this.getMappingFileRefs()) {
@Override
protected String transform(MappingFileRef mappingFileRef) {
return mappingFileRef.getFileName();
@@ -457,16 +444,12 @@ public abstract class AbstractPersistenceUnit
};
}
- protected ListIterable<MappingFileRef> getMappingFileRefs() {
+ public ListIterable<MappingFileRef> getMappingFileRefs() {
return (this.impliedMappingFileRef == null) ?
this.getSpecifiedMappingFileRefs() :
this.getCombinedMappingFileRefs();
}
- protected ListIterator<MappingFileRef> combinedMappingFileRefs() {
- return this.getCombinedMappingFileRefs().iterator();
- }
-
protected ListIterable<MappingFileRef> getCombinedMappingFileRefs() {
return new CompositeListIterable<MappingFileRef>(
this.getSpecifiedMappingFileRefs(),
@@ -474,18 +457,18 @@ public abstract class AbstractPersistenceUnit
);
}
- public int mappingFileRefsSize() {
+ public int getMappingFileRefsSize() {
return (this.impliedMappingFileRef == null) ?
- this.specifiedMappingFileRefsSize() :
- this.combinedMappingFileRefsSize();
+ this.getSpecifiedMappingFileRefsSize() :
+ this.getCombinedMappingFileRefsSize();
}
- protected int combinedMappingFileRefsSize() {
- return this.specifiedMappingFileRefsSize() + 1;
+ protected int getCombinedMappingFileRefsSize() {
+ return this.getSpecifiedMappingFileRefsSize() + 1;
}
- public Iterator<MappingFileRef> mappingFileRefsContaining(final String typeName) {
- return new FilteringIterator<MappingFileRef> (this.mappingFileRefs()) {
+ public Iterable<MappingFileRef> getMappingFileRefsContaining(final String typeName) {
+ return new FilteringIterable<MappingFileRef> (this.getMappingFileRefs()) {
@Override
protected boolean accept(MappingFileRef mappingFileRef) {
return mappingFileRef.getPersistentType(typeName) != null;
@@ -496,25 +479,21 @@ public abstract class AbstractPersistenceUnit
// ********** specified mapping file refs **********
- public ListIterator<MappingFileRef> specifiedMappingFileRefs() {
- return this.getSpecifiedMappingFileRefs().iterator();
+ public ListIterable<MappingFileRef> getSpecifiedMappingFileRefs() {
+ return this.specifiedMappingFileRefContainer.getContextElements();
}
- protected ListIterable<MappingFileRef> getSpecifiedMappingFileRefs() {
- return new LiveCloneListIterable<MappingFileRef>(this.specifiedMappingFileRefs);
- }
-
- public int specifiedMappingFileRefsSize() {
- return this.specifiedMappingFileRefs.size();
+ public int getSpecifiedMappingFileRefsSize() {
+ return this.specifiedMappingFileRefContainer.getContextElementsSize();
}
public MappingFileRef addSpecifiedMappingFileRef(String fileName) {
- return this.addSpecifiedMappingFileRef(this.specifiedMappingFileRefs.size(), fileName);
+ return this.addSpecifiedMappingFileRef(this.getSpecifiedMappingFileRefsSize(), fileName);
}
public MappingFileRef addSpecifiedMappingFileRef(int index, String fileName) {
XmlMappingFileRef xmlMappingFileRef = this.buildXmlMappingFileRef(fileName);
- MappingFileRef mappingFileRef = this.addSpecifiedMappingFileRef_(index, xmlMappingFileRef);
+ MappingFileRef mappingFileRef = this.specifiedMappingFileRefContainer.addContextElement(index, xmlMappingFileRef);
this.xmlPersistenceUnit.getMappingFiles().add(index, xmlMappingFileRef);
return mappingFileRef;
}
@@ -530,7 +509,7 @@ public abstract class AbstractPersistenceUnit
}
public void removeSpecifiedMappingFileRef(MappingFileRef mappingFileRef) {
- this.removeSpecifiedMappingFileRef(this.specifiedMappingFileRefs.indexOf(mappingFileRef));
+ this.removeSpecifiedMappingFileRef(this.specifiedMappingFileRefContainer.indexOfContextElement(mappingFileRef));
}
public void removeSpecifiedMappingFileRef(int index) {
@@ -542,62 +521,48 @@ public abstract class AbstractPersistenceUnit
* dispose the mapping file ref
*/
protected void removeSpecifiedMappingFileRef_(int index) {
- this.removeItemFromList(index, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST).dispose();
- }
-
- protected void initializeSpecifiedMappingFileRefs() {
- for (XmlMappingFileRef xmlMappingFileRef : this.getXmlMappingFileRefs()) {
- this.specifiedMappingFileRefs.add(this.buildSpecifiedMappingFileRef(xmlMappingFileRef));
- }
+ this.specifiedMappingFileRefContainer.removeContextElement(index).dispose();
}
protected void syncSpecifiedMappingFileRefs() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedMappingFileRefContainerAdapter);
+ this.specifiedMappingFileRefContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlMappingFileRef> getXmlMappingFileRefs() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlMappingFileRef>(this.xmlPersistenceUnit.getMappingFiles());
+ protected void updateSpecifiedMappingFileRefs() {
+ this.specifiedMappingFileRefContainer.update();
}
- protected void moveSpecifiedMappingFileRef_(int index, MappingFileRef mappingFileRef) {
- this.moveItemInList(index, mappingFileRef, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST);
- }
-
- protected MappingFileRef addSpecifiedMappingFileRef_(int index, XmlMappingFileRef xmlMappingFileRef) {
- MappingFileRef mappingFileRef = this.buildSpecifiedMappingFileRef(xmlMappingFileRef);
- this.addItemToList(index, mappingFileRef, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST);
- return mappingFileRef;
+ protected ListIterable<XmlMappingFileRef> getXmlMappingFileRefs() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneListIterable<XmlMappingFileRef>(this.xmlPersistenceUnit.getMappingFiles());
}
- protected void removeSpecifiedMappingFileRef_(MappingFileRef mappingFileRef) {
- this.removeSpecifiedMappingFileRef_(this.specifiedMappingFileRefs.indexOf(mappingFileRef));
+ protected ContextListContainer<MappingFileRef, XmlMappingFileRef> buildSpecifiedMappingFileRefContainer() {
+ return new SpecifiedMappingFileRefContainer();
}
/**
- * specified mapping file ref container adapter
+ * specified mapping file ref container
*/
- protected class SpecifiedMappingFileRefContainerAdapter
- implements ContextContainerTools.Adapter<MappingFileRef, XmlMappingFileRef>
+ protected class SpecifiedMappingFileRefContainer
+ extends ContextListContainer<MappingFileRef, XmlMappingFileRef>
{
- public Iterable<MappingFileRef> getContextElements() {
- return AbstractPersistenceUnit.this.getSpecifiedMappingFileRefs();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_MAPPING_FILE_REFS_LIST;
+ }
+ @Override
+ protected MappingFileRef buildContextElement(XmlMappingFileRef resourceElement) {
+ return AbstractPersistenceUnit.this.buildSpecifiedMappingFileRef(resourceElement);
}
- public Iterable<XmlMappingFileRef> getResourceElements() {
+ @Override
+ protected ListIterable<XmlMappingFileRef> getResourceElements() {
return AbstractPersistenceUnit.this.getXmlMappingFileRefs();
}
- public XmlMappingFileRef getResourceElement(MappingFileRef contextElement) {
+ @Override
+ protected XmlMappingFileRef getResourceElement(MappingFileRef contextElement) {
return contextElement.getXmlMappingFileRef();
}
- public void moveContextElement(int index, MappingFileRef element) {
- AbstractPersistenceUnit.this.moveSpecifiedMappingFileRef_(index, element);
- }
- public void addContextElement(int index, XmlMappingFileRef resourceElement) {
- AbstractPersistenceUnit.this.addSpecifiedMappingFileRef_(index, resourceElement);
- }
- public void removeContextElement(MappingFileRef element) {
- AbstractPersistenceUnit.this.removeSpecifiedMappingFileRef_(element);
- }
}
@@ -678,16 +643,12 @@ public abstract class AbstractPersistenceUnit
// ********** JAR file refs **********
- public ListIterator<JarFileRef> jarFileRefs() {
- return this.getJarFileRefs().iterator();
- }
-
- protected ListIterable<JarFileRef> getJarFileRefs() {
- return new LiveCloneListIterable<JarFileRef>(this.jarFileRefs);
+ public ListIterable<JarFileRef> getJarFileRefs() {
+ return this.jarFileRefContainer.getContextElements();
}
- public int jarFileRefsSize() {
- return this.jarFileRefs.size();
+ public int getJarFileRefsSize() {
+ return this.jarFileRefContainer.getContextElementsSize();
}
protected Iterable<String> getJarFileNames() {
@@ -700,12 +661,12 @@ public abstract class AbstractPersistenceUnit
}
public JarFileRef addJarFileRef(String fileName) {
- return this.addJarFileRef(this.jarFileRefs.size(), fileName);
+ return this.addJarFileRef(this.getJarFileRefsSize(), fileName);
}
public JarFileRef addJarFileRef(int index, String fileName) {
XmlJarFileRef xmlJarFileRef = this.buildXmlJarFileRef(fileName);
- JarFileRef jarFileRef = this.addJarFileRef_(index, xmlJarFileRef);
+ JarFileRef jarFileRef = this.jarFileRefContainer.addContextElement(index, xmlJarFileRef);
this.xmlPersistenceUnit.getJarFiles().add(index, xmlJarFileRef);
return jarFileRef;
}
@@ -721,7 +682,7 @@ public abstract class AbstractPersistenceUnit
}
public void removeJarFileRef(JarFileRef jarFileRef) {
- this.removeJarFileRef(this.jarFileRefs.indexOf(jarFileRef));
+ this.removeJarFileRef(this.jarFileRefContainer.indexOfContextElement(jarFileRef));
}
public void removeJarFileRef(int index) {
@@ -733,81 +694,62 @@ public abstract class AbstractPersistenceUnit
* dispose the JAR file ref
*/
protected void removeJarFileRef_(int index) {
- this.removeItemFromList(index, this.jarFileRefs, JAR_FILE_REFS_LIST).dispose();
- }
-
- protected void initializeJarFileRefs() {
- for (XmlJarFileRef xmlJarFileRef : this.getXmlJarFileRefs()) {
- this.jarFileRefs.add(this.buildJarFileRef(xmlJarFileRef));
- }
+ this.jarFileRefContainer.removeContextElement(index).dispose();
}
protected void syncJarFileRefs() {
- ContextContainerTools.synchronizeWithResourceModel(this.jarFileRefContainerAdapter);
- }
-
- protected Iterable<XmlJarFileRef> getXmlJarFileRefs() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlJarFileRef>(this.xmlPersistenceUnit.getJarFiles());
+ this.jarFileRefContainer.synchronizeWithResourceModel();
}
- protected void moveJarFileRef_(int index, JarFileRef jarFileRef) {
- this.moveItemInList(index, jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST);
+ protected void updateJarFileRefs() {
+ this.jarFileRefContainer.update();
}
- protected JarFileRef addJarFileRef_(int index, XmlJarFileRef xmlJarFileRef) {
- JarFileRef jarFileRef = this.buildJarFileRef(xmlJarFileRef);
- this.addItemToList(index, jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST);
- return jarFileRef;
+ protected ListIterable<XmlJarFileRef> getXmlJarFileRefs() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneListIterable<XmlJarFileRef>(this.xmlPersistenceUnit.getJarFiles());
}
- protected void removeJarFileRef_(JarFileRef jarFileRef) {
- this.removeJarFileRef_(this.jarFileRefs.indexOf(jarFileRef));
+ protected ContextListContainer<JarFileRef, XmlJarFileRef> buildJarFileRefContainer() {
+ return new JarFileRefContainer();
}
/**
- * JAR file ref container adapter
+ * JAR file ref container
*/
- protected class JarFileRefContainerAdapter
- implements ContextContainerTools.Adapter<JarFileRef, XmlJarFileRef>
+ protected class JarFileRefContainer
+ extends ContextListContainer<JarFileRef, XmlJarFileRef>
{
- public Iterable<JarFileRef> getContextElements() {
- return AbstractPersistenceUnit.this.getJarFileRefs();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return JAR_FILE_REFS_LIST;
+ }
+ @Override
+ protected JarFileRef buildContextElement(XmlJarFileRef resourceElement) {
+ return AbstractPersistenceUnit.this.buildJarFileRef(resourceElement);
}
- public Iterable<XmlJarFileRef> getResourceElements() {
+ @Override
+ protected ListIterable<XmlJarFileRef> getResourceElements() {
return AbstractPersistenceUnit.this.getXmlJarFileRefs();
}
- public XmlJarFileRef getResourceElement(JarFileRef contextElement) {
+ @Override
+ protected XmlJarFileRef getResourceElement(JarFileRef contextElement) {
return contextElement.getXmlJarFileRef();
}
- public void moveContextElement(int index, JarFileRef element) {
- AbstractPersistenceUnit.this.moveJarFileRef_(index, element);
- }
- public void addContextElement(int index, XmlJarFileRef resourceElement) {
- AbstractPersistenceUnit.this.addJarFileRef_(index, resourceElement);
- }
- public void removeContextElement(JarFileRef element) {
- AbstractPersistenceUnit.this.removeJarFileRef_(element);
- }
}
-
// ********** class refs **********
- public Iterator<ClassRef> classRefs() {
- return this.getClassRefs().iterator();
- }
-
@SuppressWarnings("unchecked")
- protected Iterable<ClassRef> getClassRefs() {
+ public Iterable<ClassRef> getClassRefs() {
return new CompositeIterable<ClassRef>(
this.getSpecifiedClassRefs(),
this.getImpliedClassRefs()
);
}
- public int classRefsSize() {
- return this.specifiedClassRefs.size() + this.impliedClassRefs.size();
+ public int getClassRefsSize() {
+ return this.getSpecifiedClassRefsSize() + this.getImpliedClassRefsSize();
}
/**
@@ -825,25 +767,21 @@ public abstract class AbstractPersistenceUnit
// ********** specified class refs **********
- public ListIterator<ClassRef> specifiedClassRefs() {
- return this.getSpecifiedClassRefs().iterator();
- }
-
- protected ListIterable<ClassRef> getSpecifiedClassRefs() {
- return new LiveCloneListIterable<ClassRef>(this.specifiedClassRefs);
+ public ListIterable<ClassRef> getSpecifiedClassRefs() {
+ return this.specifiedClassRefContainer.getContextElements();
}
- public int specifiedClassRefsSize() {
- return this.specifiedClassRefs.size();
+ public int getSpecifiedClassRefsSize() {
+ return this.specifiedClassRefContainer.getContextElementsSize();
}
public ClassRef addSpecifiedClassRef(String className) {
- return this.addSpecifiedClassRef(this.specifiedClassRefs.size(), className);
+ return this.addSpecifiedClassRef(this.getSpecifiedClassRefsSize(), className);
}
public ClassRef addSpecifiedClassRef(int index, String className) {
XmlJavaClassRef xmlClassRef = this.buildXmlJavaClassRef(className);
- ClassRef classRef = this.addSpecifiedClassRef_(index, xmlClassRef);
+ ClassRef classRef = this.specifiedClassRefContainer.addContextElement(index, xmlClassRef);
this.xmlPersistenceUnit.getClasses().add(index, xmlClassRef);
return classRef;
}
@@ -859,7 +797,7 @@ public abstract class AbstractPersistenceUnit
}
public void removeSpecifiedClassRef(ClassRef classRef) {
- this.removeSpecifiedClassRef(this.specifiedClassRefs.indexOf(classRef));
+ this.removeSpecifiedClassRef(this.specifiedClassRefContainer.indexOfContextElement(classRef));
}
public void removeSpecifiedClassRef(int index) {
@@ -871,97 +809,71 @@ public abstract class AbstractPersistenceUnit
* dispose the class ref
*/
protected void removeSpecifiedClassRef_(int index) {
- this.removeItemFromList(index, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST).dispose();
- }
-
- protected void initializeSpecifiedClassRefs() {
- for (XmlJavaClassRef xmlJavaClassRef : this.getXmlClassRefs()) {
- this.specifiedClassRefs.add(this.buildClassRef(xmlJavaClassRef));
- }
+ this.specifiedClassRefContainer.removeContextElement(index).dispose();
}
protected void syncSpecifiedClassRefs() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedClassRefContainerAdapter);
- }
-
- protected Iterable<XmlJavaClassRef> getXmlClassRefs() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlJavaClassRef>(this.xmlPersistenceUnit.getClasses());
+ this.specifiedClassRefContainer.synchronizeWithResourceModel();
}
- protected void moveSpecifiedClassRef_(int index, ClassRef classRef) {
- this.moveItemInList(index, classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST);
+ protected void updateSpecifiedClassRefs() {
+ this.specifiedClassRefContainer.update();
}
- protected ClassRef addSpecifiedClassRef_(int index, XmlJavaClassRef xmlClassRef) {
- ClassRef classRef = this.buildClassRef(xmlClassRef);
- this.addItemToList(index, classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST);
- return classRef;
+ protected ListIterable<XmlJavaClassRef> getXmlClassRefs() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneListIterable<XmlJavaClassRef>(this.xmlPersistenceUnit.getClasses());
}
- protected void removeSpecifiedClassRef_(ClassRef classRef) {
- this.removeSpecifiedClassRef_(this.specifiedClassRefs.indexOf(classRef));
+ protected ContextListContainer<ClassRef, XmlJavaClassRef> buildSpecifiedClassRefContainer() {
+ return new SpecifiedClassRefContainer();
}
/**
- * specified class ref container adapter
+ * specified class ref container
*/
- protected class SpecifiedClassRefContainerAdapter
- implements ContextContainerTools.Adapter<ClassRef, XmlJavaClassRef>
+ protected class SpecifiedClassRefContainer
+ extends ContextListContainer<ClassRef, XmlJavaClassRef>
{
- public Iterable<ClassRef> getContextElements() {
- return AbstractPersistenceUnit.this.getSpecifiedClassRefs();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_CLASS_REFS_LIST;
+ }
+ @Override
+ protected ClassRef buildContextElement(XmlJavaClassRef resourceElement) {
+ return AbstractPersistenceUnit.this.buildClassRef(resourceElement);
}
- public Iterable<XmlJavaClassRef> getResourceElements() {
+ @Override
+ protected ListIterable<XmlJavaClassRef> getResourceElements() {
return AbstractPersistenceUnit.this.getXmlClassRefs();
}
- public XmlJavaClassRef getResourceElement(ClassRef contextElement) {
+ @Override
+ protected XmlJavaClassRef getResourceElement(ClassRef contextElement) {
return contextElement.getXmlClassRef();
}
- public void moveContextElement(int index, ClassRef element) {
- AbstractPersistenceUnit.this.moveSpecifiedClassRef_(index, element);
- }
- public void addContextElement(int index, XmlJavaClassRef resourceElement) {
- AbstractPersistenceUnit.this.addSpecifiedClassRef_(index, resourceElement);
- }
- public void removeContextElement(ClassRef element) {
- AbstractPersistenceUnit.this.removeSpecifiedClassRef_(element);
- }
}
// ********** virtual class refs **********
- public Iterator<ClassRef> impliedClassRefs() {
- return this.getImpliedClassRefs().iterator();
- }
-
- protected Iterable<ClassRef> getImpliedClassRefs() {
- return new LiveCloneIterable<ClassRef>(this.impliedClassRefs);
+ public Iterable<ClassRef> getImpliedClassRefs() {
+ return this.impliedClassRefContainer.getContextElements();
}
- public int impliedClassRefsSize() {
- return this.impliedClassRefs.size();
+ public int getImpliedClassRefsSize() {
+ return this.impliedClassRefContainer.getContextElementsSize();
}
protected ClassRef addImpliedClassRef(String className) {
- ClassRef classRef = this.buildClassRef(className);
- this.addItemToCollection(classRef, this.impliedClassRefs, IMPLIED_CLASS_REFS_COLLECTION);
- return classRef;
+ return this.impliedClassRefContainer.addContextElement(getImpliedClassRefsSize(), className);
}
protected ClassRef buildClassRef(String className) {
return this.getContextNodeFactory().buildClassRef(this, className);
}
- protected void removeImpliedClassRef(ClassRef classRef) {
- this.impliedClassRefs.remove(classRef);
- classRef.dispose();
- this.fireItemRemoved(IMPLIED_CLASS_REFS_COLLECTION, classRef);
- }
-
protected void updateImpliedClassRefs() {
- ContextContainerTools.update(this.impliedClassRefContainerAdapter);
+ this.impliedClassRefContainer.update();
}
protected Iterable<String> getImpliedClassNames() {
@@ -984,6 +896,10 @@ public abstract class AbstractPersistenceUnit
};
}
+ protected ContextCollectionContainer<ClassRef, String> buildImpliedClassRefContainer() {
+ return new ImpliedClassRefContainer();
+ }
+
/**
* Virtual class ref container adapter.
* <p>
@@ -1008,27 +924,29 @@ public abstract class AbstractPersistenceUnit
* setting whether the persistence unit excludes unlisted classes); o the
* collection must also be synchronized during <em>update</em>.
*/
- protected class ImpliedClassRefContainerAdapter
- implements ContextContainerTools.Adapter<ClassRef, String>
+ protected class ImpliedClassRefContainer
+ extends ContextCollectionContainer<ClassRef, String>
{
- public Iterable<ClassRef> getContextElements() {
- return AbstractPersistenceUnit.this.getImpliedClassRefs();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return IMPLIED_CLASS_REFS_COLLECTION;
}
- public Iterable<String> getResourceElements() {
+ @Override
+ protected ClassRef buildContextElement(String resourceElement) {
+ return AbstractPersistenceUnit.this.buildClassRef(resourceElement);
+ }
+ @Override
+ protected Iterable<String> getResourceElements() {
return AbstractPersistenceUnit.this.getImpliedClassNames();
}
- public String getResourceElement(ClassRef contextElement) {
+ @Override
+ protected String getResourceElement(ClassRef contextElement) {
return contextElement.getClassName();
}
- public void moveContextElement(int index, ClassRef element) {
- // ignore moves - we don't care about the order of the implied class refs
- }
- public void addContextElement(int index, String resourceElement) {
- // ignore the index - we don't care about the order of the implied class refs
- AbstractPersistenceUnit.this.addImpliedClassRef(resourceElement);
- }
+ @Override
public void removeContextElement(ClassRef element) {
- AbstractPersistenceUnit.this.removeImpliedClassRef(element);
+ super.removeContextElement(element);
+ element.dispose();
}
}
@@ -1061,16 +979,12 @@ public abstract class AbstractPersistenceUnit
// ********** properties **********
- public ListIterator<Property> properties() {
- return this.getProperties().iterator();
- }
-
- protected ListIterable<Property> getProperties() {
- return new LiveCloneListIterable<Property>(this.properties);
+ public ListIterable<Property> getProperties() {
+ return this.propertyContainer.getContextElements();
}
- public int propertiesSize() {
- return this.properties.size();
+ public int getPropertiesSize() {
+ return this.propertyContainer.getContextElementsSize();
}
public Property getProperty(String propertyName) {
@@ -1097,11 +1011,11 @@ public abstract class AbstractPersistenceUnit
};
}
- public Iterator<Property> propertiesWithNamePrefix(final String propertyNamePrefix) {
+ public Iterable<Property> getPropertiesWithNamePrefix(final String propertyNamePrefix) {
if (propertyNamePrefix == null) {
throw new NullPointerException();
}
- return new FilteringIterator<Property>(this.properties()) {
+ return new FilteringIterable<Property>(this.getProperties()) {
@Override
protected boolean accept(Property property) {
String pName = property.getName();
@@ -1111,7 +1025,7 @@ public abstract class AbstractPersistenceUnit
}
public Property addProperty() {
- return this.addProperty(this.properties.size());
+ return this.addProperty(this.getPropertiesSize());
}
public Property addProperty(int index) {
@@ -1177,17 +1091,16 @@ public abstract class AbstractPersistenceUnit
}
public void removeProperty(Property property) {
- this.removeProperty(this.properties.indexOf(property));
+ this.removeProperty(this.propertyContainer.indexOfContextElement(property));
}
public void removeProperty(String propertyName) {
if (propertyName == null) {
throw new NullPointerException();
}
- for (ListIterator<Property> stream = this.properties.listIterator(); stream.hasNext(); ) {
- Property property = stream.next();
+ for (Property property : this.getProperties()) {
if (propertyName.equals(property.getName())) {
- this.removeProperty(stream.previousIndex());
+ this.removeProperty(property);
return;
}
}
@@ -1198,10 +1111,9 @@ public abstract class AbstractPersistenceUnit
if ((propertyName == null) || (value == null)) {
throw new NullPointerException();
}
- for (ListIterator<Property> stream = this.properties.listIterator(); stream.hasNext(); ) {
- Property property = stream.next();
+ for (Property property : this.getProperties()) {
if (propertyName.equals(property.getName()) && value.equals(property.getValue())) {
- this.removeProperty(stream.previousIndex());
+ this.removeProperty(property);
return;
}
}
@@ -1209,14 +1121,13 @@ public abstract class AbstractPersistenceUnit
}
protected void removeProperty(int index) {
- Property removedProperty = this.properties.remove(index);
+ Property removedProperty = this.propertyContainer.removeContextElement(index);
this.xmlPersistenceUnit.getProperties().getProperties().remove(index);
if (this.xmlPersistenceUnit.getProperties().getProperties().isEmpty()) {
this.xmlPersistenceUnit.setProperties(null);
}
- this.fireItemRemoved(PROPERTIES_LIST, index, removedProperty);
if (removedProperty.getName() != null) {
this.propertyRemoved(removedProperty.getName());
}
@@ -1250,32 +1161,28 @@ public abstract class AbstractPersistenceUnit
}
protected void initializeProperties() {
- for (XmlProperty xmlProperty : this.getXmlProperties()) {
- this.properties.add(this.buildProperty(xmlProperty));
- }
this.connection = this.getContextNodeFactory().buildConnection(this);
this.options = this.getContextNodeFactory().buildOptions(this);
}
protected void syncProperties() {
- ContextContainerTools.synchronizeWithResourceModel(this.propertyContainerAdapter);
+ this.propertyContainer.synchronizeWithResourceModel();
+ }
+
+ protected void updateProperties() {
+ this.propertyContainer.update();
}
- protected Iterable<XmlProperty> getXmlProperties() {
+ protected ListIterable<XmlProperty> getXmlProperties() {
XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
// clone to reduce chance of concurrency problems
return (xmlProperties == null) ?
- EmptyIterable.<XmlProperty>instance() :
- new LiveCloneIterable<XmlProperty>(xmlProperties.getProperties());
- }
-
- protected void moveProperty_(int index, Property property) {
- this.moveItemInList(index, this.properties.indexOf(property), this.properties, PROPERTIES_LIST);
+ EmptyListIterable.<XmlProperty>instance() :
+ new LiveCloneListIterable<XmlProperty>(xmlProperties.getProperties());
}
protected Property addProperty_(int index, XmlProperty xmlProperty) {
- Property property = this.buildProperty(xmlProperty);
- this.addItemToList(index, property, this.properties, PROPERTIES_LIST);
+ Property property = this.propertyContainer.addContextElement(index, xmlProperty);
if (property.getName() != null) {
this.propertyAdded(property.getName(), property.getValue());
}
@@ -1283,39 +1190,40 @@ public abstract class AbstractPersistenceUnit
}
protected void removeProperty_(Property property) {
- this.removeItemFromList(property, this.properties, PROPERTIES_LIST);
+ this.propertyContainer.removeContextElement(property);
if (property.getName() != null) {
this.propertyRemoved(property.getName());
}
}
+ protected ContextListContainer<Property, XmlProperty> buildPropertyContainer() {
+ return new PropertyContainer();
+ }
+
/**
- * property container adapter
+ * property container
*/
- protected class PropertyContainerAdapter
- implements ContextContainerTools.Adapter<Property, XmlProperty>
+ protected class PropertyContainer
+ extends ContextListContainer<Property, XmlProperty>
{
- public Iterable<Property> getContextElements() {
- return AbstractPersistenceUnit.this.getProperties();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return PROPERTIES_LIST;
+ }
+ @Override
+ protected Property buildContextElement(XmlProperty resourceElement) {
+ return AbstractPersistenceUnit.this.buildProperty(resourceElement);
}
- public Iterable<XmlProperty> getResourceElements() {
+ @Override
+ protected ListIterable<XmlProperty> getResourceElements() {
return AbstractPersistenceUnit.this.getXmlProperties();
}
- public XmlProperty getResourceElement(Property contextElement) {
+ @Override
+ protected XmlProperty getResourceElement(Property contextElement) {
return contextElement.getXmlProperty();
}
- public void moveContextElement(int index, Property element) {
- AbstractPersistenceUnit.this.moveProperty_(index, element);
- }
- public void addContextElement(int index, XmlProperty resourceElement) {
- AbstractPersistenceUnit.this.addProperty_(index, resourceElement);
- }
- public void removeContextElement(Property element) {
- AbstractPersistenceUnit.this.removeProperty_(element);
- }
}
-
// ********** mapping file (orm.xml) persistence unit metadata & defaults **********
public boolean isXmlMappingMetadataComplete() {
@@ -1536,22 +1444,14 @@ public abstract class AbstractPersistenceUnit
// ********** generators **********
- public Iterator<Generator> generators() {
- return this.getGenerators().iterator();
- }
-
- protected Iterable<Generator> getGenerators() {
+ public Iterable<Generator> getGenerators() {
return new LiveCloneIterable<Generator>(this.generators);
}
- public int generatorsSize() {
+ public int getGeneratorsSize() {
return this.generators.size();
}
- public void addGenerator(Generator generator) {
- this.generators.add(generator);
- }
-
public Iterable<String> getUniqueGeneratorNames() {
HashSet<String> names = new HashSet<String>(this.generators.size());
this.addNonEmptyGeneratorNamesTo(names);
@@ -1636,7 +1536,7 @@ public abstract class AbstractPersistenceUnit
if (typeMapping instanceof Entity) {
this.addGeneratorsTo(((Entity) typeMapping).getGeneratorContainer(), generatorList);
}
- for (ReadOnlyPersistentAttribute persistentAttribute : CollectionTools.iterable(persistentType.attributes())) {
+ for (ReadOnlyPersistentAttribute persistentAttribute : persistentType.getAttributes()) {
AttributeMapping attributeMapping = persistentAttribute.getMapping();
if (attributeMapping instanceof IdMapping) {
this.addGeneratorsTo(((IdMapping) attributeMapping).getGeneratorContainer(), generatorList);
@@ -1673,15 +1573,11 @@ public abstract class AbstractPersistenceUnit
// ********** queries **********
- public Iterator<Query> queries() {
- return this.getQueries().iterator();
- }
-
- protected Iterable<Query> getQueries() {
+ public Iterable<Query> getQueries() {
return new LiveCloneIterable<Query>(this.queries);
}
- public int queriesSize() {
+ public int getQueriesSize() {
return this.queries.size();
}
@@ -1776,8 +1672,8 @@ public abstract class AbstractPersistenceUnit
}
protected void addQueriesTo(QueryContainer queryContainer, ArrayList<Query> queryList) {
- CollectionTools.addAll(queryList, queryContainer.namedQueries());
- CollectionTools.addAll(queryList, queryContainer.namedNativeQueries());
+ CollectionTools.addAll(queryList, queryContainer.getNamedQueries());
+ CollectionTools.addAll(queryList, queryContainer.getNamedNativeQueries());
}
protected HashMap<String, ArrayList<Query>> mapQueriesByName(Iterable<Query> queryList) {
@@ -2245,7 +2141,7 @@ public abstract class AbstractPersistenceUnit
}
protected void checkForDuplicateMappingFiles(List<IMessage> messages) {
- HashBag<String> fileNames = CollectionTools.bag(this.mappingFileRefNames());
+ HashBag<String> fileNames = CollectionTools.bag(this.getMappingFileRefNames());
for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
String fileName = mappingFileRef.getFileName();
if (fileNames.count(fileName) > 1) {
@@ -2652,15 +2548,15 @@ public abstract class AbstractPersistenceUnit
}
protected Iterable<IFile> getGeneratedMetamodelFiles() {
- return new TransformationIterable<JavaResourcePersistentType2_0, IFile>(this.getGeneratedMetamodelTopLevelTypes()) {
+ return new TransformationIterable<JavaResourceAbstractType, IFile>(this.getGeneratedMetamodelTopLevelTypes()) {
@Override
- protected IFile transform(JavaResourcePersistentType2_0 jrpt) {
+ protected IFile transform(JavaResourceAbstractType jrpt) {
return jrpt.getFile();
}
};
}
- protected Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTopLevelTypes() {
+ protected Iterable<JavaResourceAbstractType> getGeneratedMetamodelTopLevelTypes() {
return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTopLevelTypes();
}
@@ -2707,9 +2603,9 @@ public abstract class AbstractPersistenceUnit
break; // stop - this will be processed in the outer 'for' loop
}
// check for a Java resource persistent type
- JavaResourcePersistentType jrpt = this.getJpaProject().getJavaResourcePersistentType(memberTypeName);
- if (jrpt != null) {
- declaringTypeName = jrpt.getDeclaringTypeName();
+ JavaResourceAbstractType jrat = this.getJpaProject().getJavaResourceType(memberTypeName);
+ if (jrat != null) {
+ declaringTypeName = jrat.getDeclaringTypeName();
} else {
// check for a JDT type
IType jdtType = this.findJdtType(memberTypeName);
@@ -2855,8 +2751,8 @@ public abstract class AbstractPersistenceUnit
return null;
}
- public <T extends ReadOnlyPersistentAttribute> ListIterator<T> attributes() {
- return EmptyListIterator.instance();
+ public ListIterable<? extends ReadOnlyPersistentAttribute> getAttributes() {
+ return EmptyListIterable.instance();
}
public IFile getMetamodelFile() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
index d0f241c83e..46e333c58d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.persistence;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JarFile;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
@@ -26,7 +27,6 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersist
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnitProperty;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.ImpliedMappingFileRef;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
index b3f6f76fbb..3cf01eabc4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context;
import java.util.List;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
@@ -24,19 +23,15 @@ public abstract class AbstractPersistentAttributeValidator
{
protected ReadOnlyPersistentAttribute persistentAttribute;
- protected JavaPersistentAttribute javaPersistentAttribute;
-
protected PersistentAttributeTextRangeResolver textRangeResolver;
protected AbstractPersistentAttributeValidator(
- ReadOnlyPersistentAttribute persistentAttribute, JavaPersistentAttribute javaPersistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) {
+ ReadOnlyPersistentAttribute persistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) {
this.persistentAttribute = persistentAttribute;
- this.javaPersistentAttribute = javaPersistentAttribute;
this.textRangeResolver = textRangeResolver;
}
-
public final boolean validate(List<IMessage> messages, IReporter reporter) {
if (this.persistentAttribute.getMappingKey() != MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
this.validateMappedAttribute(messages);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
index 093825f005..e2dfa83259 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
@@ -171,7 +171,7 @@ public abstract class AbstractPrimaryKeyValidator
}
for (JavaPersistentAttribute idClassAttribute :
new SubIterableWrapper<ReadOnlyPersistentAttribute, JavaPersistentAttribute>(
- CollectionTools.iterable(idClass.allAttributes()))) {
+ idClass.getAllAttributes())) {
boolean foundMatch = false;
for (AttributeMapping attributeMapping : getAttributeMappings(typeMapping())) {
if (idClassAttribute.getName().equals(attributeMapping.getName())) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java
index 88498168b8..c38baf9152 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle.
+ * Copyright (c) 2010, 2011 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -11,11 +11,11 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context;
import java.util.List;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -24,15 +24,15 @@ public abstract class AbstractTypeMappingValidator<T extends TypeMapping>
{
protected T typeMapping;
- protected JavaResourcePersistentType jrpt;
+ protected JavaResourceType jrt;
protected TypeMappingTextRangeResolver textRangeResolver;
protected AbstractTypeMappingValidator(
- T typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
+ T typeMapping, JavaResourceType jrt, TypeMappingTextRangeResolver textRangeResolver) {
this.typeMapping = typeMapping;
- this.jrpt = jrpt;
+ this.jrt = jrt;
this.textRangeResolver = textRangeResolver;
}
@@ -45,38 +45,38 @@ public abstract class AbstractTypeMappingValidator<T extends TypeMapping>
protected abstract void validateType(List<IMessage> messages);
protected boolean isMemberType() {
- if (this.jrpt == null) {
+ if (this.jrt == null) {
return false;
}
- return this.jrpt.isMemberType();
+ return this.jrt.isMemberType();
}
protected boolean isStaticType() {
- if (this.jrpt == null) {
+ if (this.jrt == null) {
return false;
}
- return this.jrpt.isStatic();
+ return this.jrt.isStatic();
}
protected boolean isFinalType() {
- if (this.jrpt == null) {
+ if (this.jrt == null) {
return false;
}
- return this.jrpt.isFinal();
+ return this.jrt.isFinal();
}
protected boolean hasPrivateNoArgConstructor() {
- if (this.jrpt == null) {
+ if (this.jrt == null) {
return false;
}
- return this.jrpt.hasPrivateNoArgConstructor();
+ return this.jrt.hasPrivateNoArgConstructor();
}
protected boolean hasNoArgConstructor() {
- if (this.jrpt == null) {
+ if (this.jrt == null) {
return false;
}
- return this.jrpt.hasNoArgConstructor();
+ return this.jrt.hasNoArgConstructor();
}
protected IMessage buildTypeMessage(String msgID) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java
index 67f9c1b414..5bab03af96 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java
@@ -49,7 +49,7 @@ public abstract class BaseJoinColumnValidator<C extends ReadOnlyBaseJoinColumn,
}
protected void validateJoinColumnName(List<IMessage> messages) {
- if ((this.column.getSpecifiedName() == null) && (this.joinColumnOwner.joinColumnsSize() > 1)) {
+ if ((this.column.getSpecifiedName() == null) && (this.joinColumnOwner.getJoinColumnsSize() > 1)) {
messages.add(this.buildUnspecifiedNameMultipleJoinColumnsMessage());
}
else if (this.column.getName() != null){
@@ -62,7 +62,7 @@ public abstract class BaseJoinColumnValidator<C extends ReadOnlyBaseJoinColumn,
}
protected void validateReferencedColumnName(List<IMessage> messages) {
- if ((this.column.getSpecifiedReferencedColumnName() == null) && (this.joinColumnOwner.joinColumnsSize() > 1)) {
+ if ((this.column.getSpecifiedReferencedColumnName() == null) && (this.joinColumnOwner.getJoinColumnsSize() > 1)) {
messages.add(this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage());
}
//bug 315292 is the reason we are only validating if there is a specified referenced column name
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
index e40692f8e2..1a6866663e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
@@ -14,6 +14,8 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.HashBag;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -27,8 +29,6 @@ import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceXml2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -267,11 +267,11 @@ public class GenericRootContextNode
if (persistence == null) {
return; // handled with other validation
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return; // the context model currently only supports 1 persistence unit
}
- PersistenceUnit persistenceUnit = persistence.persistenceUnits().next();
+ PersistenceUnit persistenceUnit = persistence.getPersistenceUnits().iterator().next();
HashBag<String> annotatedClassNames = CollectionTools.bag(this.jpaProject.getAnnotatedJavaSourceClassNames());
HashBag<String> orphans = annotatedClassNames.clone();
for (String annotatedClassName : annotatedClassNames) {
@@ -286,16 +286,16 @@ public class GenericRootContextNode
// with jrpt.getMappingAnnotation().getTextRange()
// (new method #getTextRange() ?)
for (String orphan : orphans) {
- JavaResourcePersistentType jrpt = this.jpaProject.getJavaResourcePersistentType(orphan);
- JavaResourceCompilationUnit jrcu = jrpt.getJavaResourceCompilationUnit();
- if (jrpt.isMapped()) {
+ JavaResourceAbstractType jrt = this.jpaProject.getJavaResourceType(orphan);
+ JavaResourceCompilationUnit jrcu = jrt.getJavaResourceCompilationUnit();
+ if (jrt.isAnnotatedWith(this.jpaProject.getTypeMappingAnnotations())) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
JpaValidationMessages.PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
- new String[] {jrpt.getQualifiedName()},
- jrpt.getFile(),
- jrpt.getNameTextRange(jrcu.buildASTRoot())
+ new String[] {jrt.getQualifiedName()},
+ jrt.getFile(),
+ jrt.getNameTextRange(jrcu.buildASTRoot())
)
);
}
@@ -304,9 +304,9 @@ public class GenericRootContextNode
DefaultJpaValidationMessages.buildMessage(
IMessage.NORMAL_SEVERITY,
JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
- new String[] {jrpt.getName()},
- jrpt.getFile(),
- jrpt.getNameTextRange(jrcu.buildASTRoot())
+ new String[] {jrt.getName()},
+ jrt.getFile(),
+ jrt.getNameTextRange(jrcu.buildASTRoot())
)
);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java
index 6a2ab46d5d..21e505ec43 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle.
+ * Copyright (c) 2010, 2011 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -11,17 +11,17 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context;
import java.util.List;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class GenericTypeMappingValidator
extends AbstractTypeMappingValidator<TypeMapping>
{
- public GenericTypeMappingValidator(TypeMapping typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
- super(typeMapping, jrpt, textRangeResolver);
+ public GenericTypeMappingValidator(TypeMapping typeMapping, JavaResourceType jrt, TypeMappingTextRangeResolver textRangeResolver) {
+ super(typeMapping, jrt, textRangeResolver);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentFieldValidator.java
index 1838129d29..6d06448154 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentFieldValidator.java
@@ -11,42 +11,31 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context;
import java.util.List;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.FieldAccessor;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-public class GenericPersistentAttributeValidator
+public class PersistentFieldValidator
extends AbstractPersistentAttributeValidator
{
- public GenericPersistentAttributeValidator(
- ReadOnlyPersistentAttribute persistentAttribute, JavaPersistentAttribute javaPersistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver)
+
+ protected FieldAccessor fieldAccessor;
+
+ public PersistentFieldValidator(
+ ReadOnlyPersistentAttribute persistentAttribute, FieldAccessor fieldAccessor, PersistentAttributeTextRangeResolver textRangeResolver)
{
- super(persistentAttribute, javaPersistentAttribute, textRangeResolver);
+ super(persistentAttribute, textRangeResolver);
+ this.fieldAccessor = fieldAccessor;
}
@Override
protected void validateMappedAttribute(List<IMessage> messages) {
- if (this.javaPersistentAttribute.isField()) {
- this.validateMappedField(messages);
- } else {
- this.validateMappedProperty(messages);
- }
- }
-
- protected void validateMappedField(List<IMessage> messages) {
- if (this.javaPersistentAttribute.isFinal()) {
+ if (this.fieldAccessor.isFinal()) {
messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD));
}
- if (this.javaPersistentAttribute.isPublic()) {
+ if (this.fieldAccessor.isPublic()) {
messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD));
}
}
-
- protected void validateMappedProperty(List<IMessage> messages) {
- //TODO need to check both the getter and the setter
- if (this.javaPersistentAttribute.isFinal()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER));
- }
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java
new file mode 100644
index 0000000000..b4444380b2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
+import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class PersistentPropertyValidator
+ extends AbstractPersistentAttributeValidator
+{
+
+ protected PropertyAccessor propertyAccessor;
+
+ public PersistentPropertyValidator(
+ ReadOnlyPersistentAttribute persistentAttribute, PropertyAccessor propertyAccessor, PersistentAttributeTextRangeResolver textRangeResolver)
+ {
+ super(persistentAttribute, textRangeResolver);
+ this.propertyAccessor = propertyAccessor;
+ }
+
+ @Override
+ //TODO validation for null getter or null setter - would apply to EclipseLink too
+ //TODO validation for annotated setter? - would apply to EclipseLink too
+ protected void validateMappedAttribute(List<IMessage> messages) {
+ if (this.propertyAccessor.getResourceGetter() != null && this.propertyAccessor.getResourceGetter().isFinal()) {
+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER));
+ }
+ if (this.propertyAccessor.getResourceSetter() != null && this.propertyAccessor.getResourceSetter().isFinal()) {
+ messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_SETTER));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java
index 95be875fb6..3d3b4d36c5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
public abstract class AbstractJavaConverter
extends AbstractJavaJpaContextNode
@@ -37,12 +37,12 @@ public abstract class AbstractJavaConverter
return this.getParent();
}
- protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getAttributeMapping().getResourcePersistentAttribute();
+ protected JavaResourceAttribute getResourceAttribute() {
+ return this.getAttributeMapping().getResourceAttribute();
}
public Annotation getConverterAnnotation() {
- return this.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName());
+ return this.getResourceAttribute().getAnnotation(this.getAnnotationName());
}
protected abstract String getAnnotationName();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
index 7ed3dce4d3..e9de36ba5b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
@@ -11,14 +11,17 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NotNullFilter;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
@@ -42,9 +45,6 @@ import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -115,16 +115,12 @@ public abstract class AbstractJavaOverrideContainer<
// ********** overrides **********
- public ListIterator<R> overrides() {
- return this.getOverrides().iterator();
- }
-
@SuppressWarnings("unchecked")
- protected ListIterable<R> getOverrides() {
+ public ListIterable<R> getOverrides() {
return new CompositeListIterable<R>(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides());
}
- public int overridesSize() {
+ public int getOverridesSize() {
return this.specifiedOverrides.size() + this.virtualOverrides.size();
}
@@ -220,11 +216,7 @@ public abstract class AbstractJavaOverrideContainer<
// ********** specified overrides **********
- public ListIterator<S> specifiedOverrides() {
- return this.getSpecifiedOverrides().iterator();
- }
-
- protected ListIterable<S> getSpecifiedOverrides() {
+ public ListIterable<S> getSpecifiedOverrides() {
return new LiveCloneListIterable<S>(this.specifiedOverrides);
}
@@ -235,7 +227,7 @@ public abstract class AbstractJavaOverrideContainer<
return (ListIterable<R>) this.getSpecifiedOverrides();
}
- public int specifiedOverridesSize() {
+ public int getSpecifiedOverridesSize() {
return this.specifiedOverrides.size();
}
@@ -264,7 +256,7 @@ public abstract class AbstractJavaOverrideContainer<
@SuppressWarnings("unchecked")
protected A buildOverrideAnnotation(int index) {
int annotationIndex = this.calculateNewAnnotationIndex(index);
- return (A) this.getResourcePersistentMember().addAnnotation(annotationIndex, this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName());
+ return (A) this.getResourceMember().addAnnotation(annotationIndex, this.getOverrideAnnotationName());
}
protected int calculateNewAnnotationIndex(int index) {
@@ -295,8 +287,6 @@ public abstract class AbstractJavaOverrideContainer<
protected abstract String getOverrideAnnotationName();
- protected abstract String getOverrideContainerAnnotationName();
-
protected void removeSpecifiedOverride(S override) {
this.removeSpecifiedOverride(this.specifiedOverrides.indexOf(override));
}
@@ -308,7 +298,7 @@ public abstract class AbstractJavaOverrideContainer<
protected void removeOverrideAnnotation(int index) {
int annotationIndex = this.translateToAnnotationIndex(index);
- this.getResourcePersistentMember().removeAnnotation(annotationIndex, this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName());
+ this.getResourceMember().removeAnnotation(annotationIndex, this.getOverrideAnnotationName());
}
protected void removeSpecifiedOverride_(int index) {
@@ -323,7 +313,7 @@ public abstract class AbstractJavaOverrideContainer<
protected void moveOverrideAnnotation(int targetIndex, int sourceIndex) {
int targetAnnotationIndex = this.translateToAnnotationIndex(targetIndex);
int sourceAnnotationIndex = this.translateToAnnotationIndex(sourceIndex);
- this.getResourcePersistentMember().moveAnnotation(targetAnnotationIndex, sourceAnnotationIndex, this.getOverrideContainerAnnotationName());
+ this.getResourceMember().moveAnnotation(targetAnnotationIndex, sourceAnnotationIndex, this.getOverrideAnnotationName());
}
protected abstract S buildSpecifiedOverride(A overrideAnnotation);
@@ -346,20 +336,18 @@ public abstract class AbstractJavaOverrideContainer<
}
protected Iterable<A> getOverrideAnnotations() {
- return new SubIterableWrapper<NestableAnnotation, A>(
- CollectionTools.iterable(this.overrideAnnotations())
- );
+ return new SubIterableWrapper<NestableAnnotation, A>((this.overrideAnnotations()));
}
- protected Iterator<NestableAnnotation> overrideAnnotations() {
- return (this.owner == null) ? EmptyIterator.<NestableAnnotation>instance() : this.overrideAnnotations_();
+ protected Iterable<NestableAnnotation> overrideAnnotations() {
+ return (this.owner == null) ? EmptyIterable.<NestableAnnotation>instance() : this.overrideAnnotations_();
}
/**
* pre-condition: {@link #owner} is not <code>null</code>
*/
- protected Iterator<NestableAnnotation> overrideAnnotations_() {
- return this.getResourcePersistentMember().annotations(this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName());
+ protected Iterable<NestableAnnotation> overrideAnnotations_() {
+ return this.getResourceMember().getAnnotations(this.getOverrideAnnotationName());
}
protected void moveSpecifiedOverride_(int index, S override) {
@@ -406,15 +394,11 @@ public abstract class AbstractJavaOverrideContainer<
// ********** virtual overrides **********
- public ListIterator<V> virtualOverrides() {
- return this.getVirtualOverrides().iterator();
- }
-
- protected ListIterable<V> getVirtualOverrides() {
+ public ListIterable<V> getVirtualOverrides() {
return new LiveCloneListIterable<V>(this.virtualOverrides);
}
- public int virtualOverridesSize() {
+ public int getVirtualOverridesSize() {
return this.virtualOverrides.size();
}
@@ -504,8 +488,8 @@ public abstract class AbstractJavaOverrideContainer<
return this.owner.getTypeMapping();
}
- protected JavaResourcePersistentMember getResourcePersistentMember() {
- return this.owner.getResourcePersistentMember();
+ protected JavaResourceMember getResourceMember() {
+ return this.owner.getResourceMember();
}
public TypeMapping getOverridableTypeMapping() {
@@ -604,8 +588,7 @@ public abstract class AbstractJavaOverrideContainer<
}
protected Annotation getValidationAnnotation() {
- JavaResourcePersistentMember resourceMember = this.getResourcePersistentMember();
- Annotation annotation = resourceMember.getAnnotation(this.getOverrideContainerAnnotationName());
- return (annotation != null) ? annotation : resourceMember.getAnnotation(this.getOverrideAnnotationName());
+ JavaResourceMember resourceMember = this.getResourceMember();
+ return resourceMember.getAnnotation(this.getOverrideAnnotationName());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
index 16298f2d59..bc33548424 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,26 +9,25 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
-import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.java.JarFile;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -41,8 +40,7 @@ public class GenericJarFile
{
protected final JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot;
- protected final Vector<JavaPersistentType> javaPersistentTypes = new Vector<JavaPersistentType>();
- protected final JavaPersistentTypeContainerAdapter javaPersistentTypeContainerAdapter = new JavaPersistentTypeContainerAdapter();
+ protected final ContextCollectionContainer<JavaPersistentType, JavaResourceType> javaPersistentTypeContainer;
// ********** constructor/initialization **********
@@ -50,7 +48,7 @@ public class GenericJarFile
public GenericJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) {
super(parent);
this.jarResourcePackageFragmentRoot = jarResourcePackageFragmentRoot;
- this.initializeJavaPersistentTypes();
+ this.javaPersistentTypeContainer = this.buildJavaPersistentTypeContainer();
}
@@ -65,7 +63,7 @@ public class GenericJarFile
@Override
public void update() {
super.update();
- this.updateNodes(this.getJavaPersistentTypes());
+ this.updateJavaPersistentTypes();
}
public JavaResourcePackageFragmentRoot getJarResourcePackageFragmentRoot() {
@@ -111,80 +109,85 @@ public class GenericJarFile
return null;
}
- public Iterator<JavaPersistentType> javaPersistentTypes() {
- return this.getJavaPersistentTypes().iterator();
+ public Iterable<JavaPersistentType> getJavaPersistentTypes() {
+ return this.javaPersistentTypeContainer.getContextElements();
}
- protected Iterable<JavaPersistentType> getJavaPersistentTypes() {
- return new LiveCloneIterable<JavaPersistentType>(this.javaPersistentTypes);
+ public int getJavaPersistentTypesSize() {
+ return this.javaPersistentTypeContainer.getContextElementsSize();
}
- public int javaPersistentTypesSize() {
- return this.javaPersistentTypes.size();
+ protected void syncJavaPersistentTypes() {
+ this.javaPersistentTypeContainer.synchronizeWithResourceModel();
}
- protected void initializeJavaPersistentTypes() {
- for (JavaResourcePersistentType jrpt : this.getJavaResourcePersistentTypes()) {
- this.javaPersistentTypes.add(this.buildJavaPersistentType(jrpt));
- }
+ protected void updateJavaPersistentTypes() {
+ this.javaPersistentTypeContainer.update();
}
- protected void syncJavaPersistentTypes() {
- ContextContainerTools.synchronizeWithResourceModel(this.javaPersistentTypeContainerAdapter);
+ protected void addJavaPersistentType(JavaResourceType jrt) {
+ this.javaPersistentTypeContainer.addContextElement(getJavaPersistentTypesSize(), jrt);
}
- protected void addJavaPersistentType(JavaResourcePersistentType jrpt) {
- JavaPersistentType javaPersistentType = this.buildJavaPersistentType(jrpt);
- this.addItemToCollection(javaPersistentType, this.javaPersistentTypes, JAVA_PERSISTENT_TYPES_COLLECTION);
+ protected void removeJavaPersistentType(JavaPersistentType javaPersistentType ) {
+ this.javaPersistentTypeContainer.removeContextElement(javaPersistentType);
}
- protected void removeJavaPersistentType(JavaPersistentType javaPersistentType ) {
- this.removeItemFromCollection(javaPersistentType, this.javaPersistentTypes, JAVA_PERSISTENT_TYPES_COLLECTION);
+ //only accept types, enums aren't valid for JPA
+ protected Iterable<JavaResourceType> getJavaResourceTypes() {
+ return new SubIterableWrapper<JavaResourceAbstractType, JavaResourceType>(
+ new FilteringIterable<JavaResourceAbstractType>(this.getJavaResourceAbstractTypes()) {
+ @Override
+ protected boolean accept(JavaResourceAbstractType o) {
+ return o.getKind() == Kind.TYPE;
+ }
+ });
}
/**
* the resource JAR holds only annotated types, so we can use them all for
* building the context types
*/
- protected Iterable<JavaResourcePersistentType> getJavaResourcePersistentTypes() {
- return CollectionTools.iterable(this.jarResourcePackageFragmentRoot.persistentTypes());
+ protected Iterable<JavaResourceAbstractType> getJavaResourceAbstractTypes() {
+ return this.jarResourcePackageFragmentRoot.getTypes();
}
- protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
- return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
+ protected JavaPersistentType buildJavaPersistentType(JavaResourceType jrt) {
+ return this.getJpaFactory().buildJavaPersistentType(this, jrt);
+ }
+
+ protected ContextCollectionContainer<JavaPersistentType, JavaResourceType> buildJavaPersistentTypeContainer() {
+ return new JavaPersistentTypeContainer();
}
/**
- * Java persistent type container adapter
+ * Java persistent type container
*/
- protected class JavaPersistentTypeContainerAdapter
- implements ContextContainerTools.Adapter<JavaPersistentType, JavaResourcePersistentType>
+ protected class JavaPersistentTypeContainer
+ extends ContextCollectionContainer<JavaPersistentType, JavaResourceType>
{
- public Iterable<JavaPersistentType> getContextElements() {
- return GenericJarFile.this.getJavaPersistentTypes();
- }
- public Iterable<JavaResourcePersistentType> getResourceElements() {
- return GenericJarFile.this.getJavaResourcePersistentTypes();
- }
- public JavaResourcePersistentType getResourceElement(JavaPersistentType contextElement) {
- return contextElement.getResourcePersistentType();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return JAVA_PERSISTENT_TYPES_COLLECTION;
}
- public void moveContextElement(int index, JavaPersistentType element) {
- // ignore moves - we don't care about the order of the Java persistent types
+ @Override
+ protected JavaPersistentType buildContextElement(JavaResourceType resourceElement) {
+ return GenericJarFile.this.buildJavaPersistentType(resourceElement);
}
- public void addContextElement(int index, JavaResourcePersistentType resourceElement) {
- // ignore the index - we don't care about the order of the Java persistent types
- GenericJarFile.this.addJavaPersistentType(resourceElement);
+ @Override
+ protected Iterable<JavaResourceType> getResourceElements() {
+ return GenericJarFile.this.getJavaResourceTypes();
}
- public void removeContextElement(JavaPersistentType element) {
- GenericJarFile.this.removeJavaPersistentType(element);
+ @Override
+ protected JavaResourceType getResourceElement(JavaPersistentType contextElement) {
+ return contextElement.getJavaResourceType();
}
}
// ********** PersistentTypeContainer implementation **********
- public Iterable<? extends PersistentType> getPersistentTypes() {
+ public Iterable<JavaPersistentType> getPersistentTypes() {
return this.getJavaPersistentTypes();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
index 5566657d9d..215fc57d2d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
@@ -26,8 +26,6 @@ import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0;
import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
/**
* Java attribute override container
@@ -38,7 +36,7 @@ public class GenericJavaAssociationOverrideContainer
JavaReadOnlyAssociationOverride,
JavaAssociationOverride,
JavaVirtualAssociationOverride,
- NestableAssociationOverrideAnnotation
+ AssociationOverrideAnnotation
>
implements JavaAssociationOverrideContainer2_0
{
@@ -82,12 +80,7 @@ public class GenericJavaAssociationOverrideContainer
}
@Override
- protected String getOverrideContainerAnnotationName() {
- return AssociationOverridesAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected JavaAssociationOverride buildSpecifiedOverride(NestableAssociationOverrideAnnotation overrideAnnotation) {
+ protected JavaAssociationOverride buildSpecifiedOverride(AssociationOverrideAnnotation overrideAnnotation) {
return this.getJpaFactory().buildJavaAssociationOverride(this, overrideAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
index 9d84836b8f..182d70f4aa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
@@ -17,8 +17,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAttributeOverride;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
/**
* Java attribute override container
@@ -29,7 +27,7 @@ public class GenericJavaAttributeOverrideContainer
JavaReadOnlyAttributeOverride,
JavaAttributeOverride,
JavaVirtualAttributeOverride,
- NestableAttributeOverrideAnnotation
+ AttributeOverrideAnnotation
>
implements JavaAttributeOverrideContainer2_0
{
@@ -52,12 +50,7 @@ public class GenericJavaAttributeOverrideContainer
}
@Override
- protected String getOverrideContainerAnnotationName() {
- return AttributeOverridesAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected JavaAttributeOverride buildSpecifiedOverride(NestableAttributeOverrideAnnotation overrideAnnotation) {
+ protected JavaAttributeOverride buildSpecifiedOverride(AttributeOverrideAnnotation overrideAnnotation) {
return this.getJpaFactory().buildJavaAttributeOverride(this, overrideAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
index a88cc6660c..5cf6eac93c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0, which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html.
@@ -9,13 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* Java discriminator column
@@ -59,12 +59,12 @@ public class GenericJavaDiscriminatorColumn
@Override
public DiscriminatorColumnAnnotation getColumnAnnotation() {
- return (DiscriminatorColumnAnnotation) this.getResourcePersistentType().getNonNullAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME);
+ return (DiscriminatorColumnAnnotation) this.getJavaResourceType().getNonNullAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME);
}
@Override
protected void removeColumnAnnotation() {
- this.getResourcePersistentType().removeAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME);
+ this.getJavaResourceType().removeAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME);
}
@@ -169,8 +169,8 @@ public class GenericJavaDiscriminatorColumn
return this.getEntity().getPersistentType();
}
- protected JavaResourcePersistentType getResourcePersistentType() {
- return this.getPersistentType().getResourcePersistentType();
+ protected JavaResourceType getJavaResourceType() {
+ return this.getPersistentType().getJavaResourceType();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
index 20a918f8b1..ff6de341bd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
@@ -107,7 +107,7 @@ public class GenericJavaEmbeddedIdMapping
// attribute overrides are in error
// (in JPA 1.0, this will obviously never be reached)
if (this.derived
- && (this.attributeOverrideContainer.specifiedOverridesSize() > 0)) {
+ && (this.attributeOverrideContainer.getSpecifiedOverridesSize() > 0)) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
index 5cb380e156..eefe8e76e2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -51,7 +52,6 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionP
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -224,8 +224,8 @@ public class GenericJavaEmbeddedMapping
protected class AssociationOverrideContainerOwner
implements JavaAssociationOverrideContainer2_0.Owner
{
- public JavaResourcePersistentMember getResourcePersistentMember() {
- return GenericJavaEmbeddedMapping.this.getResourcePersistentAttribute();
+ public JavaResourceAttribute getResourceMember() {
+ return GenericJavaEmbeddedMapping.this.getResourceAttribute();
}
public TypeMapping getTypeMapping() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
index 2d793a6521..4ef75043af 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
@@ -202,8 +202,8 @@ public class GenericJavaGeneratedValue
return;
}
- for (Iterator<Generator> stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) {
- if (generator.equals(stream.next().getName())) {
+ for (Generator next : this.getPersistenceUnit().getGenerators()) {
+ if (generator.equals(next.getName())) {
return;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java
index fa515cb0dd..7712a12b19 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java
@@ -11,16 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.Entity;
@@ -37,7 +33,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
@@ -59,8 +54,7 @@ public class GenericJavaJoinTable
extends GenericJavaReferenceTable<JoinTableAnnotation>
implements JavaJoinTable
{
- protected final Vector<JavaJoinColumn> specifiedInverseJoinColumns = new Vector<JavaJoinColumn>();
- protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
+ protected final SpecifiedInverseJoinColumnContainer specifiedInverseJoinColumnContainer;
protected final JavaReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
protected JavaJoinColumn defaultInverseJoinColumn;
@@ -69,7 +63,7 @@ public class GenericJavaJoinTable
public GenericJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Owner owner) {
super(parent, owner);
this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- this.initializeSpecifiedInverseJoinColumns();
+ this.specifiedInverseJoinColumnContainer = new SpecifiedInverseJoinColumnContainer();
}
@Override
@@ -92,7 +86,7 @@ public class GenericJavaJoinTable
@Override
public void update() {
super.update();
- this.updateNodes(this.getSpecifiedInverseJoinColumns());
+ this.updateSpecifiedInverseJoinColumns();
this.updateDefaultInverseJoinColumn();
}
@@ -112,16 +106,12 @@ public class GenericJavaJoinTable
// ********** inverse join columns **********
- public ListIterator<JavaJoinColumn> inverseJoinColumns() {
- return this.getInverseJoinColumns().iterator();
- }
-
- protected ListIterable<JavaJoinColumn> getInverseJoinColumns() {
+ public ListIterable<JavaJoinColumn> getInverseJoinColumns() {
return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
}
- public int inverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.defaultInverseJoinColumnsSize();
+ public int getInverseJoinColumnsSize() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumnsSize() : this.defaultInverseJoinColumnsSize();
}
public void convertDefaultInverseJoinColumnToSpecified() {
@@ -131,113 +121,87 @@ public class GenericJavaJoinTable
// ********** specified inverse join columns **********
- public ListIterator<JavaJoinColumn> specifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumns().iterator();
- }
-
public ListIterable<JavaJoinColumn> getSpecifiedInverseJoinColumns() {
- return new LiveCloneListIterable<JavaJoinColumn>(this.specifiedInverseJoinColumns);
+ return this.specifiedInverseJoinColumnContainer.getContextElements();
}
- public int specifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumns.size();
+ public int getSpecifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumns.size() != 0;
+ return this.getSpecifiedInverseJoinColumnsSize() != 0;
}
public JavaJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumns.get(index);
+ return this.specifiedInverseJoinColumnContainer.getContextElement(index);
}
public JavaJoinColumn addSpecifiedInverseJoinColumn() {
- return this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size());
+ return this.addSpecifiedInverseJoinColumn(this.getSpecifiedInverseJoinColumnsSize());
}
public JavaJoinColumn addSpecifiedInverseJoinColumn(int index) {
JoinColumnAnnotation annotation = this.getTableAnnotation().addInverseJoinColumn(index);
- return this.addSpecifiedInverseJoinColumn_(index, annotation);
+ return this.specifiedInverseJoinColumnContainer.addContextElement(index, annotation);
}
public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(joinColumn));
+ this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumnContainer.indexOfContextElement((JavaJoinColumn) joinColumn));
}
public void removeSpecifiedInverseJoinColumn(int index) {
this.getTableAnnotation().removeInverseJoinColumn(index);
this.removeTableAnnotationIfUnset();
- this.removeSpecifiedInverseJoinColumn_(index);
- }
-
- protected void removeSpecifiedInverseJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.specifiedInverseJoinColumnContainer.removeContextElement(index);
}
public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
this.getTableAnnotation().moveInverseJoinColumn(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.specifiedInverseJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
}
public void clearSpecifiedInverseJoinColumns() {
// for now, we have to remove annotations one at a time...
- for (int i = this.specifiedInverseJoinColumns.size(); i-- > 0; ) {
+ for (int i = this.getSpecifiedInverseJoinColumnsSize(); i-- > 0; ) {
this.removeSpecifiedInverseJoinColumn(i);
}
}
- protected void initializeSpecifiedInverseJoinColumns() {
- for (JoinColumnAnnotation joinColumnAnnotation : this.getInverseJoinColumnAnnotations()) {
- this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(joinColumnAnnotation));
- }
- }
-
protected void syncSpecifiedInverseJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedInverseJoinColumnContainerAdapter);
+ this.specifiedInverseJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<JoinColumnAnnotation> getInverseJoinColumnAnnotations() {
- return CollectionTools.iterable(this.getTableAnnotation().inverseJoinColumns());
+ protected void updateSpecifiedInverseJoinColumns() {
+ this.specifiedInverseJoinColumnContainer.update();
}
- protected void moveSpecifiedInverseJoinColumn_(int index, JavaJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- }
-
- protected JavaJoinColumn addSpecifiedInverseJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) {
- JavaJoinColumn joinColumn = this.buildInverseJoinColumn(joinColumnAnnotation);
- this.addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedInverseJoinColumn_(JavaJoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn_(this.specifiedInverseJoinColumns.indexOf(joinColumn));
+ protected ListIterable<JoinColumnAnnotation> getInverseJoinColumnAnnotations() {
+ return this.getTableAnnotation().getInverseJoinColumns();
}
/**
- * specified inverse join column container adapter
+ * inverse join column container
*/
- protected class SpecifiedInverseJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaJoinColumn, JoinColumnAnnotation>
+ protected class SpecifiedInverseJoinColumnContainer
+ extends ContextListContainer<JavaJoinColumn, JoinColumnAnnotation>
{
- public Iterable<JavaJoinColumn> getContextElements() {
- return GenericJavaJoinTable.this.getSpecifiedInverseJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_INVERSE_JOIN_COLUMNS_LIST;
}
- public Iterable<JoinColumnAnnotation> getResourceElements() {
+ @Override
+ protected JavaJoinColumn buildContextElement(JoinColumnAnnotation resourceElement) {
+ return GenericJavaJoinTable.this.buildInverseJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<JoinColumnAnnotation> getResourceElements() {
return GenericJavaJoinTable.this.getInverseJoinColumnAnnotations();
}
- public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
+ @Override
+ protected JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
return contextElement.getColumnAnnotation();
}
- public void moveContextElement(int index, JavaJoinColumn element) {
- GenericJavaJoinTable.this.moveSpecifiedInverseJoinColumn_(index, element);
- }
- public void addContextElement(int index, JoinColumnAnnotation resourceElement) {
- GenericJavaJoinTable.this.addSpecifiedInverseJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(JavaJoinColumn element) {
- GenericJavaJoinTable.this.removeSpecifiedInverseJoinColumn_(element);
- }
}
protected JavaReadOnlyJoinColumn.Owner buildInverseJoinColumnOwner() {
@@ -302,14 +266,14 @@ public class GenericJavaJoinTable
public void initializeFrom(ReadOnlyJoinTable oldTable) {
super.initializeFrom(oldTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedInverseJoinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : oldTable.getSpecifiedInverseJoinColumns()) {
this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn);
}
}
public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) {
super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.inverseJoinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : virtualTable.getInverseJoinColumns()) {
this.addSpecifiedInverseJoinColumn().initializeFromVirtual(joinColumn);
}
}
@@ -335,7 +299,7 @@ public class GenericJavaJoinTable
if (result != null) {
return result;
}
- for (JavaJoinColumn column : CollectionTools.iterable(this.inverseJoinColumns())) {
+ for (JavaJoinColumn column : this.getInverseJoinColumns()) {
result = column.javaCompletionProposals(pos, filter, astRoot);
if (result != null) {
return result;
@@ -451,8 +415,8 @@ public class GenericJavaJoinTable
return GenericJavaJoinTable.this.defaultJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericJavaJoinTable.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaJoinTable.this.getJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
@@ -491,8 +455,8 @@ public class GenericJavaJoinTable
return GenericJavaJoinTable.this.defaultInverseJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericJavaJoinTable.this.inverseJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaJoinTable.this.getInverseJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
index 7664f5c9d2..d088cf32c9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.context.JoinTable;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
@@ -27,7 +28,6 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionP
import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableValidator;
import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
public class GenericJavaMappingJoinTableRelationshipStrategy
@@ -42,24 +42,24 @@ public class GenericJavaMappingJoinTableRelationshipStrategy
// ********** join table annotation **********
public JoinTableAnnotation getJoinTableAnnotation() {
- return (JoinTableAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ return (JoinTableAnnotation) this.getResourceAttribute().getNonNullAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
}
@Override
protected JoinTableAnnotation addJoinTableAnnotation() {
- return (JoinTableAnnotation) this.getResourcePersistentAttribute().addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ return (JoinTableAnnotation) this.getResourceAttribute().addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
}
@Override
protected void removeJoinTableAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
}
// ********** misc **********
- protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getRelationship().getMapping().getResourcePersistentAttribute();
+ protected JavaResourceAttribute getResourceAttribute() {
+ return this.getRelationship().getMapping().getResourceAttribute();
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
index 864603a34e..46bc58368f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,11 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping;
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
/**
* null mapping used when an attribute's default mapping cannot be determined
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
index a661cf6e5d..443be27767 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
@@ -30,7 +31,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -329,7 +329,7 @@ public class GenericJavaOrderable
// ********** order by annotation **********
protected OrderByAnnotation getOrderByAnnotation() {
- return (OrderByAnnotation) this.getResourcePersistentAttribute().getAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ return (OrderByAnnotation) this.getResourceAttribute().getAnnotation(OrderByAnnotation.ANNOTATION_NAME);
}
protected OrderByAnnotation getOrderByAnnotationForUpdate() {
@@ -338,18 +338,18 @@ public class GenericJavaOrderable
}
protected OrderByAnnotation addOrderByAnnotation() {
- return (OrderByAnnotation) this.getResourcePersistentAttribute().addAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ return (OrderByAnnotation) this.getResourceAttribute().addAnnotation(OrderByAnnotation.ANNOTATION_NAME);
}
protected void removeOrderByAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME);
}
// ********** order column annotation **********
protected OrderColumn2_0Annotation getOrderColumnAnnotation() {
- return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ return (OrderColumn2_0Annotation) this.getResourceAttribute().getAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
}
/**
@@ -360,7 +360,7 @@ public class GenericJavaOrderable
}
protected OrderColumn2_0Annotation addOrderColumnAnnotation() {
- return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ return (OrderColumn2_0Annotation) this.getResourceAttribute().addAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
}
protected void removeOrderColumnAnnotation() {
@@ -370,7 +370,7 @@ public class GenericJavaOrderable
}
protected void removeOrderColumnAnnotation_() {
- this.getResourcePersistentAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
}
@@ -389,8 +389,8 @@ public class GenericJavaOrderable
return this.getAttributeMapping().getPersistentAttribute();
}
- public JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getPersistentAttribute().getResourcePersistentAttribute();
+ public JavaResourceAttribute getResourceAttribute() {
+ return this.getPersistentAttribute().getResourceAttribute();
}
// JPA 2.0 only
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
index 612a619cc6..a1c781c011 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
@@ -10,11 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.java.Accessor;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* Generic Java persistent attribute
@@ -23,14 +24,22 @@ public class GenericJavaPersistentAttribute
extends AbstractJavaPersistentAttribute
{
- public GenericJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) {
- super(parent, jrpa);
+ public GenericJavaPersistentAttribute(PersistentType parent, JavaResourceField resourceField) {
+ super(parent, resourceField);
+ }
+
+ public GenericJavaPersistentAttribute(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
+ super(parent, resourceGetter, resourceSetter);
+ }
+
+ public GenericJavaPersistentAttribute(PersistentType parent, Accessor accessor) {
+ super(parent, accessor);
}
// ********** validation **********
@Override
- protected JptValidator buildAttibuteValidator(CompilationUnit astRoot) {
- return new GenericPersistentAttributeValidator(this, this, this.buildTextRangeResolver(astRoot));
+ protected JptValidator buildAttributeValidator(CompilationUnit astRoot) {
+ return getAccessor().buildAttributeValidator(this, this.buildTextRangeResolver(astRoot));
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java
index bf74484e4e..ccd859882e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* JPA 1.0 Java persistent type.
@@ -21,8 +21,8 @@ import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
public class GenericJavaPersistentType
extends AbstractJavaPersistentType
{
- public GenericJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
- super(parent, jrpt);
+ public GenericJavaPersistentType(PersistentType.Owner parent, JavaResourceType jrt) {
+ super(parent, jrt);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
index d64590cffe..32fa2370d7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
@@ -9,32 +9,21 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper;
-import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper;
+import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper;
import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery;
import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -47,18 +36,15 @@ public class GenericJavaQueryContainer
{
protected final Owner owner;
- protected final Vector<JavaNamedQuery> namedQueries = new Vector<JavaNamedQuery>();
- protected NamedQueryContainerAdapter namedQueryContainerAdapter = new NamedQueryContainerAdapter();
-
- protected final Vector<JavaNamedNativeQuery> namedNativeQueries = new Vector<JavaNamedNativeQuery>();
- protected NamedNativeQueryContainerAdapter namedNativeQueryContainerAdapter = new NamedNativeQueryContainerAdapter();
+ protected final ContextListContainer<JavaNamedQuery, NamedQueryAnnotation> namedQueryContainer;
+ protected final ContextListContainer<JavaNamedNativeQuery, NamedNativeQueryAnnotation> namedNativeQueryContainer;
public GenericJavaQueryContainer(JavaJpaContextNode parent, Owner owner) {
super(parent);
this.owner = owner;
- this.initializeNamedQueries();
- this.initializeNamedNativeQueries();
+ this.namedQueryContainer = this.buildNamedQueryContainer();
+ this.namedNativeQueryContainer = this.buildNamedNativeQueryContainer();
}
@@ -74,60 +60,47 @@ public class GenericJavaQueryContainer
@Override
public void update() {
super.update();
- this.updateNodes(this.getNamedQueries());
- this.updateNodes(this.getNamedNativeQueries());
+ this.updateNamedQueries();
+ this.updateNamedNativeQueries();
}
// ********** named queries **********
- public ListIterator<JavaNamedQuery> namedQueries() {
- return this.getNamedQueries().iterator();
- }
- protected ListIterable<JavaNamedQuery> getNamedQueries() {
- return new LiveCloneListIterable<JavaNamedQuery>(this.namedQueries);
+ public ListIterable<JavaNamedQuery> getNamedQueries() {
+ return this.namedQueryContainer.getContextElements();
}
- public int namedQueriesSize() {
- return this.namedQueries.size();
+ public int getNamedQueriesSize() {
+ return this.namedQueryContainer.getContextElementsSize();
}
public JavaNamedQuery addNamedQuery() {
- return this.addNamedQuery(this.namedQueries.size());
+ return this.addNamedQuery(this.getNamedQueriesSize());
}
public JavaNamedQuery addNamedQuery(int index) {
- NamedQueryAnnotation annotation = this.buildNamedQueryAnnotation(index);
- return this.addNamedQuery_(index, annotation);
+ NamedQueryAnnotation annotation = this.addNamedQueryAnnotation(index);
+ return this.namedQueryContainer.addContextElement(index, annotation);
}
- protected NamedQueryAnnotation buildNamedQueryAnnotation(int index) {
- return (NamedQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ protected NamedQueryAnnotation addNamedQueryAnnotation(int index) {
+ return (NamedQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME);
}
public void removeNamedQuery(NamedQuery namedQuery) {
- this.removeNamedQuery(this.namedQueries.indexOf(namedQuery));
+ this.removeNamedQuery(this.namedQueryContainer.indexOfContextElement((JavaNamedQuery) namedQuery));
}
public void removeNamedQuery(int index) {
- this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
- this.removeNamedQuery_(index);
- }
-
- protected void removeNamedQuery_(int index) {
- this.removeItemFromList(index, this.namedQueries, NAMED_QUERIES_LIST);
+ this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME);
+ this.namedQueryContainer.removeContextElement(index);
}
public void moveNamedQuery(int targetIndex, int sourceIndex) {
- this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedQueriesAnnotation.ANNOTATION_NAME);
- this.moveItemInList(targetIndex, sourceIndex, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- protected void initializeNamedQueries() {
- for (NamedQueryAnnotation annotation : this.getNamedQueryAnnotations()) {
- this.namedQueries.add(this.buildNamedQuery(annotation));
- }
+ this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedQueryAnnotation.ANNOTATION_NAME);
+ this.namedQueryContainer.moveContextElement(targetIndex, sourceIndex);
}
protected JavaNamedQuery buildNamedQuery(NamedQueryAnnotation namedQueryAnnotation) {
@@ -135,115 +108,85 @@ public class GenericJavaQueryContainer
}
protected void syncNamedQueries() {
- ContextContainerTools.synchronizeWithResourceModel(this.namedQueryContainerAdapter);
- }
-
- protected Iterable<NamedQueryAnnotation> getNamedQueryAnnotations() {
- return CollectionTools.iterable(this.namedQueryAnnotations());
+ this.namedQueryContainer.synchronizeWithResourceModel();
}
- protected Iterator<NamedQueryAnnotation> namedQueryAnnotations() {
- return new SuperIteratorWrapper<NamedQueryAnnotation>(this.nestableNamedQueryAnnotations());
+ protected void updateNamedQueries() {
+ this.namedQueryContainer.update();
}
- protected Iterator<NestableNamedQueryAnnotation> nestableNamedQueryAnnotations() {
- return new SubIteratorWrapper<NestableAnnotation, NestableNamedQueryAnnotation>(this.nestableNamedQueryAnnotations_());
+ protected ListIterable<NamedQueryAnnotation> getNamedQueryAnnotations() {
+ return new SubListIterableWrapper<NestableAnnotation, NamedQueryAnnotation>(this.getNestableNamedQueryAnnotations_());
}
- protected Iterator<NestableAnnotation> nestableNamedQueryAnnotations_() {
- return this.owner.getResourceAnnotatedElement().annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ protected ListIterable<NestableAnnotation> getNestableNamedQueryAnnotations_() {
+ return this.owner.getResourceAnnotatedElement().getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME);
}
- protected void moveNamedQuery_(int index, JavaNamedQuery namedQuery) {
- this.moveItemInList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- protected JavaNamedQuery addNamedQuery_(int index, NamedQueryAnnotation namedQueryAnnotation) {
- JavaNamedQuery query = this.buildNamedQuery(namedQueryAnnotation);
- this.addItemToList(index, query, this.namedQueries, NAMED_QUERIES_LIST);
- return query;
- }
-
- protected void removeNamedQuery_(JavaNamedQuery namedQuery) {
- this.removeNamedQuery_(this.namedQueries.indexOf(namedQuery));
+ protected ContextListContainer<JavaNamedQuery, NamedQueryAnnotation> buildNamedQueryContainer() {
+ return new NamedQueryContainer();
}
/**
- * named query container adapter
+ * named query container
*/
- protected class NamedQueryContainerAdapter
- implements ContextContainerTools.Adapter<JavaNamedQuery, NamedQueryAnnotation>
+ protected class NamedQueryContainer
+ extends ContextListContainer<JavaNamedQuery, NamedQueryAnnotation>
{
- public Iterable<JavaNamedQuery> getContextElements() {
- return GenericJavaQueryContainer.this.getNamedQueries();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return NAMED_QUERIES_LIST;
}
- public Iterable<NamedQueryAnnotation> getResourceElements() {
+ @Override
+ protected JavaNamedQuery buildContextElement(NamedQueryAnnotation resourceElement) {
+ return GenericJavaQueryContainer.this.buildNamedQuery(resourceElement);
+ }
+ @Override
+ protected ListIterable<NamedQueryAnnotation> getResourceElements() {
return GenericJavaQueryContainer.this.getNamedQueryAnnotations();
}
- public NamedQueryAnnotation getResourceElement(JavaNamedQuery contextElement) {
+ @Override
+ protected NamedQueryAnnotation getResourceElement(JavaNamedQuery contextElement) {
return contextElement.getQueryAnnotation();
}
- public void moveContextElement(int index, JavaNamedQuery element) {
- GenericJavaQueryContainer.this.moveNamedQuery_(index, element);
- }
- public void addContextElement(int index, NamedQueryAnnotation resourceElement) {
- GenericJavaQueryContainer.this.addNamedQuery_(index, resourceElement);
- }
- public void removeContextElement(JavaNamedQuery element) {
- GenericJavaQueryContainer.this.removeNamedQuery_(element);
- }
}
// ********** named native queries **********
- public ListIterator<JavaNamedNativeQuery> namedNativeQueries() {
- return this.getNamedNativeQueries().iterator();
+ public ListIterable<JavaNamedNativeQuery> getNamedNativeQueries() {
+ return this.namedNativeQueryContainer.getContextElements();
}
- protected ListIterable<JavaNamedNativeQuery> getNamedNativeQueries() {
- return new LiveCloneListIterable<JavaNamedNativeQuery>(this.namedNativeQueries);
- }
-
- public int namedNativeQueriesSize() {
- return this.namedNativeQueries.size();
+ public int getNamedNativeQueriesSize() {
+ return this.namedNativeQueryContainer.getContextElementsSize();
}
public JavaNamedNativeQuery addNamedNativeQuery() {
- return this.addNamedNativeQuery(this.namedNativeQueries.size());
+ return this.addNamedNativeQuery(this.getNamedNativeQueriesSize());
}
public JavaNamedNativeQuery addNamedNativeQuery(int index) {
- NamedNativeQueryAnnotation annotation = this.buildNamedNativeQueryAnnotation(index);
- return this.addNamedNativeQuery_(index, annotation);
+ NamedNativeQueryAnnotation annotation = this.addNamedNativeQueryAnnotation(index);
+ return this.namedNativeQueryContainer.addContextElement(index, annotation);
}
- protected NamedNativeQueryAnnotation buildNamedNativeQueryAnnotation(int index) {
- return (NamedNativeQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ protected NamedNativeQueryAnnotation addNamedNativeQueryAnnotation(int index) {
+ return (NamedNativeQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME);
}
public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery));
+ this.removeNamedNativeQuery(this.namedNativeQueryContainer.indexOfContextElement((JavaNamedNativeQuery) namedNativeQuery));
}
public void removeNamedNativeQuery(int index) {
- this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- this.removeNamedNativeQuery_(index);
- }
-
- protected void removeNamedNativeQuery_(int index) {
- this.removeItemFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME);
+ this.namedNativeQueryContainer.removeContextElement(index);
}
public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
- this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
- this.moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- protected void initializeNamedNativeQueries() {
- for (NamedNativeQueryAnnotation annotation : this.getNamedNativeQueryAnnotations()) {
- this.namedNativeQueries.add(this.buildNamedNativeQuery(annotation));
- }
+ this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedNativeQueryAnnotation.ANNOTATION_NAME);
+ this.namedNativeQueryContainer.moveContextElement(targetIndex, sourceIndex);
}
protected JavaNamedNativeQuery buildNamedNativeQuery(NamedNativeQueryAnnotation namedNativeQueryAnnotation) {
@@ -251,63 +194,47 @@ public class GenericJavaQueryContainer
}
protected void syncNamedNativeQueries() {
- ContextContainerTools.synchronizeWithResourceModel(this.namedNativeQueryContainerAdapter);
- }
-
- protected Iterable<NamedNativeQueryAnnotation> getNamedNativeQueryAnnotations() {
- return CollectionTools.iterable(this.namedNativeQueryAnnotations());
+ this.namedNativeQueryContainer.synchronizeWithResourceModel();
}
- protected Iterator<NamedNativeQueryAnnotation> namedNativeQueryAnnotations() {
- return new SuperIteratorWrapper<NamedNativeQueryAnnotation>(this.nestableNamedNativeQueryAnnotations());
+ protected void updateNamedNativeQueries() {
+ this.namedNativeQueryContainer.update();
}
- protected Iterator<NestableNamedNativeQueryAnnotation> nestableNamedNativeQueryAnnotations() {
- return new SubIteratorWrapper<NestableAnnotation, NestableNamedNativeQueryAnnotation>(this.nestableNamedNativeQueryAnnotations_());
+ protected ListIterable<NamedNativeQueryAnnotation> getNamedNativeQueryAnnotations() {
+ return new SubListIterableWrapper<NestableAnnotation, NamedNativeQueryAnnotation>(this.getNestableNamedNativeQueryAnnotations_());
}
- protected Iterator<NestableAnnotation> nestableNamedNativeQueryAnnotations_() {
- return this.owner.getResourceAnnotatedElement().annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ protected ListIterable<NestableAnnotation> getNestableNamedNativeQueryAnnotations_() {
+ return this.owner.getResourceAnnotatedElement().getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME);
}
- protected void moveNamedNativeQuery_(int index, JavaNamedNativeQuery namedNativeQuery) {
- this.moveItemInList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- protected JavaNamedNativeQuery addNamedNativeQuery_(int index, NamedNativeQueryAnnotation namedNativeQueryAnnotation) {
- JavaNamedNativeQuery query = this.buildNamedNativeQuery(namedNativeQueryAnnotation);
- this.addItemToList(index, query, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- return query;
- }
-
- protected void removeNamedNativeQuery_(JavaNamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery_(this.namedNativeQueries.indexOf(namedNativeQuery));
+ protected ContextListContainer<JavaNamedNativeQuery, NamedNativeQueryAnnotation> buildNamedNativeQueryContainer() {
+ return new NamedNativeQueryContainer();
}
/**
- * named native query container adapter
+ * named query container
*/
- protected class NamedNativeQueryContainerAdapter
- implements ContextContainerTools.Adapter<JavaNamedNativeQuery, NamedNativeQueryAnnotation>
+ protected class NamedNativeQueryContainer
+ extends ContextListContainer<JavaNamedNativeQuery, NamedNativeQueryAnnotation>
{
- public Iterable<JavaNamedNativeQuery> getContextElements() {
- return GenericJavaQueryContainer.this.getNamedNativeQueries();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return NAMED_NATIVE_QUERIES_LIST;
}
- public Iterable<NamedNativeQueryAnnotation> getResourceElements() {
+ @Override
+ protected JavaNamedNativeQuery buildContextElement(NamedNativeQueryAnnotation resourceElement) {
+ return GenericJavaQueryContainer.this.buildNamedNativeQuery(resourceElement);
+ }
+ @Override
+ protected ListIterable<NamedNativeQueryAnnotation> getResourceElements() {
return GenericJavaQueryContainer.this.getNamedNativeQueryAnnotations();
}
- public NamedNativeQueryAnnotation getResourceElement(JavaNamedNativeQuery contextElement) {
+ @Override
+ protected NamedNativeQueryAnnotation getResourceElement(JavaNamedNativeQuery contextElement) {
return contextElement.getQueryAnnotation();
}
- public void moveContextElement(int index, JavaNamedNativeQuery element) {
- GenericJavaQueryContainer.this.moveNamedNativeQuery_(index, element);
- }
- public void addContextElement(int index, NamedNativeQueryAnnotation resourceElement) {
- GenericJavaQueryContainer.this.addNamedNativeQuery_(index, resourceElement);
- }
- public void removeContextElement(JavaNamedNativeQuery element) {
- GenericJavaQueryContainer.this.removeNamedNativeQuery_(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
index 5c71d1f567..52d5280d24 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
@@ -11,14 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.jpa.core.context.JoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
@@ -27,7 +23,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaReferenceTable;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
@@ -43,8 +38,7 @@ public abstract class GenericJavaReferenceTable<A extends ReferenceTableAnnotati
extends AbstractJavaTable<A>
implements JavaReferenceTable
{
- protected final Vector<JavaJoinColumn> specifiedJoinColumns = new Vector<JavaJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
+ protected final SpecifiedJoinColumnContainer specifiedJoinColumnContainer;
protected final JavaReadOnlyJoinColumn.Owner joinColumnOwner;
protected JavaJoinColumn defaultJoinColumn;
@@ -53,7 +47,7 @@ public abstract class GenericJavaReferenceTable<A extends ReferenceTableAnnotati
protected GenericJavaReferenceTable(JavaJpaContextNode parent, Owner owner) {
super(parent, owner);
this.joinColumnOwner = this.buildJoinColumnOwner();
- this.initializeSpecifiedJoinColumns();
+ this.specifiedJoinColumnContainer = new SpecifiedJoinColumnContainer();
}
@@ -68,23 +62,19 @@ public abstract class GenericJavaReferenceTable<A extends ReferenceTableAnnotati
@Override
public void update() {
super.update();
- this.updateNodes(this.getSpecifiedJoinColumns());
+ this.updateSpecifiedJoinColumns();
this.updateDefaultJoinColumn();
}
// ********** join columns **********
- public ListIterator<JavaJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<JavaJoinColumn> getJoinColumns() {
+ public ListIterable<JavaJoinColumn> getJoinColumns() {
return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
}
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
}
public void convertDefaultJoinColumnToSpecified() {
@@ -94,106 +84,81 @@ public abstract class GenericJavaReferenceTable<A extends ReferenceTableAnnotati
// ********** specified join columns **********
- public ListIterator<JavaJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
- }
-
- protected ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<JavaJoinColumn>(this.specifiedJoinColumns);
+ public ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
+ return this.specifiedJoinColumnContainer.getContextElements();
}
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
+ public int getSpecifiedJoinColumnsSize() {
+ return this.specifiedJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
+ return this.getSpecifiedJoinColumnsSize() != 0;
}
public JavaJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
+ return this.specifiedJoinColumnContainer.getContextElement(index);
}
public JavaJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
+ return this.addSpecifiedJoinColumn(this.getSpecifiedJoinColumnsSize());
}
public JavaJoinColumn addSpecifiedJoinColumn(int index) {
JoinColumnAnnotation annotation = this.getTableAnnotation().addJoinColumn(index);
- return this.addSpecifiedJoinColumn_(index, annotation);
+ return this.specifiedJoinColumnContainer.addContextElement(index, annotation);
}
public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
+ this.removeSpecifiedJoinColumn(this.specifiedJoinColumnContainer.indexOfContextElement((JavaJoinColumn) joinColumn));
}
public void removeSpecifiedJoinColumn(int index) {
this.getTableAnnotation().removeJoinColumn(index);
this.removeTableAnnotationIfUnset();
- this.removeSpecifiedJoinColumn_(index);
- }
-
- protected void removeSpecifiedJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.removeContextElement(index);
}
public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
this.getTableAnnotation().moveJoinColumn(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected void initializeSpecifiedJoinColumns() {
- for (JoinColumnAnnotation joinColumnAnnotation : this.getJoinColumnAnnotations()) {
- this.specifiedJoinColumns.add(this.buildJoinColumn(joinColumnAnnotation));
- }
+ this.specifiedJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
}
protected void syncSpecifiedJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
- }
-
- protected Iterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
- return CollectionTools.iterable(this.getTableAnnotation().joinColumns());
+ this.specifiedJoinColumnContainer.synchronizeWithResourceModel();
}
- protected void moveSpecifiedJoinColumn_(int index, JavaJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ protected void updateSpecifiedJoinColumns() {
+ this.specifiedJoinColumnContainer.update();
}
- protected JavaJoinColumn addSpecifiedJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) {
- JavaJoinColumn joinColumn = this.buildJoinColumn(joinColumnAnnotation);
- this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return joinColumn;
+ protected ListIterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
+ return this.getTableAnnotation().getJoinColumns();
}
- protected void removeSpecifiedJoinColumn_(JavaJoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
- }
/**
- * specified join column container adapter
+ * join column container
*/
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaJoinColumn, JoinColumnAnnotation>
+ protected class SpecifiedJoinColumnContainer
+ extends ContextListContainer<JavaJoinColumn, JoinColumnAnnotation>
{
- public Iterable<JavaJoinColumn> getContextElements() {
- return GenericJavaReferenceTable.this.getSpecifiedJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_JOIN_COLUMNS_LIST;
}
- public Iterable<JoinColumnAnnotation> getResourceElements() {
+ @Override
+ protected JavaJoinColumn buildContextElement(JoinColumnAnnotation resourceElement) {
+ return GenericJavaReferenceTable.this.buildJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<JoinColumnAnnotation> getResourceElements() {
return GenericJavaReferenceTable.this.getJoinColumnAnnotations();
}
- public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
+ @Override
+ protected JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
return contextElement.getColumnAnnotation();
}
- public void moveContextElement(int index, JavaJoinColumn element) {
- GenericJavaReferenceTable.this.moveSpecifiedJoinColumn_(index, element);
- }
- public void addContextElement(int index, JoinColumnAnnotation resourceElement) {
- GenericJavaReferenceTable.this.addSpecifiedJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(JavaJoinColumn element) {
- GenericJavaReferenceTable.this.removeSpecifiedJoinColumn_(element);
- }
}
protected abstract JavaReadOnlyJoinColumn.Owner buildJoinColumnOwner();
@@ -242,14 +207,14 @@ public abstract class GenericJavaReferenceTable<A extends ReferenceTableAnnotati
protected void initializeFrom(ReadOnlyReferenceTable oldTable) {
super.initializeFrom(oldTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedJoinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : oldTable.getSpecifiedJoinColumns()) {
this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
}
}
protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) {
super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.joinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : virtualTable.getJoinColumns()) {
this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
index 169e87ecf3..a16f4f3067 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
@@ -11,15 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
@@ -30,7 +26,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyBaseJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
@@ -52,8 +47,7 @@ public class GenericJavaSecondaryTable
/** @see AbstractJavaTable#AbstractJavaTable(org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation) */
protected /* final */ SecondaryTableAnnotation tableAnnotation;
- protected final Vector<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<JavaPrimaryKeyJoinColumn>();
- protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected final JavaPrimaryKeyJoinColumnContainer specifiedPrimaryKeyJoinColumnContainer;
protected final JavaReadOnlyBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
@@ -62,7 +56,7 @@ public class GenericJavaSecondaryTable
public GenericJavaSecondaryTable(JavaEntity parent, Owner owner, SecondaryTableAnnotation tableAnnotation) {
super(parent, owner, tableAnnotation);
this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.initializeSpecifiedPrimaryKeyJoinColumns();
+ this.specifiedPrimaryKeyJoinColumnContainer = new JavaPrimaryKeyJoinColumnContainer();
}
@@ -77,7 +71,7 @@ public class GenericJavaSecondaryTable
@Override
public void update() {
super.update();
- this.updateNodes(this.getSpecifiedPrimaryKeyJoinColumns());
+ this.updateSpecifiedPrimaryKeyJoinColumns();
this.updateDefaultPrimaryKeyJoinColumn();
}
@@ -111,117 +105,88 @@ public class GenericJavaSecondaryTable
// ********** primary key join columns **********
- public ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumns().iterator();
- }
-
- protected ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ public ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
}
- public int primaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
+ public int getPrimaryKeyJoinColumnsSize() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
}
// ********** specified primary key join columns **********
- public ListIterator<JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
- }
public ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<JavaPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
}
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
+ public int getSpecifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
}
protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumns.size() != 0;
+ return this.getSpecifiedPrimaryKeyJoinColumnsSize() != 0;
}
public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
+ return this.addSpecifiedPrimaryKeyJoinColumn(this.getSpecifiedPrimaryKeyJoinColumnsSize());
}
public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
PrimaryKeyJoinColumnAnnotation annotation = this.tableAnnotation.addPkJoinColumn(index);
- return this.addSpecifiedPrimaryKeyJoinColumn_(index, annotation);
+ return this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(index, annotation);
}
public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
+ this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumnContainer.indexOfContextElement((JavaPrimaryKeyJoinColumn) joinColumn));
}
public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
this.tableAnnotation.removePkJoinColumn(index);
this.removeTableAnnotationIfUnset();
- this.removeSpecifiedPrimaryKeyJoinColumn_(index);
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(index);
}
public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
this.tableAnnotation.movePkJoinColumn(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected void initializeSpecifiedPrimaryKeyJoinColumns() {
- for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) {
- this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation));
- }
+ this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
}
protected void syncSpecifiedPrimaryKeyJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ this.specifiedPrimaryKeyJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
- return CollectionTools.iterable(this.tableAnnotation.pkJoinColumns());
+ protected void updateSpecifiedPrimaryKeyJoinColumns() {
+ this.specifiedPrimaryKeyJoinColumnContainer.update();
}
- protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
- protected JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) {
- JavaPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(pkJoinColumnAnnotation);
- this.addItemToList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
+ protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
+ return this.tableAnnotation.getPkJoinColumns();
}
/**
- * specified primary key join column container adapter
+ * specified primary key join column container
*/
- protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
+ protected class JavaPrimaryKeyJoinColumnContainer
+ extends ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
{
- public Iterable<JavaPrimaryKeyJoinColumn> getContextElements() {
- return GenericJavaSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
}
- public Iterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
+ @Override
+ protected JavaPrimaryKeyJoinColumn buildContextElement(PrimaryKeyJoinColumnAnnotation resourceElement) {
+ return GenericJavaSecondaryTable.this.buildPrimaryKeyJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
return GenericJavaSecondaryTable.this.getPrimaryKeyJoinColumnAnnotations();
}
- public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
+ @Override
+ protected PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
return contextElement.getColumnAnnotation();
}
- public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) {
- GenericJavaSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
- }
- public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) {
- GenericJavaSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(JavaPrimaryKeyJoinColumn element) {
- GenericJavaSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
- }
}
protected JavaReadOnlyBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
@@ -317,7 +282,7 @@ public class GenericJavaSecondaryTable
if (result != null) {
return result;
}
- for (JavaPrimaryKeyJoinColumn column : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
+ for (JavaPrimaryKeyJoinColumn column : this.getPrimaryKeyJoinColumns()) {
result = column.javaCompletionProposals(pos, filter, astRoot);
if (result != null) {
return result;
@@ -337,8 +302,8 @@ public class GenericJavaSecondaryTable
//some validation messages are not database specific. If the database validation for the
//table fails we will stop there and not validate the join columns at all
if (continueValidating) {
- for (Iterator<JavaPrimaryKeyJoinColumn> stream = this.primaryKeyJoinColumns(); stream.hasNext(); ) {
- stream.next().validate(messages, reporter, astRoot);
+ for (JavaPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
+ pkJoinColumn.validate(messages, reporter, astRoot);
}
}
}
@@ -373,8 +338,8 @@ public class GenericJavaSecondaryTable
return this.getTypeMapping().getPrimaryDbTable();
}
- public int joinColumnsSize() {
- return GenericJavaSecondaryTable.this.primaryKeyJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaSecondaryTable.this.getPrimaryKeyJoinColumnsSize();
}
public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
@@ -382,7 +347,7 @@ public class GenericJavaSecondaryTable
}
public String getDefaultColumnName() {
- if (this.joinColumnsSize() != 1) {
+ if (this.getJoinColumnsSize() != 1) {
return null;
}
return this.getEntity().getPrimaryKeyColumnName();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java
index 5b2a3ab0a7..a0990dd1b9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
/**
@@ -30,20 +30,20 @@ public class GenericJavaTable
@Override
public TableAnnotation getTableAnnotation() {
// TODO get the NullTableAnnotation from the resource model or build it here in the context model??
- return (TableAnnotation) this.getResourcePersistentType().getNonNullAnnotation(this.getAnnotationName());
+ return (TableAnnotation) this.getJavaResourceType().getNonNullAnnotation(this.getAnnotationName());
}
@Override
protected void removeTableAnnotation() {
- this.getResourcePersistentType().removeAnnotation(this.getAnnotationName());
+ this.getJavaResourceType().removeAnnotation(this.getAnnotationName());
}
protected String getAnnotationName() {
return TableAnnotation.ANNOTATION_NAME;
}
- protected JavaResourcePersistentType getResourcePersistentType() {
- return this.getEntity().getPersistentType().getResourcePersistentType();
+ protected JavaResourceType getJavaResourceType() {
+ return this.getEntity().getPersistentType().getJavaResourceType();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
index 2bd6e5a3ab..db4131d47c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
@@ -10,20 +10,17 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.Iterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaGenerator;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
@@ -57,8 +54,7 @@ public class GenericJavaTableGenerator
protected String specifiedPkColumnValue;
protected String defaultPkColumnValue;
- protected final Vector<JavaUniqueConstraint> uniqueConstraints = new Vector<JavaUniqueConstraint>();
- protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+ protected final UniqueConstraintContainer uniqueConstraintContainer;
// ********** constructor **********
@@ -71,7 +67,7 @@ public class GenericJavaTableGenerator
this.specifiedPkColumnName = generatorAnnotation.getPkColumnName();
this.specifiedValueColumnName = generatorAnnotation.getValueColumnName();
this.specifiedPkColumnValue = generatorAnnotation.getPkColumnValue();
- this.initializeUniqueConstraints();
+ this.uniqueConstraintContainer = new UniqueConstraintContainer();
}
@@ -334,98 +330,80 @@ public class GenericJavaTableGenerator
// ********** unique constraints **********
-
- public Iterable<JavaUniqueConstraint> getUniqueConstraints() {
- return new LiveCloneIterable<JavaUniqueConstraint>(this.uniqueConstraints);
+ public ListIterable<JavaUniqueConstraint> getUniqueConstraints() {
+ return this.uniqueConstraintContainer.getContextElements();
}
public int getUniqueConstraintsSize() {
- return this.uniqueConstraints.size();
+ return this.uniqueConstraintContainer.getContextElementsSize();
}
- public JavaUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.uniqueConstraints.size());
+ public JavaUniqueConstraint getUniqueConstraint(int index) {
+ return this.uniqueConstraintContainer.getContextElement(index);
}
- public JavaUniqueConstraint addUniqueConstraint(int index) {
- UniqueConstraintAnnotation constraintAnnotation = this.generatorAnnotation.addUniqueConstraint(index);
- return this.addUniqueConstraint_(index, constraintAnnotation);
+ public JavaUniqueConstraint addUniqueConstraint() {
+ return this.addUniqueConstraint(this.getUniqueConstraintsSize());
}
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
+ public JavaUniqueConstraint addUniqueConstraint(int index) {
+ UniqueConstraintAnnotation annotation = this.getGeneratorAnnotation().addUniqueConstraint(index);
+ return this.uniqueConstraintContainer.addContextElement(index, annotation);
}
public void removeUniqueConstraint(int index) {
- this.generatorAnnotation.removeUniqueConstraint(index);
- this.removeUniqueConstraint_(index);
+ this.getGeneratorAnnotation().removeUniqueConstraint(index);
+ this.uniqueConstraintContainer.removeContextElement(index);
}
- protected void removeUniqueConstraint_(int index) {
- this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ this.removeUniqueConstraint(this.uniqueConstraintContainer.indexOfContextElement((JavaUniqueConstraint) uniqueConstraint));
}
public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.generatorAnnotation.moveUniqueConstraint(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
- protected void initializeUniqueConstraints() {
- for (Iterator<UniqueConstraintAnnotation> stream = this.generatorAnnotation.uniqueConstraints(); stream.hasNext(); ) {
- this.uniqueConstraints.add(this.buildUniqueConstraint(stream.next()));
- }
- }
-
- protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) {
- return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation);
+ this.getGeneratorAnnotation().moveUniqueConstraint(targetIndex, sourceIndex);
+ this.uniqueConstraintContainer.moveContextElement(targetIndex, sourceIndex);
}
protected void syncUniqueConstraints() {
- ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
+ this.uniqueConstraintContainer.synchronizeWithResourceModel();
}
- protected Iterable<UniqueConstraintAnnotation> getUniqueConstraintAnnotations() {
- return CollectionTools.iterable(this.generatorAnnotation.uniqueConstraints());
+ protected void updateUniqueConstraints() {
+ this.uniqueConstraintContainer.synchronizeWithResourceModel();
}
- protected void moveUniqueConstraint_(int index, JavaUniqueConstraint uniqueConstraint) {
- this.moveItemInList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) {
+ return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation);
}
- protected JavaUniqueConstraint addUniqueConstraint_(int index, UniqueConstraintAnnotation constraintAnnotation) {
- JavaUniqueConstraint constraint = this.buildUniqueConstraint(constraintAnnotation);
- this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- return constraint;
+ protected ListIterable<UniqueConstraintAnnotation> getUniqueConstraintAnnotations() {
+ return this.getGeneratorAnnotation().getUniqueConstraints();
}
- protected void removeUniqueConstraint_(JavaUniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(uniqueConstraint));
- }
/**
- * unique constraint container adapter
+ * unique constraint container
*/
- protected class UniqueConstraintContainerAdapter
- implements ContextContainerTools.Adapter<JavaUniqueConstraint, UniqueConstraintAnnotation>
+ protected class UniqueConstraintContainer
+ extends ContextListContainer<JavaUniqueConstraint, UniqueConstraintAnnotation>
{
- public Iterable<JavaUniqueConstraint> getContextElements() {
- return GenericJavaTableGenerator.this.getUniqueConstraints();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return UNIQUE_CONSTRAINTS_LIST;
+ }
+ @Override
+ protected JavaUniqueConstraint buildContextElement(UniqueConstraintAnnotation resourceElement) {
+ return GenericJavaTableGenerator.this.buildUniqueConstraint(resourceElement);
}
- public Iterable<UniqueConstraintAnnotation> getResourceElements() {
+ @Override
+ protected ListIterable<UniqueConstraintAnnotation> getResourceElements() {
return GenericJavaTableGenerator.this.getUniqueConstraintAnnotations();
}
- public UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) {
+ @Override
+ protected UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) {
return contextElement.getUniqueConstraintAnnotation();
}
- public void moveContextElement(int index, JavaUniqueConstraint element) {
- GenericJavaTableGenerator.this.moveUniqueConstraint_(index, element);
- }
- public void addContextElement(int index, UniqueConstraintAnnotation resourceElement) {
- GenericJavaTableGenerator.this.addUniqueConstraint_(index, resourceElement);
- }
- public void removeContextElement(JavaUniqueConstraint element) {
- GenericJavaTableGenerator.this.removeUniqueConstraint_(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
index 5f86c553af..90e13c3b56 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
@@ -13,7 +13,6 @@ import java.util.Iterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
@@ -73,14 +72,14 @@ public class GenericJavaUniqueConstraint
}
protected void initializeColumnNames() {
- for (Iterator<String> stream = this.uniqueConstraintAnnotation.columnNames(); stream.hasNext(); ) {
- this.columnNames.add(stream.next());
+ for (String columnName : this.getResourceColumnNames()) {
+ this.columnNames.add(columnName);
}
}
@Override
protected Iterable<String> getResourceColumnNames() {
- return CollectionTools.iterable(this.uniqueConstraintAnnotation.columnNames());
+ return this.uniqueConstraintAnnotation.getColumnNames();
}
// ********** Java completion proposals **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
index f4b1cd9e31..e91f4040e3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
@@ -11,16 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
@@ -37,7 +33,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
@@ -49,8 +44,7 @@ public class GenericJavaVirtualOverrideJoinColumnRelationshipStrategy
extends AbstractJavaJpaContextNode
implements JavaVirtualJoinColumnRelationshipStrategy
{
- protected final Vector<JavaVirtualJoinColumn> specifiedJoinColumns = new Vector<JavaVirtualJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter;
+ protected final SpecifiedJoinColumnContainer specifiedJoinColumnContainer;
protected final JavaReadOnlyJoinColumn.Owner joinColumnOwner;
protected JavaVirtualJoinColumn defaultJoinColumn;
@@ -58,7 +52,7 @@ public class GenericJavaVirtualOverrideJoinColumnRelationshipStrategy
public GenericJavaVirtualOverrideJoinColumnRelationshipStrategy(JavaVirtualOverrideRelationship parent) {
super(parent);
- this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter();
+ this.specifiedJoinColumnContainer = new SpecifiedJoinColumnContainer();
this.joinColumnOwner = this.buildJoinColumnOwner();
}
@@ -75,94 +69,79 @@ public class GenericJavaVirtualOverrideJoinColumnRelationshipStrategy
// ********** join columns **********
- public ListIterator<JavaVirtualJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<JavaVirtualJoinColumn> getJoinColumns() {
+ public ListIterable<JavaVirtualJoinColumn> getJoinColumns() {
return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
}
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
}
// ********** specified join columns **********
- public ListIterator<JavaVirtualJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
- }
-
- protected ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<JavaVirtualJoinColumn>(this.specifiedJoinColumns);
+ public ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns() {
+ return this.specifiedJoinColumnContainer.getContextElements();
}
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
+ public int getSpecifiedJoinColumnsSize() {
+ return this.specifiedJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
+ return this.getSpecifiedJoinColumnsSize() != 0;
}
public JavaVirtualJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
+ return this.specifiedJoinColumnContainer.getContextElement(index);
}
protected void updateSpecifiedJoinColumns() {
- ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter);
+ this.specifiedJoinColumnContainer.update();
}
- protected Iterable<ReadOnlyJoinColumn> getOverriddenSpecifiedJoinColumns() {
+ protected ListIterable<ReadOnlyJoinColumn> getOverriddenSpecifiedJoinColumns() {
ReadOnlyJoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
return (overriddenStrategy == null) ?
- EmptyIterable.<ReadOnlyJoinColumn>instance() :
- CollectionTools.iterable(overriddenStrategy.specifiedJoinColumns());
+ EmptyListIterable.<ReadOnlyJoinColumn>instance() :
+ new SuperListIterableWrapper<ReadOnlyJoinColumn>(overriddenStrategy.getSpecifiedJoinColumns());
}
+
protected void moveSpecifiedJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.moveContextElement(index, joinColumn);
}
protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- JavaVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn);
- this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return virtualJoinColumn;
+ return this.specifiedJoinColumnContainer.addContextElement(index, joinColumn);
}
protected void removeSpecifiedJoinColumn(JavaVirtualJoinColumn joinColumn) {
- this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() {
- return new SpecifiedJoinColumnContainerAdapter();
+ this.specifiedJoinColumnContainer.removeContextElement(joinColumn);
}
/**
- * specified join column container adapter
+ * specified join column container
*/
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
+ protected class SpecifiedJoinColumnContainer
+ extends ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
{
- public Iterable<JavaVirtualJoinColumn> getContextElements() {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected JavaVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.buildJoinColumn(resourceElement);
}
- public Iterable<ReadOnlyJoinColumn> getResourceElements() {
+ @Override
+ protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getOverriddenSpecifiedJoinColumns();
}
- public ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
+ @Override
+ protected ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
return contextElement.getOverriddenColumn();
}
- public void moveContextElement(int index, JavaVirtualJoinColumn element) {
- GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn(index, element);
- }
- public void addContextElement(int index, ReadOnlyJoinColumn resourceElement) {
- GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn(index, resourceElement);
- }
- public void removeContextElement(JavaVirtualJoinColumn element) {
- GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn(element);
- }
}
protected JavaReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
@@ -395,8 +374,8 @@ public class GenericJavaVirtualOverrideJoinColumnRelationshipStrategy
return false;
}
- public int joinColumnsSize() {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
}
public TextRange getValidationTextRange(CompilationUnit astRoot) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java
index d962bed134..90d1ba4ff9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.context.Converter;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
public class NullJavaConverter
extends AbstractJavaJpaContextNode
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
index 9d58d77640..df7fd609dd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
-import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.JoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
@@ -41,22 +41,22 @@ public class NullJavaJoinColumnRelationshipStrategy
// ********** join columns **********
- public ListIterator<JavaJoinColumn> joinColumns() {
- return EmptyListIterator.<JavaJoinColumn>instance();
+ public ListIterable<JavaJoinColumn> getJoinColumns() {
+ return EmptyListIterable.<JavaJoinColumn>instance();
}
- public int joinColumnsSize() {
+ public int getJoinColumnsSize() {
return 0;
}
// ********** specified join columns **********
- public ListIterator<JavaJoinColumn> specifiedJoinColumns() {
- return EmptyListIterator.<JavaJoinColumn>instance();
+ public ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
+ return EmptyListIterable.<JavaJoinColumn>instance();
}
- public int specifiedJoinColumnsSize() {
+ public int getSpecifiedJoinColumnsSize() {
return 0;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
index d219d5f05a..af65063f3b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -89,16 +88,12 @@ public abstract class AbstractOrmOverrideContainer<
// ********** overrides **********
- public ListIterator<R> overrides() {
- return this.getOverrides().iterator();
- }
-
@SuppressWarnings("unchecked")
- protected ListIterable<R> getOverrides() {
+ public ListIterable<R> getOverrides() {
return new CompositeListIterable<R>(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides());
}
- public int overridesSize() {
+ public int getOverridesSize() {
return this.specifiedOverrides.size() + this.virtualOverrides.size();
}
@@ -183,11 +178,7 @@ public abstract class AbstractOrmOverrideContainer<
// ********** specified overrides **********
- public ListIterator<S> specifiedOverrides() {
- return this.getSpecifiedOverrides().iterator();
- }
-
- protected ListIterable<S> getSpecifiedOverrides() {
+ public ListIterable<S> getSpecifiedOverrides() {
return new LiveCloneListIterable<S>(this.specifiedOverrides);
}
@@ -198,7 +189,7 @@ public abstract class AbstractOrmOverrideContainer<
return (ListIterable<R>) this.getSpecifiedOverrides();
}
- public int specifiedOverridesSize() {
+ public int getSpecifiedOverridesSize() {
return this.specifiedOverrides.size();
}
@@ -311,11 +302,7 @@ public abstract class AbstractOrmOverrideContainer<
// ********** virtual overrides **********
- public ListIterator<V> virtualOverrides() {
- return this.getVirtualOverrides().iterator();
- }
-
- protected ListIterable<V> getVirtualOverrides() {
+ public ListIterable<V> getVirtualOverrides() {
return new LiveCloneListIterable<V>(this.virtualOverrides);
}
@@ -326,7 +313,7 @@ public abstract class AbstractOrmOverrideContainer<
return (ListIterable<R>) this.getVirtualOverrides();
}
- public int virtualOverridesSize() {
+ public int getVirtualOverridesSize() {
return this.virtualOverrides.size();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
index df648a19aa..6b56484f04 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
@@ -59,7 +58,7 @@ public class GenericOrmAttributeOverrideContainer
}
public void initializeFrom(OrmAttributeOverrideContainer oldContainer) {
- for (OrmAttributeOverride oldOverride : CollectionTools.iterable(oldContainer.specifiedOverrides())) {
+ for (OrmAttributeOverride oldOverride : oldContainer.getSpecifiedOverrides()) {
this.addSpecifiedOverride().initializeFrom(oldOverride);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
index ae4945043e..ea2deb17e8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
@@ -119,7 +119,7 @@ public class GenericOrmEmbeddedIdMapping
// attribute overrides are in error
// (in JPA 1.0, this will obviously never be reached)
if (this.derived
- && (this.attributeOverrideContainer.specifiedOverridesSize() > 0)) {
+ && (this.attributeOverrideContainer.getSpecifiedOverridesSize() > 0)) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
index 33c0c8fc93..b97f0016de 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.context.GenerationType;
@@ -165,8 +164,8 @@ public class GenericOrmGeneratedValue
return;
}
- for (Iterator<Generator> stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) {
- if (generator.equals(stream.next().getName())) {
+ for (Generator next : this.getPersistenceUnit().getGenerators()) {
+ if (generator.equals(next.getName())) {
return;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
index 93a466dc13..454384b2d8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
@@ -11,15 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
@@ -37,7 +32,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
@@ -54,8 +48,7 @@ public class GenericOrmJoinTable
extends GenericOrmReferenceTable<XmlJoinTable>
implements OrmJoinTable
{
- protected final Vector<OrmJoinColumn> specifiedInverseJoinColumns = new Vector<OrmJoinColumn>();
- protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter();
+ protected final ContextListContainer<OrmJoinColumn, XmlJoinColumn> specifiedInverseJoinColumnContainer;
protected final OrmReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
protected OrmJoinColumn defaultInverseJoinColumn;
@@ -64,7 +57,7 @@ public class GenericOrmJoinTable
public GenericOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Owner owner) {
super(parent, owner);
this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- this.initializeSpecifiedInverseJoinColumns();
+ this.specifiedInverseJoinColumnContainer = this.buildSpecifiedInverseJoinColumnContainer();
}
@Override
@@ -112,16 +105,12 @@ public class GenericOrmJoinTable
// ********** inverse join columns **********
- public ListIterator<OrmJoinColumn> inverseJoinColumns() {
- return this.getInverseJoinColumns().iterator();
- }
-
- protected ListIterable<OrmJoinColumn> getInverseJoinColumns() {
+ public ListIterable<OrmJoinColumn> getInverseJoinColumns() {
return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
}
- public int inverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
+ public int getInverseJoinColumnsSize() {
+ return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
}
public void convertDefaultInverseJoinColumnToSpecified() {
@@ -131,118 +120,92 @@ public class GenericOrmJoinTable
// ********** specified inverse join columns **********
- public ListIterator<OrmJoinColumn> specifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumns().iterator();
- }
-
public ListIterable<OrmJoinColumn> getSpecifiedInverseJoinColumns() {
- return new LiveCloneListIterable<OrmJoinColumn>(this.specifiedInverseJoinColumns);
+ return this.specifiedInverseJoinColumnContainer.getContextElements();
}
- public int specifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumns.size();
+ public int getSpecifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumns.size() != 0;
+ return this.getSpecifiedInverseJoinColumnsSize() != 0;
}
public OrmJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumns.get(index);
+ return this.specifiedInverseJoinColumnContainer.getContextElement(index);
}
public OrmJoinColumn addSpecifiedInverseJoinColumn() {
- return this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size());
+ return this.addSpecifiedInverseJoinColumn(this.getSpecifiedInverseJoinColumnsSize());
}
public OrmJoinColumn addSpecifiedInverseJoinColumn(int index) {
XmlJoinTable xmlTable = this.getXmlTableForUpdate();
XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
- OrmJoinColumn joinColumn = this.addSpecifiedInverseJoinColumn_(index, xmlJoinColumn);
+ OrmJoinColumn joinColumn = this.specifiedInverseJoinColumnContainer.addContextElement(index, xmlJoinColumn);
xmlTable.getInverseJoinColumns().add(index, xmlJoinColumn);
return joinColumn;
}
public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(joinColumn));
+ this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumnContainer.indexOfContextElement((OrmJoinColumn) joinColumn));
}
public void removeSpecifiedInverseJoinColumn(int index) {
- this.removeSpecifiedInverseJoinColumn_(index);
+ this.specifiedInverseJoinColumnContainer.removeContextElement(index);
this.getXmlTable().getInverseJoinColumns().remove(index);
this.removeXmlTableIfUnset();
}
- protected void removeSpecifiedInverseJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- }
-
public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.specifiedInverseJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
this.getXmlTable().getInverseJoinColumns().move(targetIndex, sourceIndex);
}
public void clearSpecifiedInverseJoinColumns() {
- this.clearCollection(this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ this.specifiedInverseJoinColumnContainer.clearContextList();
this.getXmlTable().getInverseJoinColumns().clear();
}
- protected void initializeSpecifiedInverseJoinColumns() {
- for (XmlJoinColumn xmlJoinColumn : this.getXmlInverseJoinColumns()) {
- this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(xmlJoinColumn));
- }
- }
-
protected void syncSpecifiedInverseJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedInverseJoinColumnContainerAdapter);
+ this.specifiedInverseJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlJoinColumn> getXmlInverseJoinColumns() {
+ protected ListIterable<XmlJoinColumn> getXmlInverseJoinColumns() {
XmlJoinTable xmlTable = this.getXmlTable();
return (xmlTable == null) ?
- EmptyIterable.<XmlJoinColumn>instance() :
+ EmptyListIterable.<XmlJoinColumn>instance() :
// clone to reduce chance of concurrency problems
- new LiveCloneIterable<XmlJoinColumn>(xmlTable.getInverseJoinColumns());
- }
-
- protected void moveSpecifiedInverseJoinColumn_(int index, OrmJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ new LiveCloneListIterable<XmlJoinColumn>(xmlTable.getInverseJoinColumns());
}
- protected OrmJoinColumn addSpecifiedInverseJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) {
- OrmJoinColumn joinColumn = this.buildInverseJoinColumn(xmlJoinColumn);
- this.addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedInverseJoinColumn_(OrmJoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn_(this.specifiedInverseJoinColumns.indexOf(joinColumn));
+ protected ContextListContainer<OrmJoinColumn, XmlJoinColumn> buildSpecifiedInverseJoinColumnContainer() {
+ return new SpecifiedInverseJoinColumnContainer();
}
/**
- * specified inverse join column container adapter
+ * specified inverse join column container
*/
- protected class SpecifiedInverseJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmJoinColumn, XmlJoinColumn>
+ protected class SpecifiedInverseJoinColumnContainer
+ extends ContextListContainer<OrmJoinColumn, XmlJoinColumn>
{
- public Iterable<OrmJoinColumn> getContextElements() {
- return GenericOrmJoinTable.this.getSpecifiedInverseJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_INVERSE_JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected OrmJoinColumn buildContextElement(XmlJoinColumn resourceElement) {
+ return GenericOrmJoinTable.this.buildInverseJoinColumn(resourceElement);
}
- public Iterable<XmlJoinColumn> getResourceElements() {
+ @Override
+ protected ListIterable<XmlJoinColumn> getResourceElements() {
return GenericOrmJoinTable.this.getXmlInverseJoinColumns();
}
- public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
+ @Override
+ protected XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
return contextElement.getXmlColumn();
}
- public void moveContextElement(int index, OrmJoinColumn element) {
- GenericOrmJoinTable.this.moveSpecifiedInverseJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlJoinColumn resourceElement) {
- GenericOrmJoinTable.this.addSpecifiedInverseJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmJoinColumn element) {
- GenericOrmJoinTable.this.removeSpecifiedInverseJoinColumn_(element);
- }
}
protected OrmReadOnlyJoinColumn.Owner buildInverseJoinColumnOwner() {
@@ -307,14 +270,14 @@ public class GenericOrmJoinTable
public void initializeFrom(ReadOnlyJoinTable oldTable) {
super.initializeFrom(oldTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedInverseJoinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : oldTable.getSpecifiedInverseJoinColumns()) {
this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn);
}
}
public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) {
super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.inverseJoinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : virtualTable.getInverseJoinColumns()) {
this.addSpecifiedInverseJoinColumn().initializeFromVirtual(joinColumn);
}
}
@@ -444,8 +407,8 @@ public class GenericOrmJoinTable
return GenericOrmJoinTable.this.defaultJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericOrmJoinTable.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmJoinTable.this.getJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
@@ -494,8 +457,8 @@ public class GenericOrmJoinTable
return GenericOrmJoinTable.this.defaultInverseJoinColumn == joinColumn;
}
- public int joinColumnsSize() {
- return GenericOrmJoinTable.this.inverseJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmJoinTable.this.getInverseJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
index 6238761ba9..83ce2991a7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -14,7 +14,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
@@ -58,6 +57,6 @@ public class GenericOrmPersistentAttribute
@Override
protected JptValidator buildAttibuteValidator() {
- return new GenericPersistentAttributeValidator(this, getJavaPersistentAttribute(), buildTextRangeResolver());
+ return this.getJavaPersistentAttribute().getAccessor().buildAttributeValidator(this, buildTextRangeResolver());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
index 97956a279d..8dffda9e17 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
@@ -11,16 +11,22 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
import java.util.Collection;
import java.util.Comparator;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.BodySourceWriter;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.ClassName;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -29,14 +35,13 @@ import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
@@ -53,14 +58,14 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentType2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
@@ -95,7 +100,6 @@ public class GenericOrmPersistentType
protected final SpecifiedAttributeContainerAdapter specifiedAttributeContainerAdapter = new SpecifiedAttributeContainerAdapter();
protected final Vector<OrmReadOnlyPersistentAttribute> virtualAttributes = new Vector<OrmReadOnlyPersistentAttribute>();
- protected final VirtualAttributeContainerAdapter virtualAttributeContainerAdapter = new VirtualAttributeContainerAdapter();
protected PersistentType superPersistentType;
@@ -247,7 +251,7 @@ public class GenericOrmPersistentType
* @see #syncJavaPersistentType()
*/
protected void updateJavaPersistentType() {
- JavaResourcePersistentType resourceType = this.resolveJavaResourcePersistentType();
+ JavaResourceAbstractType resourceType = this.resolveJavaResourceType();
if (resourceType == null) {
if (this.javaPersistentType != null) {
this.javaPersistentType.dispose();
@@ -257,7 +261,7 @@ public class GenericOrmPersistentType
if (this.javaPersistentType == null) {
this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
} else {
- if (this.javaPersistentType.getResourcePersistentType() == resourceType) {
+ if (this.javaPersistentType.getJavaResourceType() == resourceType) {
this.javaPersistentType.update();
} else {
this.javaPersistentType.dispose();
@@ -268,17 +272,24 @@ public class GenericOrmPersistentType
}
/**
- * Don't use getName() to resolve the java resource persistent type.
+ * Don't use getName() to resolve the java resource type.
* getName() uses the JavaPersistentType for determining the name.
* Changed this to fix bug 339560
* @see #updateJavaPersistentType()
*/
- protected JavaResourcePersistentType resolveJavaResourcePersistentType() {
- return this.getEntityMappings().resolveJavaResourcePersistentType(
+ protected JavaResourceAbstractType resolveJavaResourceType() {
+ return this.getEntityMappings().resolveJavaResourceType(
this.convertMappingClassName(this.mapping.getClass_()));
}
- protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
+ /**
+ * Return null it's an enum; don't build a JavaPersistentType
+ */
+ protected JavaPersistentType buildJavaPersistentType(JavaResourceAbstractType jrat) {
+ return jrat.getKind() == Kind.TYPE ? this.buildJavaPersistentType((JavaResourceType) jrat) : null;
+ }
+
+ protected JavaPersistentType buildJavaPersistentType(JavaResourceType jrpt) {
return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
}
@@ -352,21 +363,13 @@ public class GenericOrmPersistentType
// ********** attributes **********
- public ListIterator<OrmReadOnlyPersistentAttribute> attributes() {
- return this.getAttributes().iterator();
- }
-
@SuppressWarnings("unchecked")
public ListIterable<OrmReadOnlyPersistentAttribute> getAttributes() {
return new CompositeListIterable<OrmReadOnlyPersistentAttribute>(this.getReadOnlySpecifiedAttributes(), this.getVirtualAttributes());
}
- public int attributesSize() {
- return this.specifiedAttributesSize() + this.virtualAttributesSize();
- }
-
- public Iterator<String> attributeNames() {
- return this.getAttributeNames().iterator();
+ public int getAttributesSize() {
+ return this.getSpecifiedAttributesSize() + this.getVirtualAttributesSize();
}
public Iterable<String> getAttributeNames() {
@@ -378,25 +381,17 @@ public class GenericOrmPersistentType
return stream.hasNext() ? stream.next() : null;
}
- public Iterator<ReadOnlyPersistentAttribute> allAttributes() {
- return this.getAllAttributes().iterator();
- }
-
public Iterable<ReadOnlyPersistentAttribute> getAllAttributes() {
return new CompositeIterable<ReadOnlyPersistentAttribute>(
new TransformationIterable<PersistentType, Iterable<ReadOnlyPersistentAttribute>>(this.getInheritanceHierarchy()) {
@Override
protected Iterable<ReadOnlyPersistentAttribute> transform(PersistentType pt) {
- return new SnapshotCloneIterable<ReadOnlyPersistentAttribute>(pt.attributes());
+ return new SuperListIterableWrapper<ReadOnlyPersistentAttribute>(pt.getAttributes());
}
}
);
}
- public Iterator<String> allAttributeNames() {
- return this.getAllAttributeNames().iterator();
- }
-
public Iterable<String> getAllAttributeNames() {
return this.convertToNames(this.getAllAttributes());
}
@@ -549,10 +544,24 @@ public class GenericOrmPersistentType
// attribute we are converting since it may have come from a superclass;
// instead, use its resource Java attribute (which will match both name and access type,
// but we still need to check its parent type)
- JavaResourcePersistentAttribute javaResourceAttribute = specifiedAttribute.getJavaResourcePersistentAttribute();
- if ((javaResourceAttribute != null) && this.javaResourceAttributeWillBeVirtual(javaResourceAttribute, specifiedAttribute)) {
- virtualAttribute = this.buildVirtualAttribute(javaResourceAttribute);
- this.virtualAttributes.add(virtualIndex, virtualAttribute);
+ if (specifiedAttribute.getJavaResourceAttribute() != null) {
+ if (specifiedAttribute.getJavaResourceAttribute().getKind() == Kind.FIELD) {
+ JavaResourceField javaResourceField = (JavaResourceField) specifiedAttribute.getJavaResourceAttribute();
+ if (this.javaResourceFieldWillBeVirtual(javaResourceField, specifiedAttribute)) {
+ virtualAttribute = this.buildVirtualAttribute(javaResourceField);
+ this.virtualAttributes.add(virtualIndex, virtualAttribute);
+ }
+ }
+ else {
+ PropertyAccessor propertyAccessor = (PropertyAccessor) specifiedAttribute.getJavaPersistentAttribute().getAccessor();
+ JavaResourceMethod resourceGetter = propertyAccessor.getResourceGetter();
+ JavaResourceMethod resourceSetter = propertyAccessor.getResourceSetter();
+
+ if (this.javaResourcePropertyWillBeVirtual(resourceGetter, resourceSetter, specifiedAttribute)) {
+ virtualAttribute = this.buildVirtualAttribute(resourceGetter, resourceSetter);
+ this.virtualAttributes.add(virtualIndex, virtualAttribute);
+ }
+ }
}
this.removeSpecifiedAttribute(specifiedAttribute); // trigger update
@@ -570,9 +579,22 @@ public class GenericOrmPersistentType
* valid Java resource attributes and it must not correspond to any of the
* remaining specified attributes.
*/
- protected boolean javaResourceAttributeWillBeVirtual(JavaResourcePersistentAttribute javaResourceAttribute, OrmPersistentAttribute specifiedAttributeToBeRemoved) {
- return CollectionTools.contains(this.getJavaResourceAttributes(), javaResourceAttribute) &&
- (this.getSpecifiedAttributeFor(javaResourceAttribute, specifiedAttributeToBeRemoved) == null);
+ protected boolean javaResourceFieldWillBeVirtual(JavaResourceField javaResourceField, OrmPersistentAttribute specifiedAttributeToBeRemoved) {
+ return CollectionTools.contains(this.getJavaResourceFields(), javaResourceField) &&
+ (this.getSpecifiedAttributeFor(javaResourceField, specifiedAttributeToBeRemoved) == null);
+ }
+
+ /**
+ * Return whether the specified Java resource attribute will be a
+ * <em>virtual</em> attribute when the specified specified attribute is
+ * removed from the type. The Java resource attribute must be among the
+ * valid Java resource attributes and it must not correspond to any of the
+ * remaining specified attributes.
+ */
+ protected boolean javaResourcePropertyWillBeVirtual(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter, OrmPersistentAttribute specifiedAttributeToBeRemoved) {
+ return CollectionTools.contains(this.getJavaResourceMethods(), javaResourceGetter) &&
+ CollectionTools.contains(this.getJavaResourceMethods(), javaResourceSetter) &&
+ (this.getSpecifiedAttributeFor(javaResourceGetter, javaResourceSetter, specifiedAttributeToBeRemoved) == null);
}
@@ -608,11 +630,7 @@ public class GenericOrmPersistentType
// ********** specified attributes **********
- public ListIterator<OrmPersistentAttribute> specifiedAttributes() {
- return this.getSpecifiedAttributes().iterator();
- }
-
- protected ListIterable<OrmPersistentAttribute> getSpecifiedAttributes() {
+ public ListIterable<OrmPersistentAttribute> getSpecifiedAttributes() {
return new LiveCloneListIterable<OrmPersistentAttribute>(this.specifiedAttributes);
}
@@ -620,7 +638,7 @@ public class GenericOrmPersistentType
return new SuperListIterableWrapper<OrmReadOnlyPersistentAttribute>(this.getSpecifiedAttributes());
}
- public int specifiedAttributesSize() {
+ public int getSpecifiedAttributesSize() {
return this.specifiedAttributes.size();
}
@@ -706,52 +724,216 @@ public class GenericOrmPersistentType
// ********** virtual attributes **********
- public ListIterator<OrmReadOnlyPersistentAttribute> virtualAttributes() {
- return this.getVirtualAttributes().iterator();
- }
-
public ListIterable<OrmReadOnlyPersistentAttribute> getVirtualAttributes() {
return new LiveCloneListIterable<OrmReadOnlyPersistentAttribute>(this.virtualAttributes);
}
- public int virtualAttributesSize() {
+ public int getVirtualAttributesSize() {
return this.virtualAttributes.size();
}
+ /**
+ * The attributes are synchronized during the <em>update</em> because
+ * the list of resource attributes is determined by the access type
+ * which can be controlled in a number of different places....
+ */
protected void updateVirtualAttributes() {
- ContextContainerTools.update(this.virtualAttributeContainerAdapter);
+ if (getVirtualJavaAccess() == AccessType.FIELD) {
+ this.syncFieldAccessVirtualAttributes();
+ }
+ else if (getVirtualJavaAccess() == AccessType.PROPERTY) {
+ this.syncPropertyAccessVirtualAttributes();
+ }
+ }
+
+ /**
+ * Initialize the attributes for AccessType.FIELD
+ * 1. all non-transient, non-static fields
+ * 2. all annotated methods(getters/setters)
+ */
+ private void syncFieldAccessVirtualAttributes() {
+ HashSet<OrmReadOnlyPersistentAttribute> contextAttributes = CollectionTools.set(this.getVirtualAttributes());
+
+ this.syncFieldVirtualAttributes(contextAttributes, buildNonTransientNonStaticResourceFieldsFilter());
+ if (!getMapping().isMetadataComplete()) {
+ this.syncAnnotatedPropertyVirtualAttributes(contextAttributes);
+ }
+
+ // remove any leftover context attributes
+ for (OrmReadOnlyPersistentAttribute contextAttribute : contextAttributes) {
+ this.removeVirtualAttribute(contextAttribute);
+ }
+ }
+
+ /**
+ * Initialize the attributes for XmlAccessType.PROPERTY
+ * 1. all getter/setter javabeans pairs
+ * 2. all annotated fields
+ * 3. all annotated methods getters/setters that don't have a matching pair
+ */
+ private void syncPropertyAccessVirtualAttributes() {
+ HashSet<OrmReadOnlyPersistentAttribute> contextAttributes = CollectionTools.set(this.getVirtualAttributes());
+
+ if (!getMapping().isMetadataComplete()) {
+ this.syncFieldVirtualAttributes(contextAttributes, AbstractJavaPersistentType.ANNOTATED_RESOURCE_FIELDS_FILTER);
+ }
+
+ Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getJavaResourceMethods());
+ //iterate through all resource methods searching for persistable getters
+ for (JavaResourceMethod getterMethod : this.getJavaResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) {
+ JavaResourceMethod setterMethod = AbstractJavaPersistentType.getValidSiblingSetMethod(getterMethod, resourceMethods);
+ if (javaResourcePropertyIsVirtual(getterMethod, setterMethod)) {
+ if (AbstractJavaPersistentType.methodsArePersistableProperties(getterMethod, setterMethod)) {
+ boolean match = false;
+ for (Iterator<OrmReadOnlyPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
+ OrmReadOnlyPersistentAttribute contextAttribute = stream.next();
+ if (contextAttribute.isFor(getterMethod, setterMethod)) {
+ match = true;
+ contextAttribute.update();
+ stream.remove();
+ break;
+ }
+ }
+ if (!match) {
+ this.addVirtualAttribute(getVirtualAttributesSize(), this.buildVirtualAttribute(getterMethod, setterMethod));
+ }
+ }
+ }
+ resourceMethods.remove(getterMethod);
+ resourceMethods.remove(setterMethod);
+ }
+ this.syncRemainingResourceVirtualMethods(contextAttributes, resourceMethods);
+
+ // remove any leftover context attributes
+ for (OrmReadOnlyPersistentAttribute contextAttribute : contextAttributes) {
+ this.removeVirtualAttribute(contextAttribute);
+ }
+ }
+
+ private void syncAnnotatedPropertyVirtualAttributes(HashSet<OrmReadOnlyPersistentAttribute> contextAttributes) {
+ Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getJavaResourceMethods());
+ //iterate through all resource methods searching for persistable getters
+ for (JavaResourceMethod getterMethod : this.getJavaResourceMethods(buildPersistablePropertyGetterMethodsFilter())) {
+ JavaResourceMethod setterMethod = AbstractJavaPersistentType.getValidSiblingSetMethod(getterMethod, resourceMethods);
+ if (javaResourcePropertyIsVirtual(getterMethod, setterMethod)) {
+ if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) {
+ boolean match = false;
+ for (Iterator<OrmReadOnlyPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
+ OrmReadOnlyPersistentAttribute contextAttribute = stream.next();
+ if (contextAttribute.isFor(getterMethod, setterMethod)) {
+ match = true;
+ contextAttribute.update();
+ stream.remove();
+ break;
+ }
+ }
+ if (!match) {
+ this.addVirtualAttribute(getVirtualAttributesSize(), this.buildVirtualAttribute(getterMethod, setterMethod));
+ }
+ }
+ }
+ resourceMethods.remove(getterMethod);
+ resourceMethods.remove(setterMethod);
+ }
+ this.syncRemainingResourceVirtualMethods(contextAttributes, resourceMethods);
+ }
+
+ private void syncFieldVirtualAttributes(HashSet<OrmReadOnlyPersistentAttribute> contextAttributes, Filter<JavaResourceField> filter) {
+ for (JavaResourceField resourceField : this.getVirtualJavaResourceFields(filter)) {
+ boolean match = false;
+ for (Iterator<OrmReadOnlyPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext(); ) {
+ OrmReadOnlyPersistentAttribute contextAttribute = stream.next();
+ if (contextAttribute.isFor(resourceField)) {
+ match = true;
+ contextAttribute.update();
+ stream.remove();
+ break;
+ }
+ }
+ if (!match) {
+ // added elements are sync'ed during construction or will be
+ // updated during the next "update" (which is triggered by
+ // their addition to the model)
+ this.addVirtualAttribute(this.getVirtualAttributesSize(), this.buildVirtualAttribute(resourceField));
+ }
+ }
+ }
+
+ private void syncRemainingResourceVirtualMethods(HashSet<OrmReadOnlyPersistentAttribute> contextAttributes, Collection<JavaResourceMethod> resourceMethods) {
+ //iterate through remaining resource methods and search for those that are annotated.
+ //all getter methods will already be used.
+ for (JavaResourceMethod resourceMethod : resourceMethods) {
+ if (resourceMethod.isAnnotated()) {
+ boolean match = false;
+ //annotated setter(or other random method) with no corresponding getter, bring into context model for validation purposes
+ for (Iterator<OrmReadOnlyPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
+ OrmReadOnlyPersistentAttribute contextAttribute = stream.next();
+ if (contextAttribute.isFor(null, resourceMethod)) {
+ match = true;
+ contextAttribute.update();
+ stream.remove();
+ break;
+ }
+ }
+ if (!match) {
+ this.addVirtualAttribute(getVirtualAttributesSize(), this.buildVirtualAttribute(null, resourceMethod));
+ }
+ }
+ }
}
/**
- * Return all the Java resource attributes that have the appropriate access
- * and do not have a corresponding <code>orm.xml</code> mapping currently
+ * Return all the Java resource fields that do not have a
+ * corresponding <code>orm.xml</code> mapping currently
* specified in the <code>orm.xml</code> persistent type.
*/
- protected Iterable<JavaResourcePersistentAttribute> getVirtualJavaResourceAttributes() {
- return new FilteringIterable<JavaResourcePersistentAttribute>(this.getJavaResourceAttributes()) {
+ protected Iterable<JavaResourceField> getVirtualJavaResourceFields() {
+ return new FilteringIterable<JavaResourceField>(this.getJavaResourceFields()) {
@Override
- protected boolean accept(JavaResourcePersistentAttribute javaResourceAttribute) {
- return GenericOrmPersistentType.this.javaResourceAttributeIsVirtual(javaResourceAttribute);
+ protected boolean accept(JavaResourceField javaResourceField) {
+ return GenericOrmPersistentType.this.javaResourceFieldIsVirtual(javaResourceField);
}
};
}
- protected Iterable<JavaResourcePersistentAttribute> getJavaResourceAttributes() {
- return CollectionTools.iterable(this.javaResourceAttributes());
+ protected Iterable<JavaResourceField> getJavaResourceFields() {
+ JavaResourceType javaResourceType = this.getJavaResourceType();
+ if (javaResourceType == null) {
+ return EmptyListIterable.instance();
+ }
+ return javaResourceType.getFields();
}
- /**
- * Return the Java resource attributes with the appropriate access type.
- */
- protected Iterator<JavaResourcePersistentAttribute> javaResourceAttributes() {
- JavaResourcePersistentType javaResourceType = this.getJavaResourceType();
- return (javaResourceType != null) ?
- javaResourceType.persistableAttributes(this.getVirtualJavaAccess().getJavaAccessType()) :
- EmptyListIterator.<JavaResourcePersistentAttribute>instance();
+ protected Iterable<JavaResourceField> getVirtualJavaResourceFields(Filter<JavaResourceField> filter) {
+ return new FilteringIterable<JavaResourceField>(getVirtualJavaResourceFields(), filter);
+ }
+
+ protected Iterable<JavaResourceMethod> getJavaResourceMethods(Filter<JavaResourceMethod> filter) {
+ return new FilteringIterable<JavaResourceMethod>(getJavaResourceMethods(), filter);
+ }
+
+ protected Iterable<JavaResourceMethod> getJavaResourceMethods() {
+ JavaResourceType javaResourceType = this.getJavaResourceType();
+ if (javaResourceType == null) {
+ return EmptyListIterable.instance();
+ }
+ return javaResourceType.getMethods();
}
- protected JavaResourcePersistentType getJavaResourceType() {
- return (this.javaPersistentType == null) ? null : this.javaPersistentType.getResourcePersistentType();
+ public static Filter<JavaResourceField> buildNonTransientNonStaticResourceFieldsFilter() {
+ return AbstractJavaPersistentType.buildNonTransientNonStaticResourceFieldsFilter();
+ }
+
+ protected Filter<JavaResourceMethod> buildPersistablePropertyGetterMethodsFilter() {
+ return new Filter<JavaResourceMethod>() {
+ public boolean accept(JavaResourceMethod resourceMethod) {
+ return AbstractJavaPersistentType.methodIsPersistablePropertyGetter(resourceMethod, getJavaResourceMethods());
+ }
+ };
+ }
+
+ protected JavaResourceType getJavaResourceType() {
+ return (this.javaPersistentType == null) ? null : this.javaPersistentType.getJavaResourceType();
}
/**
@@ -765,30 +947,56 @@ public class GenericOrmPersistentType
if (this.mapping.isMetadataComplete()) {
return this.defaultAccess;
}
- AccessType javaAccess = this.javaPersistentType.getSpecifiedAccess();
+ AccessType javaAccess = this.javaPersistentType == null ? null : this.javaPersistentType.getSpecifiedAccess();
return (javaAccess != null) ? javaAccess : this.defaultAccess;
}
- protected boolean javaResourceAttributeIsVirtual(JavaResourcePersistentAttribute javaResourceAttribute) {
- return this.getSpecifiedAttributeFor(javaResourceAttribute) == null;
+ protected boolean javaResourceFieldIsVirtual(JavaResourceField javaResourceField) {
+ return this.getSpecifiedAttributeFor(javaResourceField) == null;
}
- protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute) {
- return this.getSpecifiedAttributeFor(javaResourceAttribute, null);
+ protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourceField javaResourceField) {
+ return this.getSpecifiedAttributeFor(javaResourceField, null);
}
/**
* Return the specified attribute corresponding to the specified Java
- * resource attribute, ignoring the specified excluded attribute (since
+ * resource field, ignoring the specified excluded attribute (since
* there can be more than one specified attribute per Java resource
* attribute; albeit erroneously).
*/
- protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute, OrmPersistentAttribute exclude) {
+ protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourceField javaResourceField, OrmPersistentAttribute exclude) {
for (OrmPersistentAttribute ormAttribute : this.getSpecifiedAttributes()) {
if (ormAttribute == exclude) {
continue; // skip
}
- if (ormAttribute.getJavaResourcePersistentAttribute() == javaResourceAttribute) {
+ if (ormAttribute.isFor(javaResourceField)) {
+ return ormAttribute;
+ }
+ }
+ return null;
+ }
+
+ protected boolean javaResourcePropertyIsVirtual(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
+ return this.getSpecifiedAttributeFor(javaResourceGetter, javaResourceSetter) == null;
+ }
+
+ protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
+ return this.getSpecifiedAttributeFor(javaResourceGetter, javaResourceSetter, null);
+ }
+
+ /**
+ * Return the specified attribute corresponding to the specified Java
+ * resource field, ignoring the specified excluded attribute (since
+ * there can be more than one specified attribute per Java resource
+ * attribute; albeit erroneously).
+ */
+ protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter, OrmPersistentAttribute exclude) {
+ for (OrmPersistentAttribute ormAttribute : this.getSpecifiedAttributes()) {
+ if (ormAttribute == exclude) {
+ continue; // skip
+ }
+ if (ormAttribute.isFor(javaResourceGetter, javaResourceSetter)) {
return ormAttribute;
}
}
@@ -799,13 +1007,16 @@ public class GenericOrmPersistentType
this.moveItemInList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
}
- protected void addVirtualAttribute(int index, JavaResourcePersistentAttribute javaResourceAttribute) {
- OrmReadOnlyPersistentAttribute virtualAttribute = this.buildVirtualAttribute(javaResourceAttribute);
+ protected void addVirtualAttribute(int index, OrmReadOnlyPersistentAttribute virtualAttribute) {
this.addItemToList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
}
- protected OrmReadOnlyPersistentAttribute buildVirtualAttribute(JavaResourcePersistentAttribute javaResourceAttribute) {
- return this.getContextNodeFactory().buildVirtualOrmPersistentAttribute(this, javaResourceAttribute);
+ protected OrmReadOnlyPersistentAttribute buildVirtualAttribute(JavaResourceField javaResourceField) {
+ return this.getContextNodeFactory().buildVirtualOrmPersistentField(this, javaResourceField);
+ }
+
+ protected OrmReadOnlyPersistentAttribute buildVirtualAttribute(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
+ return this.getContextNodeFactory().buildVirtualOrmPersistentProperty(this, javaResourceGetter, javaResourceSetter);
}
protected void removeVirtualAttribute(OrmReadOnlyPersistentAttribute virtualAttribute) {
@@ -813,32 +1024,6 @@ public class GenericOrmPersistentType
this.removeItemFromList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
}
- /**
- * virtual attribute container adapter
- */
- protected class VirtualAttributeContainerAdapter
- implements ContextContainerTools.Adapter<OrmReadOnlyPersistentAttribute, JavaResourcePersistentAttribute>
- {
- public Iterable<OrmReadOnlyPersistentAttribute> getContextElements() {
- return GenericOrmPersistentType.this.getVirtualAttributes();
- }
- public Iterable<JavaResourcePersistentAttribute> getResourceElements() {
- return GenericOrmPersistentType.this.getVirtualJavaResourceAttributes();
- }
- public JavaResourcePersistentAttribute getResourceElement(OrmReadOnlyPersistentAttribute contextElement) {
- return contextElement.getJavaResourcePersistentAttribute();
- }
- public void moveContextElement(int index, OrmReadOnlyPersistentAttribute element) {
- GenericOrmPersistentType.this.moveVirtualAttribute(index, element);
- }
- public void addContextElement(int index, JavaResourcePersistentAttribute resourceElement) {
- GenericOrmPersistentType.this.addVirtualAttribute(index, resourceElement);
- }
- public void removeContextElement(OrmReadOnlyPersistentAttribute element) {
- GenericOrmPersistentType.this.removeVirtualAttribute(element);
- }
- }
-
// ********** super persistent type **********
@@ -1123,8 +1308,8 @@ public class GenericOrmPersistentType
}
protected void validateAttributes(List<IMessage> messages, IReporter reporter) {
- for (Iterator<OrmReadOnlyPersistentAttribute> stream = this.attributes(); stream.hasNext(); ) {
- this.validateAttribute(stream.next(), messages, reporter);
+ for (OrmReadOnlyPersistentAttribute attribute : this.getAttributes()) {
+ this.validateAttribute(attribute, messages, reporter);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
index c0d42a00ce..cc577649ac 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
@@ -10,11 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
@@ -22,7 +19,6 @@ import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
@@ -40,18 +36,15 @@ public class GenericOrmQueryContainer
{
protected final XmlQueryContainer xmlQueryContainer;
- protected final Vector<OrmNamedQuery> namedQueries = new Vector<OrmNamedQuery>();
- protected NamedQueryContainerAdapter namedQueryContainerAdapter = new NamedQueryContainerAdapter();
-
- protected final Vector<OrmNamedNativeQuery> namedNativeQueries = new Vector<OrmNamedNativeQuery>();
- protected NamedNativeQueryContainerAdapter namedNativeQueryContainerAdapter = new NamedNativeQueryContainerAdapter();
+ protected final ContextListContainer<OrmNamedQuery, XmlNamedQuery> namedQueryContainer;
+ protected final ContextListContainer<OrmNamedNativeQuery, XmlNamedNativeQuery> namedNativeQueryContainer;
public GenericOrmQueryContainer(XmlContextNode parent, XmlQueryContainer xmlQueryContainer) {
super(parent);
this.xmlQueryContainer = xmlQueryContainer;
- this.initializeNamedQueries();
- this.initializeNamedNativeQueries();
+ this.namedQueryContainer = this.buildNamedQueryContainer();
+ this.namedNativeQueryContainer = this.buildNamedNativeQueryContainer();
}
@@ -74,25 +67,21 @@ public class GenericOrmQueryContainer
// ********** named queries **********
- public ListIterator<OrmNamedQuery> namedQueries() {
- return this.getNamedQueries().iterator();
- }
-
- protected ListIterable<OrmNamedQuery> getNamedQueries() {
- return new LiveCloneListIterable<OrmNamedQuery>(this.namedQueries);
+ public ListIterable<OrmNamedQuery> getNamedQueries() {
+ return this.namedQueryContainer.getContextElements();
}
- public int namedQueriesSize() {
- return this.namedQueries.size();
+ public int getNamedQueriesSize() {
+ return this.namedQueryContainer.getContextElementsSize();
}
public OrmNamedQuery addNamedQuery() {
- return this.addNamedQuery(this.namedQueries.size());
+ return this.addNamedQuery(this.getNamedQueriesSize());
}
public OrmNamedQuery addNamedQuery(int index) {
XmlNamedQuery xmlQuery = this.buildXmlNamedQuery();
- OrmNamedQuery query = this.addNamedQuery_(index, xmlQuery);
+ OrmNamedQuery query = this.namedQueryContainer.addContextElement(index, xmlQuery);
this.xmlQueryContainer.getNamedQueries().add(index, xmlQuery);
return query;
}
@@ -102,104 +91,77 @@ public class GenericOrmQueryContainer
}
public void removeNamedQuery(NamedQuery namedQuery) {
- this.removeNamedQuery(this.namedQueries.indexOf(namedQuery));
+ this.removeNamedQuery(this.namedQueryContainer.indexOfContextElement((OrmNamedQuery) namedQuery));
}
public void removeNamedQuery(int index) {
- this.removeNamedQuery_(index);
+ this.namedQueryContainer.removeContextElement(index);
this.xmlQueryContainer.getNamedQueries().remove(index);
}
- protected void removeNamedQuery_(int index) {
- this.removeItemFromList(index, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
public void moveNamedQuery(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.namedQueries, NAMED_QUERIES_LIST);
+ this.namedQueryContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlQueryContainer.getNamedQueries().move(targetIndex, sourceIndex);
}
- protected void initializeNamedQueries() {
- for (XmlNamedQuery xmlQuery : this.getXmlNamedQueries()) {
- this.namedQueries.add(this.buildNamedQuery(xmlQuery));
- }
- }
-
protected OrmNamedQuery buildNamedQuery(XmlNamedQuery xmlNamedQuery) {
return this.getContextNodeFactory().buildOrmNamedQuery(this, xmlNamedQuery);
}
protected void syncNamedQueries() {
- ContextContainerTools.synchronizeWithResourceModel(this.namedQueryContainerAdapter);
+ this.namedQueryContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlNamedQuery> getXmlNamedQueries() {
+ protected ListIterable<XmlNamedQuery> getXmlNamedQueries() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlNamedQuery>(this.xmlQueryContainer.getNamedQueries());
+ return new LiveCloneListIterable<XmlNamedQuery>(this.xmlQueryContainer.getNamedQueries());
}
- protected void moveNamedQuery_(int index, OrmNamedQuery namedQuery) {
- this.moveItemInList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST);
- }
-
- protected OrmNamedQuery addNamedQuery_(int index, XmlNamedQuery xmlNamedQuery) {
- OrmNamedQuery query = this.buildNamedQuery(xmlNamedQuery);
- this.addItemToList(index, query, this.namedQueries, NAMED_QUERIES_LIST);
- return query;
- }
-
- protected void removeNamedQuery_(OrmNamedQuery namedQuery) {
- this.removeNamedQuery_(this.namedQueries.indexOf(namedQuery));
+ protected ContextListContainer<OrmNamedQuery, XmlNamedQuery> buildNamedQueryContainer() {
+ return new NamedQueryContainer();
}
/**
- * named query container adapter
+ * named query container
*/
- protected class NamedQueryContainerAdapter
- implements ContextContainerTools.Adapter<OrmNamedQuery, XmlNamedQuery>
+ protected class NamedQueryContainer
+ extends ContextListContainer<OrmNamedQuery, XmlNamedQuery>
{
- public Iterable<OrmNamedQuery> getContextElements() {
- return GenericOrmQueryContainer.this.getNamedQueries();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return NAMED_QUERIES_LIST;
}
- public Iterable<XmlNamedQuery> getResourceElements() {
+ @Override
+ protected OrmNamedQuery buildContextElement(XmlNamedQuery resourceElement) {
+ return GenericOrmQueryContainer.this.buildNamedQuery(resourceElement);
+ }
+ @Override
+ protected ListIterable<XmlNamedQuery> getResourceElements() {
return GenericOrmQueryContainer.this.getXmlNamedQueries();
}
- public XmlNamedQuery getResourceElement(OrmNamedQuery contextElement) {
+ @Override
+ protected XmlNamedQuery getResourceElement(OrmNamedQuery contextElement) {
return contextElement.getXmlQuery();
}
- public void moveContextElement(int index, OrmNamedQuery element) {
- GenericOrmQueryContainer.this.moveNamedQuery_(index, element);
- }
- public void addContextElement(int index, XmlNamedQuery resourceElement) {
- GenericOrmQueryContainer.this.addNamedQuery_(index, resourceElement);
- }
- public void removeContextElement(OrmNamedQuery element) {
- GenericOrmQueryContainer.this.removeNamedQuery_(element);
- }
}
-
// ********** named native queries **********
- public ListIterator<OrmNamedNativeQuery> namedNativeQueries() {
- return this.getNamedNativeQueries().iterator();
- }
-
- protected ListIterable<OrmNamedNativeQuery> getNamedNativeQueries() {
- return new LiveCloneListIterable<OrmNamedNativeQuery>(this.namedNativeQueries);
+ public ListIterable<OrmNamedNativeQuery> getNamedNativeQueries() {
+ return this.namedNativeQueryContainer.getContextElements();
}
- public int namedNativeQueriesSize() {
- return this.namedNativeQueries.size();
+ public int getNamedNativeQueriesSize() {
+ return this.namedNativeQueryContainer.getContextElementsSize();
}
public OrmNamedNativeQuery addNamedNativeQuery() {
- return this.addNamedNativeQuery(this.namedNativeQueries.size());
+ return this.addNamedNativeQuery(this.getNamedNativeQueriesSize());
}
public OrmNamedNativeQuery addNamedNativeQuery(int index) {
XmlNamedNativeQuery xmlQuery = this.buildXmlNamedNativeQuery();
- OrmNamedNativeQuery query = this.addNamedNativeQuery_(index, xmlQuery);
+ OrmNamedNativeQuery query = this.namedNativeQueryContainer.addContextElement(index, xmlQuery);
this.xmlQueryContainer.getNamedNativeQueries().add(index, xmlQuery);
return query;
}
@@ -209,80 +171,58 @@ public class GenericOrmQueryContainer
}
public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery));
+ this.removeNamedNativeQuery(this.namedNativeQueryContainer.indexOfContextElement((OrmNamedNativeQuery) namedNativeQuery));
}
public void removeNamedNativeQuery(int index) {
- this.removeNamedNativeQuery_(index);
+ this.namedNativeQueryContainer.removeContextElement(index);
this.xmlQueryContainer.getNamedNativeQueries().remove(index);
}
- protected void removeNamedNativeQuery_(int index) {
- this.removeItemFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ this.namedNativeQueryContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlQueryContainer.getNamedNativeQueries().move(targetIndex, sourceIndex);
}
- protected void initializeNamedNativeQueries() {
- for (XmlNamedNativeQuery xmlQuery : this.getXmlNamedNativeQueries()) {
- this.namedNativeQueries.add(this.buildNamedNativeQuery(xmlQuery));
- }
- }
-
protected OrmNamedNativeQuery buildNamedNativeQuery(XmlNamedNativeQuery xmlNamedNativeQuery) {
return this.getContextNodeFactory().buildOrmNamedNativeQuery(this, xmlNamedNativeQuery);
}
protected void syncNamedNativeQueries() {
- ContextContainerTools.synchronizeWithResourceModel(this.namedNativeQueryContainerAdapter);
+ this.namedNativeQueryContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlNamedNativeQuery> getXmlNamedNativeQueries() {
+ protected ListIterable<XmlNamedNativeQuery> getXmlNamedNativeQueries() {
// clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlNamedNativeQuery>(this.xmlQueryContainer.getNamedNativeQueries());
+ return new LiveCloneListIterable<XmlNamedNativeQuery>(this.xmlQueryContainer.getNamedNativeQueries());
}
- protected void moveNamedNativeQuery_(int index, OrmNamedNativeQuery namedNativeQuery) {
- this.moveItemInList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-
- protected OrmNamedNativeQuery addNamedNativeQuery_(int index, XmlNamedNativeQuery xmlNamedNativeQuery) {
- OrmNamedNativeQuery query = this.buildNamedNativeQuery(xmlNamedNativeQuery);
- this.addItemToList(index, query, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- return query;
- }
-
- protected void removeNamedNativeQuery_(OrmNamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery_(this.namedNativeQueries.indexOf(namedNativeQuery));
+ protected ContextListContainer<OrmNamedNativeQuery, XmlNamedNativeQuery> buildNamedNativeQueryContainer() {
+ return new NamedNativeQueryContainer();
}
/**
- * named native query container adapter
+ * named query container
*/
- protected class NamedNativeQueryContainerAdapter
- implements ContextContainerTools.Adapter<OrmNamedNativeQuery, XmlNamedNativeQuery>
+ protected class NamedNativeQueryContainer
+ extends ContextListContainer<OrmNamedNativeQuery, XmlNamedNativeQuery>
{
- public Iterable<OrmNamedNativeQuery> getContextElements() {
- return GenericOrmQueryContainer.this.getNamedNativeQueries();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return NAMED_NATIVE_QUERIES_LIST;
}
- public Iterable<XmlNamedNativeQuery> getResourceElements() {
+ @Override
+ protected OrmNamedNativeQuery buildContextElement(XmlNamedNativeQuery resourceElement) {
+ return GenericOrmQueryContainer.this.buildNamedNativeQuery(resourceElement);
+ }
+ @Override
+ protected ListIterable<XmlNamedNativeQuery> getResourceElements() {
return GenericOrmQueryContainer.this.getXmlNamedNativeQueries();
}
- public XmlNamedNativeQuery getResourceElement(OrmNamedNativeQuery contextElement) {
+ @Override
+ protected XmlNamedNativeQuery getResourceElement(OrmNamedNativeQuery contextElement) {
return contextElement.getXmlQuery();
}
- public void moveContextElement(int index, OrmNamedNativeQuery element) {
- GenericOrmQueryContainer.this.moveNamedNativeQuery_(index, element);
- }
- public void addContextElement(int index, XmlNamedNativeQuery resourceElement) {
- GenericOrmQueryContainer.this.addNamedNativeQuery_(index, resourceElement);
- }
- public void removeContextElement(OrmNamedNativeQuery element) {
- GenericOrmQueryContainer.this.removeNamedNativeQuery_(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
index 333a1a1e3c..500b4e751c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
@@ -10,13 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.jpa.core.context.JoinColumn;
@@ -26,7 +21,6 @@ import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmReferenceTable;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable;
@@ -42,8 +36,7 @@ public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTab
extends AbstractOrmTable<X>
implements OrmReferenceTable
{
- protected final Vector<OrmJoinColumn> specifiedJoinColumns = new Vector<OrmJoinColumn>();
- protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter();
+ protected final ContextListContainer<OrmJoinColumn, XmlJoinColumn> specifiedJoinColumnContainer;
protected final OrmReadOnlyJoinColumn.Owner joinColumnOwner;
protected OrmJoinColumn defaultJoinColumn;
@@ -52,7 +45,7 @@ public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTab
protected GenericOrmReferenceTable(XmlContextNode parent, Owner owner) {
super(parent, owner);
this.joinColumnOwner = this.buildJoinColumnOwner();
- this.initializeSpecifiedJoinColumns();
+ this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
}
@@ -74,16 +67,12 @@ public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTab
// ********** join columns **********
- public ListIterator<OrmJoinColumn> joinColumns() {
- return this.getJoinColumns().iterator();
- }
-
- protected ListIterable<OrmJoinColumn> getJoinColumns() {
+ public ListIterable<OrmJoinColumn> getJoinColumns() {
return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
}
- public int joinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
}
public void convertDefaultJoinColumnToSpecified() {
@@ -93,34 +82,30 @@ public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTab
// ********** specified join columns **********
- public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
- return this.getSpecifiedJoinColumns().iterator();
+ public ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
+ return this.specifiedJoinColumnContainer.getContextElements();
}
- protected ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
- return new LiveCloneListIterable<OrmJoinColumn>(this.specifiedJoinColumns);
- }
-
- public int specifiedJoinColumnsSize() {
- return this.specifiedJoinColumns.size();
+ public int getSpecifiedJoinColumnsSize() {
+ return this.specifiedJoinColumnContainer.getContextElementsSize();
}
public boolean hasSpecifiedJoinColumns() {
- return this.specifiedJoinColumns.size() != 0;
+ return this.getSpecifiedJoinColumnsSize() != 0;
}
public OrmJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumns.get(index);
+ return this.specifiedJoinColumnContainer.getContextElement(index);
}
public OrmJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size());
+ return this.addSpecifiedJoinColumn(this.getSpecifiedJoinColumnsSize());
}
public OrmJoinColumn addSpecifiedJoinColumn(int index) {
X xmlTable = this.getXmlTableForUpdate();
XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
- OrmJoinColumn joinColumn = this.addSpecifiedJoinColumn_(index, xmlJoinColumn);
+ OrmJoinColumn joinColumn = this.specifiedJoinColumnContainer.addContextElement(index, xmlJoinColumn);
xmlTable.getJoinColumns().add(index, xmlJoinColumn);
return joinColumn;
}
@@ -130,80 +115,58 @@ public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTab
}
public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn));
+ this.removeSpecifiedJoinColumn(this.specifiedJoinColumnContainer.indexOfContextElement((OrmJoinColumn) joinColumn));
}
public void removeSpecifiedJoinColumn(int index) {
- this.removeSpecifiedJoinColumn_(index);
+ this.specifiedJoinColumnContainer.removeContextElement(index);
this.getXmlTable().getJoinColumns().remove(index);
this.removeXmlTableIfUnset();
}
- protected void removeSpecifiedJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
+ this.specifiedJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
this.getXmlTable().getJoinColumns().move(targetIndex, sourceIndex);
}
- protected void initializeSpecifiedJoinColumns() {
- for (XmlJoinColumn xmlJoinColumn : this.getXmlJoinColumns()) {
- this.specifiedJoinColumns.add(this.buildJoinColumn(xmlJoinColumn));
- }
- }
-
protected void syncSpecifiedJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter);
+ this.specifiedJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlJoinColumn> getXmlJoinColumns() {
+ protected ListIterable<XmlJoinColumn> getXmlJoinColumns() {
X xmlTable = this.getXmlTable();
return (xmlTable == null) ?
- EmptyIterable.<XmlJoinColumn>instance() :
+ EmptyListIterable.<XmlJoinColumn>instance() :
// clone to reduce chance of concurrency problems
- new LiveCloneIterable<XmlJoinColumn>(xmlTable.getJoinColumns());
+ new LiveCloneListIterable<XmlJoinColumn>(xmlTable.getJoinColumns());
}
- protected void moveSpecifiedJoinColumn_(int index, OrmJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- }
-
- protected OrmJoinColumn addSpecifiedJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) {
- OrmJoinColumn joinColumn = this.buildJoinColumn(xmlJoinColumn);
- this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST);
- return joinColumn;
- }
-
- protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn));
+ protected ContextListContainer<OrmJoinColumn, XmlJoinColumn> buildSpecifiedJoinColumnContainer() {
+ return new SpecifiedJoinColumnContainer();
}
/**
- * specified join column container adapter
+ * specified join column container
*/
- protected class SpecifiedJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmJoinColumn, XmlJoinColumn>
+ protected class SpecifiedJoinColumnContainer
+ extends ContextListContainer<OrmJoinColumn, XmlJoinColumn>
{
- public Iterable<OrmJoinColumn> getContextElements() {
- return GenericOrmReferenceTable.this.getSpecifiedJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_JOIN_COLUMNS_LIST;
}
- public Iterable<XmlJoinColumn> getResourceElements() {
+ @Override
+ protected OrmJoinColumn buildContextElement(XmlJoinColumn resourceElement) {
+ return GenericOrmReferenceTable.this.buildJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<XmlJoinColumn> getResourceElements() {
return GenericOrmReferenceTable.this.getXmlJoinColumns();
}
- public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
+ @Override
+ protected XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
return contextElement.getXmlColumn();
}
- public void moveContextElement(int index, OrmJoinColumn element) {
- GenericOrmReferenceTable.this.moveSpecifiedJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlJoinColumn resourceElement) {
- GenericOrmReferenceTable.this.addSpecifiedJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmJoinColumn element) {
- GenericOrmReferenceTable.this.removeSpecifiedJoinColumn_(element);
- }
}
protected abstract OrmReadOnlyJoinColumn.Owner buildJoinColumnOwner();
@@ -252,14 +215,14 @@ public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTab
protected void initializeFrom(ReadOnlyReferenceTable oldTable) {
super.initializeFrom(oldTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedJoinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : oldTable.getSpecifiedJoinColumns()) {
this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
}
}
protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) {
super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.joinColumns())) {
+ for (ReadOnlyJoinColumn joinColumn : virtualTable.getJoinColumns()) {
this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
index 044ccfd7d9..54c5bddabf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
@@ -10,13 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.jpa.core.context.Entity;
@@ -31,7 +27,6 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable;
import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
@@ -53,8 +48,7 @@ public class GenericOrmSecondaryTable
/** @see AbstractOrmTable#AbstractOrmTable(org.eclipse.jpt.jpa.core.context.XmlContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable) */
protected /* final */ XmlSecondaryTable xmlSecondaryTable;
- protected final Vector<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns = new Vector<OrmPrimaryKeyJoinColumn>();
- protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter();
+ protected final ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumnContainer;
protected final OrmReadOnlyBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
protected OrmPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
@@ -63,7 +57,7 @@ public class GenericOrmSecondaryTable
public GenericOrmSecondaryTable(OrmEntity parent, Owner owner, XmlSecondaryTable xmlSecondaryTable) {
super(parent, owner, xmlSecondaryTable);
this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.initializeSpecifiedPrimaryKeyJoinColumns();
+ this.specifiedPrimaryKeyJoinColumnContainer = this.buildSpecifiedPrimaryKeyJoinColumnContainer();
}
@@ -123,44 +117,36 @@ public class GenericOrmSecondaryTable
// ********** primary key join columns **********
- public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumns().iterator();
- }
-
- protected ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ public ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
}
- public int primaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
+ public int getPrimaryKeyJoinColumnsSize() {
+ return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
}
// ********** specified primary key join columns **********
- public ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().iterator();
- }
-
public ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return new LiveCloneListIterable<OrmPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
}
- public int specifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumns.size();
+ public int getSpecifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
}
protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumns.size() != 0;
+ return this.getSpecifiedPrimaryKeyJoinColumnsSize() != 0;
}
public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size());
+ return this.addSpecifiedPrimaryKeyJoinColumn(this.getSpecifiedPrimaryKeyJoinColumnsSize());
}
public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn joinColumn = this.addSpecifiedPrimaryKeyJoinColumn_(index, xmlJoinColumn);
+ OrmPrimaryKeyJoinColumn joinColumn = this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(index, xmlJoinColumn);
this.xmlSecondaryTable.getPrimaryKeyJoinColumns().add(index, xmlJoinColumn);
return joinColumn;
}
@@ -170,76 +156,58 @@ public class GenericOrmSecondaryTable
}
public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
+ this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumnContainer.indexOfContextElement((OrmPrimaryKeyJoinColumn) joinColumn));
}
public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- this.removeSpecifiedPrimaryKeyJoinColumn_(index);
+ this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(index);
this.xmlSecondaryTable.getPrimaryKeyJoinColumns().remove(index);
}
- protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) {
- this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- }
-
public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlSecondaryTable.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
}
- protected void initializeSpecifiedPrimaryKeyJoinColumns() {
- for (XmlPrimaryKeyJoinColumn xmlJoinColumn : this.getXmlPrimaryKeyJoinColumns()) {
- this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlJoinColumn));
- }
- }
-
protected void syncSpecifiedPrimaryKeyJoinColumns() {
- ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter);
+ this.specifiedPrimaryKeyJoinColumnContainer.synchronizeWithResourceModel();
}
- protected Iterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlPrimaryKeyJoinColumn>(this.xmlSecondaryTable.getPrimaryKeyJoinColumns());
- }
-
- protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn joinColumn) {
- this.moveItemInList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ protected void updateSpecifiedPrimaryKeyJoinColumns() {
+ this.specifiedPrimaryKeyJoinColumnContainer.update();
}
- protected OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlJoinColumn) {
- OrmPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(xmlJoinColumn);
- this.addItemToList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
- return joinColumn;
+ protected ListIterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneListIterable<XmlPrimaryKeyJoinColumn>(this.xmlSecondaryTable.getPrimaryKeyJoinColumns());
}
- protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn));
+ protected ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> buildSpecifiedPrimaryKeyJoinColumnContainer() {
+ return new SpecifiedPrimaryKeyJoinColumnContainer();
}
/**
- * specified primary key join column container adapter
+ * specified primary key join column container
*/
- protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter
- implements ContextContainerTools.Adapter<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
+ protected class SpecifiedPrimaryKeyJoinColumnContainer
+ extends ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
{
- public Iterable<OrmPrimaryKeyJoinColumn> getContextElements() {
- return GenericOrmSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
}
- public Iterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
+ @Override
+ protected OrmPrimaryKeyJoinColumn buildContextElement(XmlPrimaryKeyJoinColumn resourceElement) {
+ return GenericOrmSecondaryTable.this.buildPrimaryKeyJoinColumn(resourceElement);
+ }
+ @Override
+ protected ListIterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
return GenericOrmSecondaryTable.this.getXmlPrimaryKeyJoinColumns();
}
- public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
+ @Override
+ protected XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
return contextElement.getXmlColumn();
}
- public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) {
- GenericOrmSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element);
- }
- public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) {
- GenericOrmSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement);
- }
- public void removeContextElement(OrmPrimaryKeyJoinColumn element) {
- GenericOrmSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn_(element);
- }
}
protected OrmReadOnlyBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
@@ -303,7 +271,7 @@ public class GenericOrmSecondaryTable
public void initializeFrom(ReadOnlySecondaryTable oldSecondaryTable) {
super.initializeFrom(oldSecondaryTable);
- for (ReadOnlyPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(oldSecondaryTable.specifiedPrimaryKeyJoinColumns())) {
+ for (ReadOnlyPrimaryKeyJoinColumn pkJoinColumn : oldSecondaryTable.getSpecifiedPrimaryKeyJoinColumns()) {
this.addSpecifiedPrimaryKeyJoinColumn().initializeFrom(pkJoinColumn);
}
}
@@ -371,7 +339,7 @@ public class GenericOrmSecondaryTable
}
public String getDefaultColumnName() {
- if (this.joinColumnsSize() != 1) {
+ if (this.getJoinColumnsSize() != 1) {
return null;
}
Entity parentEntity = this.getEntity().getParentEntity();
@@ -384,8 +352,8 @@ public class GenericOrmSecondaryTable
return GenericOrmSecondaryTable.this.getDbTable();
}
- public int joinColumnsSize() {
- return GenericOrmSecondaryTable.this.primaryKeyJoinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmSecondaryTable.this.getPrimaryKeyJoinColumnsSize();
}
public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
index 9805b186f0..0516dff51b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmGenerator;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
@@ -51,8 +49,7 @@ public class GenericOrmTableGenerator
protected String specifiedPkColumnValue;
protected String defaultPkColumnValue;
- protected final Vector<OrmUniqueConstraint> uniqueConstraints = new Vector<OrmUniqueConstraint>();
- protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter();
+ protected final ContextListContainer<OrmUniqueConstraint, XmlUniqueConstraint> uniqueConstraintContainer;
// ********** constructor **********
@@ -65,7 +62,7 @@ public class GenericOrmTableGenerator
this.specifiedPkColumnName = xmlTableGenerator.getPkColumnName();
this.specifiedValueColumnName = xmlTableGenerator.getValueColumnName();
this.specifiedPkColumnValue = xmlTableGenerator.getPkColumnValue();
- this.initializeUniqueContraints();
+ this.uniqueConstraintContainer = new UniqueConstraintContainer();
}
@@ -329,21 +326,21 @@ public class GenericOrmTableGenerator
// ********** unique constraints **********
- public Iterable<OrmUniqueConstraint> getUniqueConstraints() {
- return new LiveCloneIterable<OrmUniqueConstraint>(this.uniqueConstraints);
+ public ListIterable<OrmUniqueConstraint> getUniqueConstraints() {
+ return this.uniqueConstraintContainer.getContextElements();
}
public int getUniqueConstraintsSize() {
- return this.uniqueConstraints.size();
+ return this.uniqueConstraintContainer.getContextElementsSize();
}
public OrmUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.uniqueConstraints.size());
+ return this.addUniqueConstraint(this.getUniqueConstraintsSize());
}
public OrmUniqueConstraint addUniqueConstraint(int index) {
XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint();
- OrmUniqueConstraint constraint = this.addUniqueConstraint_(index, xmlConstraint);
+ OrmUniqueConstraint constraint = this.uniqueConstraintContainer.addContextElement(index, xmlConstraint);
this.xmlGenerator.getUniqueConstraints().add(index, xmlConstraint);
return constraint;
}
@@ -353,80 +350,58 @@ public class GenericOrmTableGenerator
}
public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint));
+ this.removeUniqueConstraint(this.uniqueConstraintContainer.indexOfContextElement((OrmUniqueConstraint) uniqueConstraint));
}
public void removeUniqueConstraint(int index) {
- this.removeUniqueConstraint_(index);
+ this.uniqueConstraintContainer.removeContextElement(index);
this.xmlGenerator.getUniqueConstraints().remove(index);
}
- protected void removeUniqueConstraint_(int index) {
- this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ this.uniqueConstraintContainer.moveContextElement(targetIndex, sourceIndex);
this.xmlGenerator.getUniqueConstraints().move(targetIndex, sourceIndex);
}
- protected void initializeUniqueContraints() {
- for (XmlUniqueConstraint constraint : this.getXmlUniqueConstraints()) {
- this.uniqueConstraints.add(this.buildUniqueConstraint(constraint));
- }
- }
-
protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint resourceUniqueConstraint) {
return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, resourceUniqueConstraint);
}
protected void syncUniqueConstraints() {
- ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter);
- }
-
- protected Iterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlUniqueConstraint>(this.xmlGenerator.getUniqueConstraints());
+ this.uniqueConstraintContainer.synchronizeWithResourceModel();
}
- protected void moveUniqueConstraint_(int index, OrmUniqueConstraint uniqueConstraint) {
- this.moveItemInList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ protected void updateUniqueConstraints() {
+ this.uniqueConstraintContainer.update();
}
- protected OrmUniqueConstraint addUniqueConstraint_(int index, XmlUniqueConstraint xmlConstraint) {
- OrmUniqueConstraint constraint = this.buildUniqueConstraint(xmlConstraint);
- this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- return constraint;
- }
-
- protected void removeUniqueConstraint_(OrmUniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(uniqueConstraint));
+ protected ListIterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
+ // clone to reduce chance of concurrency problems
+ return new LiveCloneListIterable<XmlUniqueConstraint>(this.xmlGenerator.getUniqueConstraints());
}
/**
- * unique constraint container adapter
+ * unique constraint container
*/
- protected class UniqueConstraintContainerAdapter
- implements ContextContainerTools.Adapter<OrmUniqueConstraint, XmlUniqueConstraint>
+ protected class UniqueConstraintContainer
+ extends ContextListContainer<OrmUniqueConstraint, XmlUniqueConstraint>
{
- public Iterable<OrmUniqueConstraint> getContextElements() {
- return GenericOrmTableGenerator.this.getUniqueConstraints();
+ @Override
+ protected String getContextElementsPropertyName() {
+ return UNIQUE_CONSTRAINTS_LIST;
}
- public Iterable<XmlUniqueConstraint> getResourceElements() {
+ @Override
+ protected OrmUniqueConstraint buildContextElement(XmlUniqueConstraint resourceElement) {
+ return GenericOrmTableGenerator.this.buildUniqueConstraint(resourceElement);
+ }
+ @Override
+ protected ListIterable<XmlUniqueConstraint> getResourceElements() {
return GenericOrmTableGenerator.this.getXmlUniqueConstraints();
}
- public XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
+ @Override
+ protected XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
return contextElement.getXmlUniqueConstraint();
}
- public void moveContextElement(int index, OrmUniqueConstraint element) {
- GenericOrmTableGenerator.this.moveUniqueConstraint_(index, element);
- }
- public void addContextElement(int index, XmlUniqueConstraint resourceElement) {
- GenericOrmTableGenerator.this.addUniqueConstraint_(index, resourceElement);
- }
- public void removeContextElement(OrmUniqueConstraint element) {
- GenericOrmTableGenerator.this.removeUniqueConstraint_(element);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
index d3d37ad989..5cd0538991 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
-import java.util.ListIterator;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.JoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
@@ -40,22 +40,22 @@ public class NullOrmJoinColumnRelationshipStrategy
// ********** join columns **********
- public ListIterator<OrmJoinColumn> joinColumns() {
- return EmptyListIterator.<OrmJoinColumn>instance();
+ public ListIterable<OrmJoinColumn> getJoinColumns() {
+ return EmptyListIterable.<OrmJoinColumn>instance();
}
- public int joinColumnsSize() {
+ public int getJoinColumnsSize() {
return 0;
}
// ********** specified join columns **********
- public ListIterator<OrmJoinColumn> specifiedJoinColumns() {
- return EmptyListIterator.<OrmJoinColumn>instance();
+ public ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
+ return EmptyListIterable.<OrmJoinColumn>instance();
}
- public int specifiedJoinColumnsSize() {
+ public int getSpecifiedJoinColumnsSize() {
return 0;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
index 1a95aa6256..ddf31c9991 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
@@ -9,10 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.Tools;
@@ -29,7 +30,6 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.text.edits.DeleteEdit;
import org.eclipse.text.edits.ReplaceEdit;
@@ -54,7 +54,8 @@ public class GenericClassRef
/**
* The Java persistent type corresponding to the ref's class name;
- * this can be <code>null</code> if the name is invalid.
+ * this can be <code>null</code> if the className is invalid or
+ * refers to an enum instead of a class or interface.
*/
protected JavaPersistentType javaPersistentType;
@@ -150,7 +151,7 @@ public class GenericClassRef
}
protected void updateJavaPersistentType() {
- JavaResourcePersistentType resourceType = this.resolveJavaResourcePersistentType();
+ JavaResourceType resourceType = this.resolveJavaResourceType();
if (resourceType == null) {
if (this.javaPersistentType != null) {
this.javaPersistentType.dispose();
@@ -160,7 +161,7 @@ public class GenericClassRef
if (this.javaPersistentType == null) {
this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
} else {
- if (this.javaPersistentType.getResourcePersistentType() == resourceType) {
+ if (this.javaPersistentType.getJavaResourceType() == resourceType) {
this.javaPersistentType.update();
} else {
this.javaPersistentType.dispose();
@@ -170,12 +171,12 @@ public class GenericClassRef
}
}
- protected JavaResourcePersistentType resolveJavaResourcePersistentType() {
+ protected JavaResourceType resolveJavaResourceType() {
String javaClassName = this.getJavaClassName();
- return (javaClassName == null) ? null : this.getJpaProject().getJavaResourcePersistentType(javaClassName);
+ return (javaClassName == null) ? null : (JavaResourceType) this.getJpaProject().getJavaResourceType(javaClassName, Kind.TYPE);
}
- protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
+ protected JavaPersistentType buildJavaPersistentType(JavaResourceType jrpt) {
return this.getJpaFactory().buildJavaPersistentType(this, jrpt);
}
@@ -345,9 +346,8 @@ public class GenericClassRef
// i.e. the persistence.xml ref is the only ref - none of the mapping
// files reference the same class
boolean validateJavaPersistentType = true;
- for (Iterator<MappingFileRef> stream = this.getPersistenceUnit().mappingFileRefsContaining(this.getJavaClassName()); stream.hasNext(); ) {
+ for (MappingFileRef mappingFileRef : this.getPersistenceUnit().getMappingFileRefsContaining(this.getJavaClassName())) {
validateJavaPersistentType = false;
- MappingFileRef mappingFileRef = stream.next();
messages.add(
DefaultJpaValidationMessages.buildMessage(
IMessage.LOW_SEVERITY,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
index 491d9a6ec9..1e9083278b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
@@ -10,8 +10,6 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
import java.util.List;
-import java.util.ListIterator;
-
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
@@ -72,11 +70,7 @@ public class GenericPersistence
// ********** persistence units **********
- public ListIterator<PersistenceUnit> persistenceUnits() {
- return this.getPersistenceUnits().iterator();
- }
-
- protected ListIterable<PersistenceUnit> getPersistenceUnits() {
+ public ListIterable<PersistenceUnit> getPersistenceUnits() {
return (this.persistenceUnit == null) ? EmptyListIterable.<PersistenceUnit>instance() : this.getPersistenceUnits_();
}
@@ -84,12 +78,12 @@ public class GenericPersistence
return new SingleElementListIterable<PersistenceUnit>(this.persistenceUnit);
}
- public int persistenceUnitsSize() {
+ public int getPersistenceUnitsSize() {
return (this.persistenceUnit == null) ? 0 : 1;
}
public PersistenceUnit addPersistenceUnit() {
- return this.addPersistenceUnit(this.persistenceUnitsSize());
+ return this.addPersistenceUnit(this.getPersistenceUnitsSize());
}
public PersistenceUnit addPersistenceUnit(int index) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
index 84286b57c7..a9e3b009a8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.AssociationOverride
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java
deleted file mode 100644
index 7dbc81b9bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public final class BinaryAssociationOverrides1_0Annotation
- extends BinaryAssociationOverridesAnnotation
-{
-
- public BinaryAssociationOverrides1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- @Override
- protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) {
- return new BinaryAssociationOverride1_0Annotation(this, (IAnnotation) jdtAssociationOverride);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java
deleted file mode 100644
index f1bd6aac02..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
-
-/**
- * javax.persistence.NamedQueries
- */
-public final class BinaryNamedQueries1_0Annotation
- extends BinaryNamedQueriesAnnotation
-{
- public BinaryNamedQueries1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- @Override
- protected NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery) {
- return new BinaryNamedQuery1_0Annotation(this, (IAnnotation) jdtQuery);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
index 3b315898d1..34bd911323 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.NamedQuery
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
index 0415109916..8079c4b62b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.SequenceGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
index 529a51a775..987867e3c4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,13 +11,14 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <code>javax.persistence.AssociationOverride</code>
@@ -25,19 +26,52 @@ import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
public final class SourceAssociationOverride1_0Annotation
extends SourceAssociationOverrideAnnotation
{
- public SourceAssociationOverride1_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+
+ public static SourceAssociationOverride1_0Annotation buildSourceAssociationOverrideAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element) {
+
+ return new SourceAssociationOverride1_0Annotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public static SourceAssociationOverride1_0Annotation buildSourceAssociationOverrideAnnotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement annotatedElement,
+ int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildAssociationOverrideDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildAssociationOverrideAnnotationAdapter(annotatedElement, idaa);
+ return new SourceAssociationOverride1_0Annotation(
+ parent,
+ annotatedElement,
+ idaa,
+ iaa);
+ }
+
+ public static SourceAssociationOverride1_0Annotation buildNestedSourceAssociationOverrideAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ return new SourceAssociationOverride1_0Annotation(parent, element, idaa);
+ }
+
+ private SourceAssociationOverride1_0Annotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ DeclarationAnnotationAdapter daa) {
+
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
}
- // ********** static methods **********
+ private SourceAssociationOverride1_0Annotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
- public static SourceAssociationOverride1_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) {
- return new SourceAssociationOverride1_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
}
- static SourceAssociationOverride1_0Annotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
- return new SourceAssociationOverride1_0Annotation(parent, member, idaa, annotationAdapter);
+ private SourceAssociationOverride1_0Annotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java
deleted file mode 100644
index f4c8ed5d23..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
-
-/**
- * <code>javax.persistence.AssociationOverrides</code>
- */
-public final class SourceAssociationOverrides1_0Annotation
- extends SourceAssociationOverridesAnnotation
-{
- public SourceAssociationOverrides1_0Annotation(JavaResourceNode parent, Member member) {
- super(parent, member);
- }
-
- @Override
- protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceAssociationOverride1_0Annotation.buildNestedAssociationOverride(this.parent, this.annotatedElement, index, this.daa);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
index fa1baaabf2..3ce0b644b0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,11 +9,11 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <code>javax.persistence.NamedQuery</code>
@@ -21,11 +21,21 @@ import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
public final class SourceNamedQuery1_0Annotation
extends SourceNamedQueryAnnotation
{
- public SourceNamedQuery1_0Annotation(JavaResourceNode parent, Type type) {
- super(parent, type);
+ public static SourceNamedQuery1_0Annotation buildSourceNamedQueryAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNamedQueryDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildNamedQueryAnnotationAdapter(annotatedElement, idaa);
+ return new SourceNamedQuery1_0Annotation(
+ parent,
+ annotatedElement,
+ idaa,
+ iaa);
+ }
+
+ private SourceNamedQuery1_0Annotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement annotatedElement,
+ IndexedDeclarationAnnotationAdapter daa,
+ IndexedAnnotationAdapter annotationAdapter) {
+ super(parent, annotatedElement, daa, annotationAdapter);
}
-
- public SourceNamedQuery1_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
index 898364a8d5..99cc3b6c72 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.SequenceGenerator
@@ -20,8 +20,8 @@ public final class SourceSequenceGenerator1_0Annotation
extends SourceSequenceGeneratorAnnotation
{
- public SourceSequenceGenerator1_0Annotation(JavaResourceNode parent, Member member) {
- super(parent, member);
+ public SourceSequenceGenerator1_0Annotation(JavaResourceNode parent, AnnotatedElement element) {
+ super(parent, element);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
index 84009a4467..948eff2c22 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,17 @@
package org.eclipse.jpt.jpa.core.internal.jpa2;
import java.util.ArrayList;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Access2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.AssociationOverride2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.AssociationOverrides2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Cacheable2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.CollectionTable2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.ElementCollection2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.GeneratedAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyClass2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyColumn2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyEnumerated2_0AnnotationDefinition;
@@ -26,10 +28,11 @@ import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyJoinColumn2_0A
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyJoinColumns2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyTemporal2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapsId2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NamedQueries2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NamedQuery2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.SequenceGenerator2_0AnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.StaticMetamodelAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverridesAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.BasicAnnotationDefinition;
@@ -55,6 +58,7 @@ import org.eclipse.jpt.jpa.core.internal.resource.java.MapKeyAnnotationDefinitio
import org.eclipse.jpt.jpa.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
+import org.eclipse.jpt.jpa.core.internal.resource.java.NamedQueriesAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.OneToManyAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.OneToOneAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.OrderByAnnotationDefinition;
@@ -67,7 +71,6 @@ import org.eclipse.jpt.jpa.core.internal.resource.java.TableGeneratorAnnotationD
import org.eclipse.jpt.jpa.core.internal.resource.java.TemporalAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.TransientAnnotationDefinition;
import org.eclipse.jpt.jpa.core.internal.resource.java.VersionAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
/**
* Support for existing JPA 1.0 annotations, new JPA 2.0 annotations, and
@@ -95,89 +98,55 @@ public class Generic2_0JpaAnnotationDefinitionProvider
}
@Override
- protected void addTypeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, TYPE_ANNOTATION_DEFINITIONS);
+ protected void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS);
}
- protected static final AnnotationDefinition[] TYPE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
- Access2_0AnnotationDefinition.instance(),
- AssociationOverride2_0AnnotationDefinition.instance(),
- AssociationOverrides2_0AnnotationDefinition.instance(),
- AttributeOverrideAnnotationDefinition.instance(),
+ protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
AttributeOverridesAnnotationDefinition.instance(),
- Cacheable2_0AnnotationDefinition.instance(),
- DiscriminatorColumnAnnotationDefinition.instance(),
- DiscriminatorValueAnnotationDefinition.instance(),
- EmbeddableAnnotationDefinition.instance(),
- EntityAnnotationDefinition.instance(),
- IdClassAnnotationDefinition.instance(),
- InheritanceAnnotationDefinition.instance(),
- MappedSuperclassAnnotationDefinition.instance(),
- NamedQuery2_0AnnotationDefinition.instance(),
- NamedQueries2_0AnnotationDefinition.instance(),
- NamedNativeQueryAnnotationDefinition.instance(),
- NamedNativeQueriesAnnotationDefinition.instance(),
- PrimaryKeyJoinColumnAnnotationDefinition.instance(),
- PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
- SecondaryTableAnnotationDefinition.instance(),
- SecondaryTablesAnnotationDefinition.instance(),
- SequenceGenerator2_0AnnotationDefinition.instance(),
- TableAnnotationDefinition.instance(),
- TableGeneratorAnnotationDefinition.instance()
- };
-
- @Override
- protected void addTypeMappingAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, TYPE_MAPPING_ANNOTATION_DEFINITIONS);
- }
-
- protected static final AnnotationDefinition[] TYPE_MAPPING_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
- EmbeddableAnnotationDefinition.instance(),
- EntityAnnotationDefinition.instance(),
- MappedSuperclassAnnotationDefinition.instance()
- };
-
- @Override
- protected void addAttributeAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, ATTRIBUTE_ANNOTATION_DEFINITIONS);
- }
-
- protected static final AnnotationDefinition[] ATTRIBUTE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
+ AssociationOverridesAnnotationDefinition.instance(),
Access2_0AnnotationDefinition.instance(),
- AssociationOverride2_0AnnotationDefinition.instance(),
- AssociationOverrides2_0AnnotationDefinition.instance(),
- AttributeOverrideAnnotationDefinition.instance(),
- AttributeOverridesAnnotationDefinition.instance(),
BasicAnnotationDefinition.instance(),
+ Cacheable2_0AnnotationDefinition.instance(),
CollectionTable2_0AnnotationDefinition.instance(),
ColumnAnnotationDefinition.instance(),
+ DiscriminatorColumnAnnotationDefinition.instance(),
+ DiscriminatorValueAnnotationDefinition.instance(),
ElementCollection2_0AnnotationDefinition.instance(),
+ EmbeddableAnnotationDefinition.instance(),
EmbeddedAnnotationDefinition.instance(),
EmbeddedIdAnnotationDefinition.instance(),
+ EntityAnnotationDefinition.instance(),
EnumeratedAnnotationDefinition.instance(),
+ GeneratedAnnotationDefinition.instance(),
GeneratedValueAnnotationDefinition.instance(),
IdAnnotationDefinition.instance(),
- JoinColumnAnnotationDefinition.instance(),
+ IdClassAnnotationDefinition.instance(),
+ InheritanceAnnotationDefinition.instance(),
JoinColumnsAnnotationDefinition.instance(),
JoinTableAnnotationDefinition.instance(),
LobAnnotationDefinition.instance(),
ManyToManyAnnotationDefinition.instance(),
ManyToOneAnnotationDefinition.instance(),
+ MappedSuperclassAnnotationDefinition.instance(),
MapsId2_0AnnotationDefinition.instance(),
MapKeyAnnotationDefinition.instance(),
MapKeyClass2_0AnnotationDefinition.instance(),
MapKeyColumn2_0AnnotationDefinition.instance(),
MapKeyEnumerated2_0AnnotationDefinition.instance(),
- MapKeyJoinColumn2_0AnnotationDefinition.instance(),
MapKeyJoinColumns2_0AnnotationDefinition.instance(),
MapKeyTemporal2_0AnnotationDefinition.instance(),
+ NamedQueriesAnnotationDefinition.instance(),
+ NamedNativeQueriesAnnotationDefinition.instance(),
OneToManyAnnotationDefinition.instance(),
OneToOneAnnotationDefinition.instance(),
OrderByAnnotationDefinition.instance(),
OrderColumn2_0AnnotationDefinition.instance(),
- PrimaryKeyJoinColumnAnnotationDefinition.instance(),
PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
+ SecondaryTablesAnnotationDefinition.instance(),
SequenceGenerator2_0AnnotationDefinition.instance(),
+ StaticMetamodelAnnotationDefinition.instance(),
+ TableAnnotationDefinition.instance(),
TableGeneratorAnnotationDefinition.instance(),
TemporalAnnotationDefinition.instance(),
TransientAnnotationDefinition.instance(),
@@ -185,7 +154,18 @@ public class Generic2_0JpaAnnotationDefinitionProvider
};
@Override
- protected void addPackageAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- // no package annotations
+ protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) {
+ CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS);
}
+
+ protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] {
+ AssociationOverride2_0AnnotationDefinition.instance(),
+ AttributeOverrideAnnotationDefinition.instance(),
+ JoinColumnAnnotationDefinition.instance(),
+ MapKeyJoinColumn2_0AnnotationDefinition.instance(),
+ NamedQuery2_0AnnotationDefinition.instance(),
+ NamedNativeQueryAnnotationDefinition.instance(),
+ PrimaryKeyJoinColumnAnnotationDefinition.instance(),
+ SecondaryTableAnnotationDefinition.instance(),
+ };
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
index fc808c9fa0..6a0db9b94a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,7 +13,7 @@ import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
@@ -37,7 +37,7 @@ public class Generic2_0JpaPlatformFactory
id,
this.buildJpaVersion(),
new GenericJpaFactory2_0(),
- new GenericJpaAnnotationProvider(Generic2_0JpaAnnotationDefinitionProvider.instance()),
+ new JpaAnnotationProvider(Generic2_0JpaAnnotationDefinitionProvider.instance()),
Generic2_0JpaPlatformProvider.instance(),
this.buildJpaPlatformVariation());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
index 12e19f3689..ba5dcfefa7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
@@ -53,7 +53,7 @@ public class GenericJpaDatabaseIdentifierAdapter
if (p == null) {
return null;
}
- Iterator<PersistenceUnit> units = this.getPersistence().persistenceUnits();
+ Iterator<PersistenceUnit> units = this.getPersistence().getPersistenceUnits().iterator();
return (PersistenceUnit2_0) (units.hasNext() ? units.next() : null);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java
index df4d29c664..bcd7e9a919 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.JpaDataSource;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProject.Config;
@@ -57,7 +58,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2
import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
@@ -99,8 +99,8 @@ public class GenericJpaFactory2_0
// ********** Java Context Model **********
@Override
- public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) {
- return new GenericJavaPersistentType2_0(owner, jrpt);
+ public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourceType jrt) {
+ return new GenericJavaPersistentType2_0(owner, jrt);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
index cd49a0e8f0..ecd2df254e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
@@ -21,6 +21,7 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.utility.BodySourceWriter;
import org.eclipse.jpt.common.utility.internal.ClassName;
import org.eclipse.jpt.common.utility.internal.SimpleStack;
@@ -30,11 +31,12 @@ import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.SimpleDateFormat;
@@ -99,7 +101,7 @@ public class GenericMetamodelSynchronizer
*/
protected String buildSource(ICompilationUnit compilationUnit, Map<String, Collection<MetamodelSourceType>> memberTypeTree) throws JavaModelException {
IFile file = (IFile) compilationUnit.getResource();
- JavaResourcePersistentType2_0 genType = this.getJpaProject().getGeneratedMetamodelTopLevelType(file);
+ JavaResourceAbstractType genType = this.getJpaProject().getGeneratedMetamodelTopLevelType(file);
if (genType == null) {
return null; // the file exists, but its source is not a generated metamodel top-level class
}
@@ -113,7 +115,7 @@ public class GenericMetamodelSynchronizer
return newSource;
}
- String date = genType.getGeneratedAnnotation().getDate(); // if we get here, this will be non-empty
+ String date = ((GeneratedAnnotation) genType.getAnnotation(GeneratedAnnotation.ANNOTATION_NAME)).getDate(); // if we get here, this will be non-empty
int dateBegin = oldSource.indexOf(date);
if (dateBegin == -1) {
return null; // hmmm...
@@ -304,7 +306,7 @@ public class GenericMetamodelSynchronizer
pw.printAnnotation("javax.annotation.Generated");
pw.print('(');
pw.print("value=");
- pw.printStringLiteral(JavaResourcePersistentType2_0.METAMODEL_GENERATED_ANNOTATION_VALUE);
+ pw.printStringLiteral(MetamodelSynchronizer.METAMODEL_GENERATED_ANNOTATION_VALUE);
pw.print(", ");
pw.print("date=");
pw.printStringLiteral(format(new Date()));
@@ -341,8 +343,8 @@ public class GenericMetamodelSynchronizer
*/
protected boolean printAttributesOn(BodySourceWriter pw) {
boolean printed = false;
- for (Iterator<ReadOnlyPersistentAttribute> stream = this.sourceType.attributes(); stream.hasNext(); ) {
- this.printAttributeOn(stream.next(), pw);
+ for (ReadOnlyPersistentAttribute att : this.sourceType.getAttributes()) {
+ this.printAttributeOn(att, pw);
printed = true;
}
return printed;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
index 73252c2e87..7f82627bcc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
@@ -15,6 +15,9 @@ import java.util.List;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.Association;
@@ -96,11 +99,8 @@ import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -443,11 +443,11 @@ public abstract class AbstractJavaElementCollectionMapping2_0
}
protected ColumnAnnotation getValueColumnAnnotation() {
- return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ return (ColumnAnnotation) this.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
protected void removeValueColumnAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
@@ -484,7 +484,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
* <code>null</code>, remove <em>all</em> the converter annotations.
*/
protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
- JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
if (adapter != converterAdapter) {
adapter.removeConverterAnnotation(resourceAttribute);
@@ -526,7 +526,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
* adapter. Return <code>null</code> if there are no converter annotations.
*/
protected Association<JavaConverter.Adapter, Annotation> getConverterAnnotation() {
- JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute();
+ JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
if (annotation != null) {
@@ -761,7 +761,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
// ********** map key annotation **********
protected MapKeyAnnotation getMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ return (MapKeyAnnotation) this.getResourceAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
}
protected MapKeyAnnotation getMapKeyAnnotationForUpdate() {
@@ -770,11 +770,11 @@ public abstract class AbstractJavaElementCollectionMapping2_0
}
protected MapKeyAnnotation addMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ return (MapKeyAnnotation) this.getResourceAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
}
protected void removeMapKeyAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
}
protected boolean mapKeyNameTouches(int pos, CompilationUnit astRoot) {
@@ -871,15 +871,15 @@ public abstract class AbstractJavaElementCollectionMapping2_0
// ********** map key class annotation **********
protected MapKeyClass2_0Annotation getMapKeyClassAnnotation() {
- return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ return (MapKeyClass2_0Annotation) this.getResourceAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
}
protected MapKeyClass2_0Annotation addMapKeyClassAnnotation() {
- return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ return (MapKeyClass2_0Annotation) this.getResourceAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
}
protected void removeMapKeyClassAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
}
@@ -898,11 +898,11 @@ public abstract class AbstractJavaElementCollectionMapping2_0
}
protected MapKeyColumn2_0Annotation getMapKeyColumnAnnotation() {
- return (MapKeyColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+ return (MapKeyColumn2_0Annotation) this.getResourceAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
}
protected void removeMapKeyColumnAnnotation() {
- this.getResourcePersistentAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
}
@@ -1320,8 +1320,8 @@ public abstract class AbstractJavaElementCollectionMapping2_0
*/
protected abstract class AbstractOwner
{
- public JavaResourcePersistentMember getResourcePersistentMember() {
- return AbstractJavaElementCollectionMapping2_0.this.getResourcePersistentAttribute();
+ public JavaResourceMember getResourceMember() {
+ return AbstractJavaElementCollectionMapping2_0.this.getResourceAttribute();
}
public TypeMapping getTypeMapping() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
index 3d5e0db070..5b8595bab7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* Java cacheable
@@ -116,7 +116,7 @@ public class GenericJavaCacheable2_0
* Return <code>null</code> if the annotation does not exists.
*/
protected Cacheable2_0Annotation getCacheableAnnotation() {
- return (Cacheable2_0Annotation) this.getResourcePersistentType().getAnnotation(this.getCacheableAnnotationName());
+ return (Cacheable2_0Annotation) this.getJavaResourceType().getAnnotation(this.getCacheableAnnotationName());
}
/**
@@ -128,11 +128,11 @@ public class GenericJavaCacheable2_0
}
protected Cacheable2_0Annotation buildCacheableAnnotation() {
- return (Cacheable2_0Annotation) this.getResourcePersistentType().addAnnotation(this.getCacheableAnnotationName());
+ return (Cacheable2_0Annotation) this.getJavaResourceType().addAnnotation(this.getCacheableAnnotationName());
}
protected void removeCacheableAnnotation() {
- this.getResourcePersistentType().removeAnnotation(this.getCacheableAnnotationName());
+ this.getJavaResourceType().removeAnnotation(this.getCacheableAnnotationName());
}
protected String getCacheableAnnotationName() {
@@ -151,8 +151,8 @@ public class GenericJavaCacheable2_0
return this.getParent();
}
- protected JavaResourcePersistentType getResourcePersistentType() {
- return this.getCacheableHolder().getResourcePersistentType();
+ protected JavaResourceType getJavaResourceType() {
+ return this.getCacheableHolder().getJavaResourceType();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
index 4edfdadcfb..92cac35863 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
@@ -54,12 +54,12 @@ public class GenericJavaCollectionTable2_0
@Override
public CollectionTable2_0Annotation getTableAnnotation() {
- return (CollectionTable2_0Annotation) this.getElementCollectionMapping().getResourcePersistentAttribute().getNonNullAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME);
+ return (CollectionTable2_0Annotation) this.getElementCollectionMapping().getResourceAttribute().getNonNullAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME);
}
@Override
protected void removeTableAnnotation() {
- this.getElementCollectionMapping().getResourcePersistentAttribute().removeAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME);
+ this.getElementCollectionMapping().getResourceAttribute().removeAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME);
}
@@ -167,8 +167,8 @@ public class GenericJavaCollectionTable2_0
return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getPersistentAttribute();
}
- public int joinColumnsSize() {
- return GenericJavaCollectionTable2_0.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericJavaCollectionTable2_0.this.getJoinColumnsSize();
}
public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
index 3a49304c91..bdd4cd8ed6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
@@ -11,13 +11,13 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -105,8 +105,8 @@ public class GenericJavaIdDerivedIdentityStrategy2_0
return this.getDerivedIdentity().getMapping();
}
- protected JavaResourcePersistentAttribute getResourceAttribute() {
- return this.getMapping().getPersistentAttribute().getResourcePersistentAttribute();
+ protected JavaResourceAttribute getResourceAttribute() {
+ return this.getMapping().getPersistentAttribute().getResourceAttribute();
}
public boolean isSpecified() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
index 37822cefe2..66b865e88e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
@@ -38,7 +39,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -172,8 +172,8 @@ public class GenericJavaMapsIdDerivedIdentityStrategy2_0
return this.getMapping().getPersistentAttribute();
}
- protected JavaResourcePersistentAttribute getResourceAttribute() {
- return this.getPersistentAttribute().getResourcePersistentAttribute();
+ protected JavaResourceAttribute getResourceAttribute() {
+ return this.getPersistentAttribute().getResourceAttribute();
}
protected Iterable<AttributeMapping> getAllAttributeMappings() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
index b767f7f081..586c676820 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
@@ -9,13 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* Java order column
@@ -73,7 +73,7 @@ public class GenericJavaOrderColumn2_0
public OrderColumn2_0Annotation getColumnAnnotation() {
// hmmmm...
return this.isJpa2_0Compatible() ?
- (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME) :
+ (OrderColumn2_0Annotation) this.getResourceAttribute().getNonNullAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME) :
this.getNullColumnAnnotation();
}
@@ -86,13 +86,13 @@ public class GenericJavaOrderColumn2_0
protected OrderColumn2_0Annotation buildNullColumnAnnotation() {
// hmmmm...
- return (OrderColumn2_0Annotation) OrderColumn2_0AnnotationDefinition.instance().buildNullAnnotation(this.getResourcePersistentAttribute());
+ return (OrderColumn2_0Annotation) OrderColumn2_0AnnotationDefinition.instance().buildNullAnnotation(this.getResourceAttribute());
}
@Override
protected void removeColumnAnnotation() {
if (this.isJpa2_0Compatible()) {
- this.getResourcePersistentAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
+ this.getResourceAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
} else {
throw new IllegalStateException();
}
@@ -239,8 +239,8 @@ public class GenericJavaOrderColumn2_0
return this.getParent();
}
- protected JavaResourcePersistentAttribute getResourcePersistentAttribute() {
- return this.getOrderable().getResourcePersistentAttribute();
+ protected JavaResourceAttribute getResourceAttribute() {
+ return this.getOrderable().getResourceAttribute();
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
index 4c125250bb..65f5e159f3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,16 +10,14 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
import java.util.Collection;
-import java.util.ListIterator;
import java.util.Map;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.BodySourceWriter;
import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* JPA 2.0 Java persistent type.
@@ -34,8 +32,8 @@ public class GenericJavaPersistentType2_0
protected final MetamodelSourceType.Synchronizer metamodelSynchronizer;
- public GenericJavaPersistentType2_0(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
- super(parent, jrpt);
+ public GenericJavaPersistentType2_0(PersistentType.Owner parent, JavaResourceType jrt) {
+ super(parent, jrt);
this.declaringTypeName = this.buildDeclaringTypeName();
this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
}
@@ -50,15 +48,6 @@ public class GenericJavaPersistentType2_0
}
- // ********** attributes **********
-
- // suppress type-safety warning
- @Override
- public ListIterator<JavaPersistentAttribute> attributes() {
- return super.attributes();
- }
-
-
// ********** declaring type name **********
public String getDeclaringTypeName() {
@@ -72,7 +61,7 @@ public class GenericJavaPersistentType2_0
}
protected String buildDeclaringTypeName() {
- return this.resourcePersistentType.getDeclaringTypeName();
+ return this.resourceType.getDeclaringTypeName();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
index dbfa04907e..44e10d41b3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
@@ -18,19 +18,18 @@ import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
@@ -66,7 +65,7 @@ public class JavaElementCollectionMappingDefinition2_0
}
public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
}
public Iterable<String> getSupportingAnnotationNames() {
@@ -75,9 +74,9 @@ public class JavaElementCollectionMappingDefinition2_0
private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
AssociationOverrideAnnotation.ANNOTATION_NAME,
- AssociationOverridesAnnotation.ANNOTATION_NAME,
+ JPA.ASSOCIATION_OVERRIDES,
AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME,
+ JPA.ATTRIBUTE_OVERRIDES,
CollectionTable2_0Annotation.ANNOTATION_NAME,
ColumnAnnotation.ANNOTATION_NAME,
EnumeratedAnnotation.ANNOTATION_NAME,
@@ -87,7 +86,7 @@ public class JavaElementCollectionMappingDefinition2_0
MapKeyColumn2_0Annotation.ANNOTATION_NAME,
MapKeyEnumerated2_0Annotation.ANNOTATION_NAME,
MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME,
- MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME,
+ JPA2_0.MAP_KEY_JOIN_COLUMNS,
MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
OrderByAnnotation.ANNOTATION_NAME,
OrderColumn2_0Annotation.ANNOTATION_NAME,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
index 6658feab1b..16e8e5e6e7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefiniti
import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition;
import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
public class JavaEmbeddedMappingDefinition2_0
extends DefaultJavaAttributeMappingDefinitionWrapper
@@ -52,7 +52,7 @@ public class JavaEmbeddedMappingDefinition2_0
private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
AssociationOverrideAnnotation.ANNOTATION_NAME,
- AssociationOverridesAnnotation.ANNOTATION_NAME,
+ JPA.ASSOCIATION_OVERRIDES,
};
public static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
index 0b661a5c33..c122b0950d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
@@ -14,15 +14,15 @@ import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
public class JavaManyToManyMappingDefinition2_0
extends JavaAttributeMappingDefinitionWrapper
@@ -59,12 +59,12 @@ public class JavaManyToManyMappingDefinition2_0
public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME,
+ JPA.ATTRIBUTE_OVERRIDES,
MapKeyClass2_0Annotation.ANNOTATION_NAME,
MapKeyColumn2_0Annotation.ANNOTATION_NAME,
MapKeyEnumerated2_0Annotation.ANNOTATION_NAME,
MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME,
- MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME,
+ JPA2_0.MAP_KEY_JOIN_COLUMNS,
MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
OrderColumn2_0Annotation.ANNOTATION_NAME
};
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
index 86f6666067..f933e6cce9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
@@ -14,15 +14,15 @@ import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
public class JavaOneToManyMappingDefinition2_0
extends JavaAttributeMappingDefinitionWrapper
@@ -59,12 +59,12 @@ public class JavaOneToManyMappingDefinition2_0
private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
AttributeOverrideAnnotation.ANNOTATION_NAME,
- AttributeOverridesAnnotation.ANNOTATION_NAME,
+ JPA.ATTRIBUTE_OVERRIDES,
MapKeyClass2_0Annotation.ANNOTATION_NAME,
MapKeyColumn2_0Annotation.ANNOTATION_NAME,
MapKeyEnumerated2_0Annotation.ANNOTATION_NAME,
MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME,
- MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME,
+ JPA2_0.MAP_KEY_JOIN_COLUMNS,
MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
OrderColumn2_0Annotation.ANNOTATION_NAME
};
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
index 9086e148a1..59eacabc11 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
@@ -35,7 +35,7 @@ public class NullJavaMapKeyColumn2_0
// ********** column annotation **********
public ColumnAnnotation getColumnAnnotation() {
- return (ColumnAnnotation) this.getParent().getPersistentAttribute().getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
+ return (ColumnAnnotation) this.getParent().getPersistentAttribute().getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
index 62b9f779e2..e6f4d9f4c2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
@@ -191,8 +191,8 @@ public class GenericOrmCollectionTable2_0
return GenericOrmCollectionTable2_0.this.getPersistentAttribute();
}
- public int joinColumnsSize() {
- return GenericOrmCollectionTable2_0.this.joinColumnsSize();
+ public int getJoinColumnsSize() {
+ return GenericOrmCollectionTable2_0.this.getJoinColumnsSize();
}
protected OrmElementCollectionMapping2_0 getElementCollectionMapping() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
index 0e3e95e81d..86549e3f5c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAccess2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAccess2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
/**
* javax.persistence.Access
@@ -44,19 +42,18 @@ public final class Access2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceAccess2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ return new SourceAccess2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullAccess2_0Annotation((JavaResourcePersistentMember) parent);
+ return new NullAccess2_0Annotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryAccess2_0Annotation((JavaResourcePersistentMember) parent, jdtAnnotation);
+ return new BinaryAccess2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return Access2_0Annotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
index 12d1fe772f..c6af80ab76 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,29 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverride2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverride2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.AssociationOverride
*/
public final class AssociationOverride2_0AnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new AssociationOverride2_0AnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new AssociationOverride2_0AnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -43,20 +41,24 @@ public final class AssociationOverride2_0AnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return SourceAssociationOverride2_0Annotation.buildAssociationOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement);
- }
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceAssociationOverride2_0Annotation.buildSourceAssociationOverrideAnnotation(parent, annotatedElement, index);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
return new BinaryAssociationOverride2_0Annotation(parent, jdtAnnotation);
}
- public String getAnnotationName() {
- return AssociationOverrideAnnotation.ANNOTATION_NAME;
+ public String getNestableAnnotationName() {
+ return JPA.ASSOCIATION_OVERRIDE;
+ }
+
+ public String getContainerAnnotationName() {
+ return JPA.ASSOCIATION_OVERRIDES;
}
+ public String getElementName() {
+ return JPA.ASSOCIATION_OVERRIDES__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java
deleted file mode 100644
index 87eaa59f93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverrides2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverrides2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public final class AssociationOverrides2_0AnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new AssociationOverrides2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AssociationOverrides2_0AnnotationDefinition() {
- super();
- }
-
- public AssociationOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceAssociationOverrides2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
- }
-
- public AssociationOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryAssociationOverrides2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return AssociationOverridesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
index 0e99636386..b46f96c619 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCacheable2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCacheable2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Cacheable
@@ -44,7 +42,7 @@ public final class Cacheable2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceCacheable2_0Annotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceCacheable2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class Cacheable2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryCacheable2_0Annotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryCacheable2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return Cacheable2_0Annotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
index 34710f0028..d898e2e2bd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCollectionTable2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCollectionTable2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.CollectionTable
@@ -44,7 +42,7 @@ public final class CollectionTable2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceCollectionTable2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceCollectionTable2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class CollectionTable2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryCollectionTable2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryCollectionTable2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return CollectionTable2_0Annotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
index 3d99fe6c92..1606cb9293 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryElementCollection2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceElementCollection2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.ElementCollection
@@ -44,7 +42,7 @@ public final class ElementCollection2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceElementCollection2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class ElementCollection2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryElementCollection2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return ElementCollection2_0Annotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
index 5b897d1620..347b781d01 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,20 +10,15 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryGeneratedAnnotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceGeneratedAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.annotation.Generated
- * <p>
- * This annotation definition is not really required; it's just here for a bit
- * of consistency....
*/
public final class GeneratedAnnotationDefinition
implements AnnotationDefinition
@@ -46,7 +41,7 @@ public final class GeneratedAnnotationDefinition
}
public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceGeneratedAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceGeneratedAnnotation(parent, annotatedElement);
}
public GeneratedAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -54,11 +49,10 @@ public final class GeneratedAnnotationDefinition
}
public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryGeneratedAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryGeneratedAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return GeneratedAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
index 37b7e18382..2b6168c2ec 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyClass2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyClass2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyClass
@@ -44,7 +42,7 @@ public final class MapKeyClass2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceMapKeyClass2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceMapKeyClass2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class MapKeyClass2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyClass2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryMapKeyClass2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return MapKeyClass2_0Annotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
index 53a40c8fcf..9cb89d9c70 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyColumn
@@ -44,7 +42,7 @@ public final class MapKeyColumn2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceMapKeyColumn2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceMapKeyColumn2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class MapKeyColumn2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyColumn2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryMapKeyColumn2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return MapKeyColumn2_0Annotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
index 6ba277bdc2..f529e3baa5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyEnumerated2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyEnumerated2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyTemporal
@@ -44,15 +42,15 @@ public final class MapKeyEnumerated2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceMapKeyEnumerated2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent);
+ return new NullMapKeyEnumerated2_0Annotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryMapKeyEnumerated2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
index c943113e00..94d71a1a50 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,27 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyJoinColumn2_0Annotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
/**
* javax.persistence.MapKeyJoinColumn
*/
public final class MapKeyJoinColumn2_0AnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new MapKeyJoinColumn2_0AnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new MapKeyJoinColumn2_0AnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -41,20 +41,23 @@ public final class MapKeyJoinColumn2_0AnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return SourceMapKeyJoinColumn2_0Annotation.createMapKeyJoinColumn(parent, (Attribute) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceMapKeyJoinColumn2_0Annotation.buildSourceMapKeyJoinColumnAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinaryMapKeyJoinColumn2_0Annotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyJoinColumn2_0Annotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN;
}
- public String getAnnotationName() {
- return MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMNS;
}
+ public String getElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
index 23ddfdc204..34b7b7c09b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
/**
* javax.persistence.MapKeyJoinColumns
@@ -42,20 +41,20 @@ public final class MapKeyJoinColumns2_0AnnotationDefinition
super();
}
- public MapKeyJoinColumns2_0Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceMapKeyJoinColumns2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
}
- public MapKeyJoinColumns2_0Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
throw new UnsupportedOperationException();
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyJoinColumns2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
}
public String getAnnotationName() {
- return MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME;
+ return JPA2_0.MAP_KEY_JOIN_COLUMNS;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
index 4539b09588..7275995d17 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 201 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyTemporal2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyTemporal2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyTemporal
@@ -44,15 +42,15 @@ public final class MapKeyTemporal2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceMapKeyTemporal2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent);
+ return new NullMapKeyTemporal2_0Annotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryMapKeyTemporal2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
index a597251aee..2f4c550557 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
+ * Copyright (c) 2009, 2011 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -11,16 +11,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapsId2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapsId2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
/**
* javax.persistence.MapsId
@@ -48,15 +45,15 @@ public class MapsId2_0AnnotationDefinition implements AnnotationDefinition
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceMapsId2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceMapsId2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullMapsId2_0Annotation((JavaResourcePersistentMember) parent);
+ return new NullMapsId2_0Annotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapsId2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryMapsId2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java
deleted file mode 100644
index 888cc8e2a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQueries2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQueries2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
-
-/**
- * javax.persistence.NamedQueries
- */
-public class NamedQueries2_0AnnotationDefinition
- implements AnnotationDefinition
-{
- // singleton
- private static final AnnotationDefinition INSTANCE = new NamedQueries2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static AnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NamedQueries2_0AnnotationDefinition() {
- super();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedQueries2_0Annotation(parent, (Type) annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedQueries2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return NamedQueriesAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
index 86ba2b97c6..1890065719 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,28 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQuery2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQuery2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.NamedQuery
*/
public class NamedQuery2_0AnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new NamedQuery2_0AnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new NamedQuery2_0AnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -42,20 +41,23 @@ public class NamedQuery2_0AnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedQuery2_0Annotation(parent, (Type) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceNamedQuery2_0Annotation.buildSourceNamedQueryAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinaryNamedQuery2_0Annotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedQuery2_0Annotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA.NAMED_QUERY;
}
- public String getAnnotationName() {
- return NamedQueryAnnotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA.NAMED_QUERIES;
}
+ public String getElementName() {
+ return JPA.NAMED_QUERIES__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
index 2aa8b84300..2e79bebb33 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,11 +10,11 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
/**
* <code>javax.persistence.Access</code>
@@ -24,7 +24,7 @@ public final class NullAccess2_0Annotation
implements Access2_0Annotation
{
- protected NullAccess2_0Annotation(JavaResourcePersistentMember parent) {
+ protected NullAccess2_0Annotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
index eba00c41e3..8d92f4a687 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,12 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseTableAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
/**
@@ -33,11 +32,11 @@ public final class NullCollectionTable2_0Annotation
}
// ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return EmptyListIterator.instance();
+ public ListIterable<JoinColumnAnnotation> getJoinColumns() {
+ return EmptyListIterable.instance();
}
- public int joinColumnsSize() {
+ public int getJoinColumnsSize() {
return 0;
}
@@ -45,10 +44,6 @@ public final class NullCollectionTable2_0Annotation
return null;
}
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- throw new UnsupportedOperationException();
- }
-
public JoinColumnAnnotation addJoinColumn(int index) {
// the CollectionTable annotation is missing, add both it and a join column at the same time
return this.addAnnotation().addJoinColumn(index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
index 6a4b869bbe..7eac37b7ea 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <code>javax.persistence.MapKeyColumn</code>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
index c9eaf62795..62d1125de5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,11 +10,11 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.EnumType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* <code>javax.persistence.MapKeyEnumerated</code>
@@ -23,7 +23,7 @@ public final class NullMapKeyEnumerated2_0Annotation
extends NullAnnotation<MapKeyEnumerated2_0Annotation>
implements MapKeyEnumerated2_0Annotation
{
- protected NullMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent) {
+ protected NullMapKeyEnumerated2_0Annotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
index 2a8a676aba..25971b4410 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
/**
@@ -23,7 +23,7 @@ public final class NullMapKeyTemporal2_0Annotation
extends NullAnnotation<MapKeyTemporal2_0Annotation>
implements MapKeyTemporal2_0Annotation
{
- protected NullMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent) {
+ protected NullMapKeyTemporal2_0Annotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
index 0dcf181809..89553a2ed0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
/**
* <code>javax.persistence.MapsId</code>
@@ -22,7 +22,7 @@ public final class NullMapsId2_0Annotation
extends NullAnnotation<MapsId2_0Annotation>
implements MapsId2_0Annotation
{
- protected NullMapsId2_0Annotation(JavaResourcePersistentMember parent) {
+ protected NullMapsId2_0Annotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
index ca2a7b5123..c74886dec1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.internal.resource.java.NullNamedColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* <code>javax.persistence.OrderColumn</code>
@@ -22,7 +22,7 @@ public final class NullOrderColumn2_0Annotation
extends NullNamedColumnAnnotation<OrderColumn2_0Annotation>
implements OrderColumn2_0Annotation
{
- public NullOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent) {
+ public NullOrderColumn2_0Annotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
index 91ff5ae6fc..d43bcb3c79 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryOrderColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceOrderColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.OrderColumn
@@ -44,19 +42,18 @@ public final class OrderColumn2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceOrderColumn2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent);
+ return new NullOrderColumn2_0Annotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryOrderColumn2_0Annotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return OrderColumn2_0Annotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
index 513678f78d..780423fae5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinarySequenceGenerator2_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceSequenceGenerator2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
/**
@@ -44,7 +42,7 @@ public final class SequenceGenerator2_0AnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceSequenceGenerator2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ return new SourceSequenceGenerator2_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -58,5 +56,4 @@ public final class SequenceGenerator2_0AnnotationDefinition
public String getAnnotationName() {
return SequenceGeneratorAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java
deleted file mode 100644
index 1d1d2289a2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-
-/**
- * <code>javax.persistence.MapKeyJoinColumn</code>
- */
-public final class SourceMapKeyJoinColumn2_0Annotation
- extends SourceBaseJoinColumnAnnotation
- implements NestableMapKeyJoinColumnAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, attribute, daa, annotationAdapter);
- }
-
- public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
- this(parent, attribute, daa, new ElementAnnotationAdapter(attribute, daa));
- }
-
- public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, attribute, idaa, new ElementIndexedAnnotationAdapter(attribute, idaa));
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ********** SourceNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** SourceBaseColumnAnnotation implementation **********
-
- @Override
- protected String getTableElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE;
- }
-
- @Override
- protected String getUniqueElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE;
- }
-
- @Override
- protected String getNullableElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE;
- }
-
- @Override
- protected String getInsertableElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE;
- }
-
- @Override
- protected String getUpdatableElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE;
- }
-
-
- // ********** SourceBaseJoinColumnAnnotation implementation **********
-
- @Override
- protected String getReferencedColumnNameElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- }
-
-
- // ********** static methods **********
-
- public static SourceMapKeyJoinColumn2_0Annotation createMapKeyJoinColumn(JavaResourceNode parent, Attribute attribute) {
- return new SourceMapKeyJoinColumn2_0Annotation(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- static SourceMapKeyJoinColumn2_0Annotation createNestedMapKeyJoinColumn(JavaResourceNode parent, Attribute attribute, int index, DeclarationAnnotationAdapter joinColumnsAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(attribute, idaa);
- return new SourceMapKeyJoinColumn2_0Annotation(parent, attribute, idaa, annotationAdapter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java
deleted file mode 100644
index c538288cb1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * <code>javax.persistence.MapKeyJoinColumns</code>
- */
-public final class SourceMapKeyJoinColumns2_0Annotation
- extends SourceAnnotation<Attribute>
- implements MapKeyJoinColumns2_0Annotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableMapKeyJoinColumnAnnotation> mapKeyJoinColumns = new Vector<NestableMapKeyJoinColumnAnnotation>();
-
-
- public SourceMapKeyJoinColumns2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- AnnotationContainerTools.synchronize(this, astRoot);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.mapKeyJoinColumns.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.mapKeyJoinColumns);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE;
- }
-
- public String getNestedAnnotationName() {
- return MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableMapKeyJoinColumnAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableMapKeyJoinColumnAnnotation>(this.mapKeyJoinColumns);
- }
-
- public int getNestedAnnotationsSize() {
- return this.mapKeyJoinColumns.size();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.nestStandAloneAnnotation(standAloneAnnotation, this.mapKeyJoinColumns.size());
- }
-
- private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
- standAloneAnnotation.convertToNested(this, this.daa, index);
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- this.mapKeyJoinColumns.add(index, (NestableMapKeyJoinColumnAnnotation) annotation);
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- this.mapKeyJoinColumns.remove(0).convertToStandAlone();
- }
-
- public NestableMapKeyJoinColumnAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.mapKeyJoinColumns.size());
- }
-
- private NestableMapKeyJoinColumnAnnotation addNestedAnnotation(int index) {
- NestableMapKeyJoinColumnAnnotation joinColumn = this.buildMapKeyJoinColumn(index);
- this.mapKeyJoinColumns.add(index, joinColumn);
- return joinColumn;
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- int index = this.mapKeyJoinColumns.size();
- NestableMapKeyJoinColumnAnnotation joinColumn = this.addNestedAnnotation(index);
- joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(MAP_KEY_JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- private NestableMapKeyJoinColumnAnnotation buildMapKeyJoinColumn(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceMapKeyJoinColumn2_0Annotation.createNestedMapKeyJoinColumn(this.parent, this.annotatedElement, index, this.daa);
- }
-
- public NestableMapKeyJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.mapKeyJoinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public NestableMapKeyJoinColumnAnnotation removeNestedAnnotation(int index) {
- return this.mapKeyJoinColumns.remove(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.mapKeyJoinColumns, MAP_KEY_JOIN_COLUMNS_LIST);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
index b88a0b18bc..78cd576c44 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,20 +10,15 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryStaticMetamodelAnnotation;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceStaticMetamodelAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.metamodel.StaticMetamodel
- * <p>
- * This annotation definition is not really required; it's just here for a bit
- * of consistency....
*/
public final class StaticMetamodelAnnotationDefinition
implements AnnotationDefinition
@@ -46,7 +41,7 @@ public final class StaticMetamodelAnnotationDefinition
}
public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceStaticMetamodelAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceStaticMetamodelAnnotation(parent, annotatedElement);
}
public StaticMetamodelAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -54,11 +49,10 @@ public final class StaticMetamodelAnnotationDefinition
}
public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryStaticMetamodelAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryStaticMetamodelAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return StaticMetamodelAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
index ee01d96507..cf8d13cf81 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,12 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
/**
* javax.persistence.Access
@@ -28,7 +28,7 @@ public final class BinaryAccess2_0Annotation
private AccessType value;
- public BinaryAccess2_0Annotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ public BinaryAccess2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.value = this.buildValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
index eb213548d2..ea89f2b714 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java
deleted file mode 100644
index e2877de83d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public class BinaryAssociationOverrides2_0Annotation
- extends BinaryAssociationOverridesAnnotation
-{
-
- public BinaryAssociationOverrides2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- @Override
- protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) {
- return new BinaryAssociationOverride2_0Annotation(this, (IAnnotation) jdtAssociationOverride);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
index 3702c2ec5f..aa1a5d0219 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Cacheable
@@ -27,7 +27,7 @@ public final class BinaryCacheable2_0Annotation
private Boolean value;
- public BinaryCacheable2_0Annotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryCacheable2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.value = this.buildValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
index 324ac63515..00024b61cb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,16 +9,15 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTableAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
/**
@@ -31,7 +30,7 @@ public final class BinaryCollectionTable2_0Annotation
private final Vector<JoinColumnAnnotation> joinColumns;
- public BinaryCollectionTable2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryCollectionTable2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.joinColumns = this.buildJoinColumns();
}
@@ -73,11 +72,11 @@ public final class BinaryCollectionTable2_0Annotation
// ********** CollectionTable2_0Annotation implementation **********
// ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ public ListIterable<JoinColumnAnnotation> getJoinColumns() {
+ return new LiveCloneListIterable<JoinColumnAnnotation>(this.joinColumns);
}
- public int joinColumnsSize() {
+ public int getJoinColumnsSize() {
return this.joinColumns.size();
}
@@ -85,10 +84,6 @@ public final class BinaryCollectionTable2_0Annotation
return this.joinColumns.get(index);
}
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
public JoinColumnAnnotation addJoinColumn(int index) {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
index b4774b3c3c..256fa2a562 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,12 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* org.eclipse.persistence.annotations.Transformation
@@ -29,7 +29,7 @@ public class BinaryElementCollection2_0Annotation
private FetchType fetch;
- public BinaryElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryElementCollection2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.targetClass = this.buildTargetClass();
this.fetch = this.buildFetch();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
index 798b809e9e..a8427a3af8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,14 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.annotation.Generated
@@ -30,7 +29,7 @@ public final class BinaryGeneratedAnnotation
private String comments;
- public BinaryGeneratedAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryGeneratedAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.values = this.buildValues();
this.date = this.buildDate();
@@ -58,11 +57,11 @@ public final class BinaryGeneratedAnnotation
// ********** GeneratedAnnotation implementation **********
// ***** values
- public ListIterator<String> values() {
- return new CloneListIterator<String>(this.values);
+ public ListIterable<String> getValues() {
+ return new LiveCloneListIterable<String>(this.values);
}
- public int valuesSize() {
+ public int getValuesSize() {
return this.values.size();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
index e20a405b5c..591ebbb90c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyClass
@@ -27,7 +27,7 @@ public final class BinaryMapKeyClass2_0Annotation
private String value;
- public BinaryMapKeyClass2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryMapKeyClass2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.value = this.buildValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
index f2a2415614..751e2a04b2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryCompleteColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyColumn
@@ -23,7 +23,7 @@ public final class BinaryMapKeyColumn2_0Annotation
implements MapKeyColumn2_0Annotation
{
- public BinaryMapKeyColumn2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryMapKeyColumn2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
index 39f3229e74..5c838e012b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseEnumeratedAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyEnumerated
@@ -23,7 +23,7 @@ public final class BinaryMapKeyEnumerated2_0Annotation
implements MapKeyEnumerated2_0Annotation
{
- public BinaryMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryMapKeyEnumerated2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
index c4d25d3ed2..9a088faadc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,17 +10,17 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
/**
* javax.persistence.MapKeyJoinColumn
*/
public final class BinaryMapKeyJoinColumn2_0Annotation
extends BinaryBaseJoinColumnAnnotation
- implements NestableMapKeyJoinColumnAnnotation
+ implements MapKeyJoinColumn2_0Annotation
{
public BinaryMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java
deleted file mode 100644
index 2622efab7c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryContainerAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-
-/**
- * javax.persistence.MapKeyJoinColumns
- */
-public final class BinaryMapKeyJoinColumns2_0Annotation
- extends BinaryContainerAnnotation<NestableMapKeyJoinColumnAnnotation>
- implements MapKeyJoinColumns2_0Annotation
-{
- private final Vector<NestableMapKeyJoinColumnAnnotation> mapKeyJoinColumns;
-
-
- public BinaryMapKeyJoinColumns2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.mapKeyJoinColumns = this.buildMapKeyJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public Iterable<NestableMapKeyJoinColumnAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableMapKeyJoinColumnAnnotation>(this.mapKeyJoinColumns);
- }
-
- public int getNestedAnnotationsSize() {
- return this.mapKeyJoinColumns.size();
- }
-
- private Vector<NestableMapKeyJoinColumnAnnotation> buildMapKeyJoinColumns() {
- Object[] jdtMapKeyJoinColumns = this.getJdtMemberValues(JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE);
- Vector<NestableMapKeyJoinColumnAnnotation> result = new Vector<NestableMapKeyJoinColumnAnnotation>(jdtMapKeyJoinColumns.length);
- for (Object jdtMapKeyJoinColumn : jdtMapKeyJoinColumns) {
- result.add(new BinaryMapKeyJoinColumn2_0Annotation(this, (IAnnotation) jdtMapKeyJoinColumn));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateMapKeyJoinColumns();
- }
-
- // TODO
- private void updateMapKeyJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
index 1c5b97b821..72ff920a1c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTemporalAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyTemporal
@@ -23,7 +23,7 @@ public final class BinaryMapKeyTemporal2_0Annotation
implements MapKeyTemporal2_0Annotation
{
- public BinaryMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryMapKeyTemporal2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
index c7d7e03c05..c3b700c917 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
+ * Copyright (c) 2009, 2011 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -12,11 +12,11 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapsId
@@ -28,7 +28,7 @@ public class BinaryMapsId2_0Annotation
private String value;
- public BinaryMapsId2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryMapsId2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.value = this.buildValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java
deleted file mode 100644
index b6270a6eb5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
-
-/**
- * javax.persistence.NamedQueries
- */
-public final class BinaryNamedQueries2_0Annotation
- extends BinaryNamedQueriesAnnotation
-{
- public BinaryNamedQueries2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- @Override
- protected NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery) {
- return new BinaryNamedQuery2_0Annotation(this, (IAnnotation) jdtQuery);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
index 83e2f3e112..baf9d643a6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,12 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* BinaryNamedQuery2_0Annotation
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
index 446297a6a6..a7ecfee5bd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.OrderColumn
@@ -29,7 +29,7 @@ public class BinaryOrderColumn2_0Annotation
private Boolean updatable;
- public BinaryOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryOrderColumn2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.nullable = this.buildNullable();
this.insertable = this.buildInsertable();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
index b9b94ad58d..9ccb8ee0a9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* BinarySequenceGenerator2_0Annotation
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
index 3f30009013..417f94a781 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.metamodel.StaticMetamodel
@@ -25,7 +25,7 @@ public final class BinaryStaticMetamodelAnnotation
private String value;
- public BinaryStaticMetamodelAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryStaticMetamodelAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.value = this.buildValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
index 4b8790b08b..15375658fc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,25 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
/**
* javax.persistence.Access
*/
public final class SourceAccess2_0Annotation
- extends SourceAnnotation<Member>
+ extends SourceAnnotation
implements Access2_0Annotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -38,9 +38,9 @@ public final class SourceAccess2_0Annotation
private AccessType value;
- public SourceAccess2_0Annotation(JavaResourcePersistentMember parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(member, VALUE_ADAPTER);
+ public SourceAccess2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
index 9ea428b84a..cf1e98cdcf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,24 +9,23 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
-import java.util.HashMap;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NullAssociationOverrideJoinTableAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
/**
@@ -40,9 +39,53 @@ public final class SourceAssociationOverride2_0Annotation
private JoinTableAnnotation joinTable;
private final JoinTableAnnotation nullJoinTable;
-
- public SourceAssociationOverride2_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+
+ public static SourceAssociationOverride2_0Annotation buildSourceAssociationOverrideAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element) {
+
+ return new SourceAssociationOverride2_0Annotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public static SourceAssociationOverride2_0Annotation buildSourceAssociationOverrideAnnotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement annotatedElement,
+ int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildAssociationOverrideDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildAssociationOverrideAnnotationAdapter(annotatedElement, idaa);
+ return new SourceAssociationOverride2_0Annotation(
+ parent,
+ annotatedElement,
+ idaa,
+ iaa);
+ }
+
+ public static SourceAssociationOverride2_0Annotation buildNestedSourceAssociationOverrideAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ return new SourceAssociationOverride2_0Annotation(parent, element, idaa);
+ }
+
+ private SourceAssociationOverride2_0Annotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ DeclarationAnnotationAdapter daa) {
+
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
+ }
+
+ private SourceAssociationOverride2_0Annotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
+ }
+
+ private SourceAssociationOverride2_0Annotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.joinTableAdapter = this.buildJoinTableAdapter();
this.nullJoinTable = this.buildNullJoinTable();
}
@@ -129,52 +172,14 @@ public final class SourceAssociationOverride2_0Annotation
(this.joinTable == null);
}
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.joinTableAdapter = this.buildJoinTableAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- if (this.joinTable != null) {
- Map<String, Object> joinTableState = new HashMap<String, Object>();
- this.joinTable.storeOn(joinTableState);
- map.put(JOIN_TABLE_PROPERTY, joinTableState);
- this.joinTable = null;
- }
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- @SuppressWarnings("unchecked")
- Map<String, Object> joinTableState = (Map<String, Object>) map.get(JOIN_TABLE_PROPERTY);
- if (joinTableState != null) {
- this.addJoinTable().restoreFrom(joinTableState);
- }
- }
-
// ********** static methods **********
- public static SourceAssociationOverride2_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) {
- return new SourceAssociationOverride2_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
- }
-
- static JoinTableAnnotation buildJoinTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
- return new SourceJoinTableAnnotation(parent, member, buildJoinTableAnnotationAdapter(associationOverrideAnnotationAdapter));
+ static JoinTableAnnotation buildJoinTableAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
+ return new SourceJoinTableAnnotation(parent, element, buildJoinTableAnnotationAdapter(associationOverrideAnnotationAdapter));
}
static DeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
return new NestedDeclarationAnnotationAdapter(associationOverrideAnnotationAdapter, JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE, JPA.JOIN_TABLE);
}
-
-
- static SourceAssociationOverrideAnnotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
- return new SourceAssociationOverride2_0Annotation(parent, member, idaa, annotationAdapter);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java
deleted file mode 100644
index be45b19954..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
-
-/**
- * <code>javax.persistence.AssociationOverrides</code>
- */
-public final class SourceAssociationOverrides2_0Annotation
- extends SourceAssociationOverridesAnnotation
-{
- public SourceAssociationOverrides2_0Annotation(JavaResourceNode parent, Member member) {
- super(parent, member);
- }
-
- @Override
- protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceAssociationOverride2_0Annotation.buildNestedAssociationOverride(this.parent, this.annotatedElement, index, this.daa);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
index f89f48edd4..50ebc6ee75 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,26 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Cacheable
*/
public final class SourceCacheable2_0Annotation
- extends SourceAnnotation<Member>
+ extends SourceAnnotation
implements Cacheable2_0Annotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -39,9 +38,9 @@ public final class SourceCacheable2_0Annotation
private Boolean value;
- public SourceCacheable2_0Annotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(type, VALUE_ADAPTER);
+ public SourceCacheable2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, VALUE_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
index 8243f24a36..713d45078d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,34 +9,22 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTableAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
/**
* <code>javax.persistence.CollectionTable</code>
@@ -54,12 +42,11 @@ public final class SourceCollectionTable2_0Annotation
private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__CATALOG);
- private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
- public SourceCollectionTable2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceCollectionTable2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
@@ -69,13 +56,13 @@ public final class SourceCollectionTable2_0Annotation
@Override
public void initialize(CompilationUnit astRoot) {
super.initialize(astRoot);
- AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot);
+ this.joinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
}
@Override
public void synchronizeWith(CompilationUnit astRoot) {
super.synchronizeWith(astRoot);
- AnnotationContainerTools.synchronize(this.joinColumnsContainer, astRoot);
+ this.joinColumnsContainer.synchronize(this.getAstAnnotation(astRoot));
}
@@ -103,170 +90,72 @@ public final class SourceCollectionTable2_0Annotation
// ********** CollectionTable2_0Annotation implementation **********
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
- }
+ // **************** join columns *************************************************
- Iterable<NestableJoinColumnAnnotation> getNestableJoinColumns() {
- return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
+ public ListIterable<JoinColumnAnnotation> getJoinColumns() {
+ return this.joinColumnsContainer.getNestedAnnotations();
}
- public int joinColumnsSize() {
- return this.joinColumns.size();
+ public int getJoinColumnsSize() {
+ return this.joinColumnsContainer.getNestedAnnotationsSize();
}
- public NestableJoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
+ public JoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumnsContainer.nestedAnnotationAt(index);
}
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
+ public JoinColumnAnnotation addJoinColumn(int index) {
+ return this.joinColumnsContainer.addNestedAnnotation(index);
}
-
- private NestableJoinColumnAnnotation addJoinColumn() {
- return this.addJoinColumn(this.joinColumns.size());
+
+ private JoinColumnAnnotation buildJoinColumn(int index) {
+ return SourceJoinColumnAnnotation.buildNestedSourceJoinColumnAnnotation(
+ this, this.annotatedElement, buildJoinColumnIndexedDeclarationAnnotationAdapter(index));
}
-
- public NestableJoinColumnAnnotation addJoinColumn(int index) {
- return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation addJoinColumn_() {
- return this.addJoinColumn_(this.joinColumns.size());
- }
-
- private NestableJoinColumnAnnotation addJoinColumn_(int index) {
- NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index);
- this.joinColumns.add(index, joinColumn);
- return joinColumn;
- }
-
- void syncAddJoinColumn(Annotation astAnnotation) {
- int index = this.joinColumns.size();
- NestableJoinColumnAnnotation joinColumn = this.addJoinColumn_(index);
- joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- private NestableJoinColumnAnnotation buildJoinColumn(int index) {
- return new SourceJoinColumnAnnotation(this, this.annotatedElement, buildJoinColumnAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildJoinColumnAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- void joinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+
+ private IndexedDeclarationAnnotationAdapter buildJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(
+ this.daa, JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
}
public void moveJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation moveJoinColumn_(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
+ this.joinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
}
public void removeJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation removeJoinColumn_(int index) {
- return this.joinColumns.remove(index);
- }
-
- void syncRemoveJoinColumns(int index) {
- this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.joinColumns.isEmpty();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
-
- List<Map<String, Object>> joinColumnsState = this.buildStateList(this.joinColumns.size());
- for (NestableJoinColumnAnnotation joinColumn : this.getNestableJoinColumns()) {
- Map<String, Object> joinColumnState = new HashMap<String, Object>();
- joinColumn.storeOn(joinColumnState);
- joinColumnsState.add(joinColumnState);
- }
- map.put(JOIN_COLUMNS_LIST, joinColumnsState);
- this.joinColumns.clear();
+ this.joinColumnsContainer.removeNestedAnnotation(index);
}
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> joinColumnsState = (List<Map<String, Object>>) map.get(JOIN_COLUMNS_LIST);
- for (Map<String, Object> joinColumnState : joinColumnsState) {
- this.addJoinColumn().restoreFrom(joinColumnState);
- }
- }
-
-
- // ********** join column container **********
-
+
/**
* adapt the AnnotationContainer interface to the collection table's join columns
*/
- class JoinColumnsAnnotationContainer
- implements AnnotationContainer<NestableJoinColumnAnnotation>
+ class JoinColumnsAnnotationContainer
+ extends AnnotationContainer<JoinColumnAnnotation>
{
- public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
- return SourceCollectionTable2_0Annotation.this.getAstAnnotation(astRoot);
+ @Override
+ protected String getAnnotationsPropertyName() {
+ return JOIN_COLUMNS_LIST;
}
-
- public String getElementName() {
+ @Override
+ protected String getElementName() {
return JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS;
}
-
- public String getNestedAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
- return SourceCollectionTable2_0Annotation.this.getNestableJoinColumns();
- }
-
- public int getNestedAnnotationsSize() {
- return SourceCollectionTable2_0Annotation.this.joinColumnsSize();
- }
-
- public NestableJoinColumnAnnotation addNestedAnnotation() {
- return SourceCollectionTable2_0Annotation.this.addJoinColumn_();
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- SourceCollectionTable2_0Annotation.this.syncAddJoinColumn(astAnnotation);
+ @Override
+ protected String getNestedAnnotationName() {
+ return JPA.JOIN_COLUMN;
}
-
- public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceCollectionTable2_0Annotation.this.moveJoinColumn_(targetIndex, sourceIndex);
+ @Override
+ protected JoinColumnAnnotation buildNestedAnnotation(int index) {
+ return SourceCollectionTable2_0Annotation.this.buildJoinColumn(index);
}
+ }
- public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
- return SourceCollectionTable2_0Annotation.this.removeJoinColumn_(index);
- }
- public void syncRemoveNestedAnnotations(int index) {
- SourceCollectionTable2_0Annotation.this.syncRemoveJoinColumns(index);
- }
+ // ********** misc **********
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.joinColumnsContainer.isEmpty();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
index 3910e85f42..4cd1d19e03 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,29 +10,29 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* org.eclipse.persistence.annotations.Transformation
*/
public final class SourceElementCollection2_0Annotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements ElementCollection2_0Annotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -53,10 +53,10 @@ public final class SourceElementCollection2_0Annotation
private FetchType fetch;
- public SourceElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.targetClassAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, TARGET_CLASS_ADAPTER);
- this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER);
+ public SourceElementCollection2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.targetClassAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, TARGET_CLASS_ADAPTER);
+ this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, FETCH_ADAPTER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
index 4e68a01b21..af81759ef7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,31 +10,29 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import java.util.Arrays;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.annotation.Generated
*/
public final class SourceGeneratedAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements GeneratedAnnotation
{
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -52,8 +50,8 @@ public final class SourceGeneratedAnnotation
private String comments;
- public SourceGeneratedAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceGeneratedAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER);
this.dateAdapter = this.buildAdapter(DATE_ADAPTER);
this.commentsAdapter = this.buildAdapter(COMMENTS_ADAPTER);
@@ -100,11 +98,11 @@ public final class SourceGeneratedAnnotation
// ********** GeneratedAnnotation implementation **********
// ***** values
- public ListIterator<String> values() {
- return new CloneListIterator<String>(this.values);
+ public ListIterable<String> getValues() {
+ return new LiveCloneListIterable<String>(this.values);
}
- public int valuesSize() {
+ public int getValuesSize() {
return this.values.size();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
index ca2f005792..42f7ea3fae 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,26 +10,26 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyClass
*/
public final class SourceMapKeyClass2_0Annotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements MapKeyClass2_0Annotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -46,9 +46,9 @@ public final class SourceMapKeyClass2_0Annotation
private boolean fqClassNameStale = true;
- public SourceMapKeyClass2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ public SourceMapKeyClass2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
index e0ee92ad8f..be914944d3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompleteColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* <code>javax.persistence.MapKeyColumn</code>
@@ -27,8 +27,8 @@ public final class SourceMapKeyColumn2_0Annotation
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
- public SourceMapKeyColumn2_0Annotation(JavaResourcePersistentAttribute parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceMapKeyColumn2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
index 6a6adffa06..76b85cef77 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseEnumeratedAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyEnumerated
@@ -26,8 +26,8 @@ public final class SourceMapKeyEnumerated2_0Annotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyEnumerated2_0Annotation.ANNOTATION_NAME);
- public SourceMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceMapKeyEnumerated2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyJoinColumn2_0Annotation.java
new file mode 100644
index 0000000000..576ad56f5f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyJoinColumn2_0Annotation.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
+
+/**
+ * <code>javax.persistence.MapKeyJoinColumn</code>
+ */
+public final class SourceMapKeyJoinColumn2_0Annotation
+ extends SourceBaseJoinColumnAnnotation
+ implements MapKeyJoinColumn2_0Annotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA2_0.MAP_KEY_JOIN_COLUMNS);
+
+
+ public static SourceMapKeyJoinColumn2_0Annotation buildSourceMapKeyJoinColumnAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element) {
+
+ return new SourceMapKeyJoinColumn2_0Annotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public static SourceMapKeyJoinColumn2_0Annotation buildSourceMapKeyJoinColumnAnnotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement annotatedElement,
+ int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildMapKeyJoinColumnDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildMapKeyJoinColumnAnnotationAdapter(annotatedElement, idaa);
+ return new SourceMapKeyJoinColumn2_0Annotation(
+ parent,
+ annotatedElement,
+ idaa,
+ iaa);
+ }
+
+ public static SourceMapKeyJoinColumn2_0Annotation buildNestedSourceMapKeyJoinColumnAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ return new SourceMapKeyJoinColumn2_0Annotation(parent, element, idaa);
+ }
+
+ private SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
+ }
+
+ private SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
+ }
+
+ private SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ // ********** SourceNamedColumnAnnotation implementation **********
+
+ @Override
+ protected String getNameElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String getColumnDefinitionElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+
+ // ********** SourceBaseColumnAnnotation implementation **********
+
+ @Override
+ protected String getTableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE;
+ }
+
+ @Override
+ protected String getUniqueElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String getNullableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String getInsertableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String getUpdatableElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE;
+ }
+
+
+ // ********** SourceBaseJoinColumnAnnotation implementation **********
+
+ @Override
+ protected String getReferencedColumnNameElementName() {
+ return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
+ }
+
+ // ********** static methods **********
+
+ private static IndexedAnnotationAdapter buildMapKeyJoinColumnAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
+ return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildMapKeyJoinColumnDeclarationAnnotationAdapter(int index) {
+ IndexedDeclarationAnnotationAdapter idaa =
+ new CombinationIndexedDeclarationAnnotationAdapter(
+ DECLARATION_ANNOTATION_ADAPTER,
+ CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
+ index,
+ ANNOTATION_NAME);
+ return idaa;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
index 6f119b77fb..b41f402c7a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTemporalAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapKeyTemporal
@@ -27,8 +27,8 @@ public final class SourceMapKeyTemporal2_0Annotation
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyTemporal2_0Annotation.ANNOTATION_NAME);
- public SourceMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceMapKeyTemporal2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
index 866f42d481..a586b20fc0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,24 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.MapsId
*/
public final class SourceMapsId2_0Annotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements MapsId2_0Annotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -37,9 +37,9 @@ public final class SourceMapsId2_0Annotation
private String value;
- public SourceMapsId2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ public SourceMapsId2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java
deleted file mode 100644
index 71a614c996..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
-
-/**
- * <code>javax.persistence.NamedQueries</code>
- */
-public final class SourceNamedQueries2_0Annotation
- extends SourceNamedQueriesAnnotation
-{
- public SourceNamedQueries2_0Annotation(JavaResourceNode parent, Type type) {
- super(parent, type);
- }
-
- @Override
- protected NestableNamedQueryAnnotation buildNamedQuery(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceNamedQuery2_0Annotation.createNestedNamedQuery(this.parent, this.annotatedElement, index, this.daa);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
index 780c127a30..07c7c1af35 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,25 +9,20 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <code>javax.persistence.NamedQuery</code>
@@ -40,17 +35,26 @@ public final class SourceNamedQuery2_0Annotation
private AnnotationElementAdapter<String> lockModeAdapter;
private LockModeType_2_0 lockMode;
-
- public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
+ public static SourceNamedQuery2_0Annotation buildSourceNamedQueryAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNamedQueryDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildNamedQueryAnnotationAdapter(annotatedElement, idaa);
+ return new SourceNamedQuery2_0Annotation(
+ parent,
+ annotatedElement,
+ idaa,
+ iaa);
+ }
+
+ private SourceNamedQuery2_0Annotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement annotatedElement,
+ IndexedDeclarationAnnotationAdapter daa,
+ IndexedAnnotationAdapter annotationAdapter) {
+ super(parent, annotatedElement, daa, annotationAdapter);
this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter();
this.lockModeAdapter = this.buildLockModeAdapter();
}
- public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type) {
- this(parent, type, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
- }
-
private String getLockModeElementName() {
return JPA2_0.NAMED_QUERY__LOCK_MODE;
}
@@ -116,32 +120,4 @@ public final class SourceNamedQuery2_0Annotation
(this.lockMode == null);
}
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter();
- this.lockModeAdapter = this.buildLockModeAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(LOCK_MODE_PROPERTY, this.lockMode);
- this.lockMode = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setLockMode((LockModeType_2_0) map.get(LOCK_MODE_PROPERTY));
- }
-
-
- // ********** static methods **********
-
- static SourceNamedQuery2_0Annotation createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(type, idaa);
- return new SourceNamedQuery2_0Annotation(parent, type, idaa, annotationAdapter);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
index 9d45f1d4b1..2138f1c39f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,18 +9,17 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedColumnAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* <code>javax.persistence.OrderColumn</code>
@@ -44,8 +43,8 @@ public final class SourceOrderColumn2_0Annotation
private Boolean updatable;
- public SourceOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceOrderColumn2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter();
this.nullableAdapter = this.buildNullableAdapter();
this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter();
@@ -211,34 +210,4 @@ public final class SourceOrderColumn2_0Annotation
(this.insertable == null) &&
(this.updatable == null);
}
-
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter();
- this.nullableAdapter = this.buildNullableAdapter();
- this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter();
- this.insertableAdapter = this.buildInsertableAdapter();
- this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter();
- this.updatableAdapter = this.buildUpdatableAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(NULLABLE_PROPERTY, this.nullable);
- this.nullable = null;
- map.put(INSERTABLE_PROPERTY, this.insertable);
- this.insertable = null;
- map.put(UPDATABLE_PROPERTY, this.updatable);
- this.updatable = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setNullable((Boolean) map.get(NULLABLE_PROPERTY));
- this.setInsertable((Boolean) map.get(INSERTABLE_PROPERTY));
- this.setUpdatable((Boolean) map.get(UPDATABLE_PROPERTY));
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
index f6fbcbcef1..99322b3e8e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
+* Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,14 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* SourceSequenceGenerator2_0Annotation
@@ -36,8 +36,8 @@ public final class SourceSequenceGenerator2_0Annotation
// ********** constructor **********
- public SourceSequenceGenerator2_0Annotation(JavaResourceNode parent, Member member) {
- super(parent, member);
+ public SourceSequenceGenerator2_0Annotation(JavaResourceNode parent, AnnotatedElement element) {
+ super(parent, element);
this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER);
this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
index 165188d7e6..a3a0190203 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,25 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.metamodel.StaticMetamodel
*/
public final class SourceStaticMetamodelAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements StaticMetamodelAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -45,9 +45,9 @@ public final class SourceStaticMetamodelAnnotation
private boolean fqClassNameStale = true;
- public SourceStaticMetamodelAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ public SourceStaticMetamodelAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
index 2f992ee1f8..952d00ba1f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
@@ -14,8 +14,8 @@
package org.eclipse.jpt.jpa.core.internal.jpql;
import java.util.HashMap;
-import java.util.ListIterator;
import java.util.Map;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.persistence.jpa.jpql.spi.IEntity;
@@ -91,14 +91,13 @@ abstract class JpaEntity extends JpaManagedType
void initializeQueries(Map<String, IQuery> queries) {
JpaManagedTypeProvider provider = getProvider();
- for (ListIterator<NamedQuery> iter = namedQueries(); iter.hasNext(); ) {
- NamedQuery namedQuery = iter.next();
+ for (NamedQuery namedQuery : getNamedQueries()) {
queries.put(namedQuery.getName(), buildQuery(provider, namedQuery));
}
}
- private ListIterator<NamedQuery> namedQueries() {
- return getManagedType().getQueryContainer().namedQueries();
+ private ListIterable<? extends NamedQuery> getNamedQueries() {
+ return getManagedType().getQueryContainer().getNamedQueries();
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java
index e42748c56b..dc614dd395 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java
@@ -17,7 +17,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
@@ -130,8 +129,7 @@ abstract class JpaManagedTypeProvider implements IManagedTypeProvider {
private Map<String, IManagedType> buildManagedTypes() {
Map<String, IManagedType> managedTypes = new HashMap<String, IManagedType>();
- for (Iterator<? extends PersistentType> iter = persistenceTypes(); iter.hasNext(); ) {
- PersistentType persistentType = iter.next();
+ for (PersistentType persistentType : persistenceTypes()) {
if (persistentType != null) {
managedTypes.put(persistentType.getMapping().getName(), buildManagedType(persistentType));
}
@@ -238,7 +236,7 @@ abstract class JpaManagedTypeProvider implements IManagedTypeProvider {
*
* @return The managed types that are defined only in the provider
*/
- abstract Iterator<? extends PersistentType> persistenceTypes();
+ abstract Iterable<? extends PersistentType> persistenceTypes();
private static class EntityCollector implements IManagedTypeVisitor {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
index f51147cab1..8152bbdf67 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
@@ -14,17 +14,16 @@
package org.eclipse.jpt.jpa.core.internal.jpql;
import java.lang.annotation.Annotation;
-import java.util.Iterator;
import java.util.List;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
import org.eclipse.persistence.jpa.jpql.spi.IMapping;
import org.eclipse.persistence.jpa.jpql.spi.IMappingType;
@@ -81,13 +80,13 @@ final class JpaMapping implements IMapping {
private ITypeDeclaration[] buildGenericTypeDeclarations() {
JavaPersistentAttribute javaPersistentAttribute = mapping.getPersistentAttribute().getJavaPersistentAttribute();
- JavaResourcePersistentAttribute resource = javaPersistentAttribute.getResourcePersistentAttribute();
+ JavaResourceAttribute resource = javaPersistentAttribute.getResourceAttribute();
List<ITypeDeclaration> declarations = CollectionTools.list(buildGenericTypeDeclarations(resource));
return declarations.toArray(new ITypeDeclaration[declarations.size()]);
}
- private Iterator<ITypeDeclaration> buildGenericTypeDeclarations(JavaResourcePersistentAttribute resource) {
- return new TransformationIterator<String, ITypeDeclaration>(resource.typeTypeArgumentNames()) {
+ private Iterable<ITypeDeclaration> buildGenericTypeDeclarations(JavaResourceAttribute resource) {
+ return new TransformationIterable<String, ITypeDeclaration>(resource.getTypeTypeArgumentNames()) {
@Override
protected ITypeDeclaration transform(String next) {
return getTypeRepository().getType(next).getTypeDeclaration();
@@ -173,7 +172,7 @@ final class JpaMapping implements IMapping {
* {@inheritDoc}
*/
public boolean hasAnnotation(Class<? extends Annotation> annotationType) {
- JavaResourcePersistentAttribute attribute = mapping.getPersistentAttribute().getJavaPersistentAttribute().getResourcePersistentAttribute();
+ JavaResourceAttribute attribute = mapping.getPersistentAttribute().getJavaPersistentAttribute().getResourceAttribute();
return attribute.getAnnotation(annotationType.getName()) != null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java
index d3b2a0835a..fa95229d86 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java
@@ -13,7 +13,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpql;
-import java.util.Iterator;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.MappingFile;
@@ -59,7 +58,7 @@ public class JpaMappingFile extends JpaManagedTypeProvider {
* {@inheritDoc}
*/
@Override
- protected Iterator<? extends PersistentType> persistenceTypes() {
- return getPersistentTypeContainer().getPersistentTypes().iterator();
+ protected Iterable<? extends PersistentType> persistenceTypes() {
+ return getPersistentTypeContainer().getPersistentTypes();
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java
index 03eb192e66..504019c449 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java
@@ -9,7 +9,6 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpql;
-import java.util.ListIterator;
import java.util.Map;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
@@ -50,8 +49,7 @@ final class JpaOrmEntity extends JpaEntity {
if (mapping instanceof Entity) {
Entity entity = (Entity) mapping;
- for (ListIterator<NamedQuery> iter = entity.getQueryContainer().namedQueries(); iter.hasNext(); ) {
- NamedQuery namedQuery = iter.next();
+ for (NamedQuery namedQuery : entity.getQueryContainer().getNamedQueries()) {
queries.put(namedQuery.getName(), buildQuery(provider, namedQuery));
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java
index c6b289b9bd..4ffa24042a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java
@@ -13,9 +13,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.jpql;
-import java.util.Iterator;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.PersistentType;
@@ -59,10 +58,10 @@ public final class JpaPersistenceUnit extends JpaManagedTypeProvider {
}
@SuppressWarnings("unchecked")
- private Iterator<ClassRef> javaClassRefs() {
- return new CompositeIterator<ClassRef>(
- getPersistentTypeContainer().specifiedClassRefs(),
- getPersistentTypeContainer().impliedClassRefs()
+ private Iterable<ClassRef> javaClassRefs() {
+ return new CompositeIterable<ClassRef>(
+ getPersistentTypeContainer().getSpecifiedClassRefs(),
+ getPersistentTypeContainer().getImpliedClassRefs()
);
}
@@ -70,8 +69,8 @@ public final class JpaPersistenceUnit extends JpaManagedTypeProvider {
* {@inheritDoc}
*/
@Override
- Iterator<? extends PersistentType> persistenceTypes() {
- return new TransformationIterator<ClassRef, PersistentType>(javaClassRefs()) {
+ Iterable<? extends PersistentType> persistenceTypes() {
+ return new TransformationIterable<ClassRef, PersistentType>(javaClassRefs()) {
@Override
protected PersistentType transform(ClassRef classRef) {
return classRef.getJavaPersistentType();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
index 57cf4806bb..56fc36696e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle.
+ * Copyright (c) 2008, 2011 Oracle.
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -10,15 +10,14 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.operations;
-import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -117,10 +116,10 @@ public class OrmFileCreationDataModelProvider
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() == 0) {
+ if (persistence.getPersistenceUnitsSize() == 0) {
return null;
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
@Override
@@ -147,7 +146,7 @@ public class OrmFileCreationDataModelProvider
}
else if (propertyName.equals(PERSISTENCE_UNIT)) {
return ArrayTools.array(
- new TransformationIterator<String, DataModelPropertyDescriptor>(new CompositeIterator<String>(null, persistenceUnitNames())) {
+ new TransformationIterable<String, DataModelPropertyDescriptor>(new CompositeIterable<String>(null, getPersistenceUnitNames())) {
@Override
protected DataModelPropertyDescriptor transform(String next) {
return persistenceUnitPropertyDescriptor(next);
@@ -250,8 +249,7 @@ public class OrmFileCreationDataModelProvider
Persistence persistence =
(persistenceXml == null) ? null : persistenceXml.getPersistence();
if (persistence != null) {
- for (Iterator<PersistenceUnit> stream = persistence.persistenceUnits(); stream.hasNext(); ) {
- PersistenceUnit next = stream.next();
+ for (PersistenceUnit next : persistence.getPersistenceUnits()) {
if (pUnitName.equals(next.getName())) {
return next;
}
@@ -260,17 +258,17 @@ public class OrmFileCreationDataModelProvider
return null;
}
- protected Iterator<PersistenceUnit> persistenceUnits() {
+ protected Iterable<PersistenceUnit> getPersistenceUnits() {
//only get the persistence units for the selected JpaProject,
//if no jpa project is selected, then no persistence units will be listed in the combo
JpaProject jpaProject = getJpaProject();
PersistenceXml persistenceXml = (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml();
Persistence persistence = (persistenceXml == null) ? null : persistenceXml.getPersistence();
- return (persistence == null) ? EmptyIterator.<PersistenceUnit>instance() : persistence.persistenceUnits();
+ return (persistence == null) ? EmptyIterable.<PersistenceUnit>instance() : persistence.getPersistenceUnits();
}
- protected Iterator<String> persistenceUnitNames() {
- return new TransformationIterator<PersistenceUnit, String>(persistenceUnits()) {
+ protected Iterable<String> getPersistenceUnitNames() {
+ return new TransformationIterable<PersistenceUnit, String>(getPersistenceUnits()) {
@Override
protected String transform(PersistenceUnit next) {
return next.getName();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
index 7f2879eede..61eaf568fd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,6 @@
*******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.operations;
-import java.util.Iterator;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -65,8 +64,7 @@ public class OrmFileCreationOperation
if (persistence == null) {
throw new ExecutionException("persistence.xml does not have a persistence node."); //$NON-NLS-1$
}
- for (Iterator<PersistenceUnit> stream = persistence.persistenceUnits(); stream.hasNext(); ) {
- PersistenceUnit pUnit = stream.next();
+ for (PersistenceUnit pUnit : persistence.getPersistenceUnits()) {
if (pUnitName.equals(pUnit.getName())) {
return pUnit;
}
@@ -91,8 +89,8 @@ public class OrmFileCreationOperation
IPath filePath = container.getFullPath().append(fileName);
IProject project = container.getProject();
IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, filePath);
- for (Iterator<MappingFileRef> stream = pUnit.specifiedMappingFileRefs(); stream.hasNext(); ) {
- if (runtimePath.equals(stream.next().getFileName())) {
+ for (MappingFileRef ref : pUnit.getSpecifiedMappingFileRefs()) {
+ if (runtimePath.equals(ref.getFileName())) {
return;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
index 9a9ada9879..9d948a34c3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -180,13 +180,13 @@ public abstract class AbstractJpaDeleteTypeParticipant
if (persistenceUnit == null) {
return;
}
- SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize());
+ SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.getMappingFileRefsSize());
Iterable<DeleteEdit> persistenceXmlDeleteEdits = this.createPersistenceXmlDeleteEdits(persistenceUnit);
if (!CollectionTools.isEmpty(persistenceXmlDeleteEdits)) {
this.persistenceXmlDeleteEdits.put(jpaProject.getPersistenceXmlResource().getFile(), persistenceXmlDeleteEdits);
}
sm.worked(1);
- for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
+ for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFileRefs()) {
if (sm.isCanceled()) {
throw new OperationCanceledException();
}
@@ -268,10 +268,10 @@ public abstract class AbstractJpaDeleteTypeParticipant
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return null; // the context model currently only supports 1 persistence unit
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
index 13bc76ed57..9024e3eed8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -175,13 +175,13 @@ public abstract class AbstractJpaMoveJavaElementParticipant
if (persistenceUnit == null) {
return;
}
- SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize());
+ SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.getMappingFileRefsSize());
Iterable<ReplaceEdit> classRefDeleteEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit);
sm.worked(1);
if (!CollectionTools.isEmpty(classRefDeleteEdits)) {
this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits);
}
- for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
+ for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFileRefs()) {
if (sm.isCanceled()) {
throw new OperationCanceledException();
}
@@ -274,10 +274,10 @@ public abstract class AbstractJpaMoveJavaElementParticipant
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return null; // the context model currently only supports 1 persistence unit
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
index d0d951594c..123153e758 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -155,13 +155,13 @@ public abstract class AbstractJpaRenameJavaElementParticipant
if (persistenceUnit == null) {
return;
}
- SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize());
+ SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.getMappingFileRefsSize());
Iterable<ReplaceEdit> classRefDeleteEdits = this.createPersistenceXmlReplaceEditsCheckClasspath(persistenceUnit);
sm.worked(1);
if (!CollectionTools.isEmpty(classRefDeleteEdits)) {
this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits);
}
- for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
+ for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFileRefs()) {
if (sm.isCanceled()) {
throw new OperationCanceledException();
}
@@ -237,10 +237,10 @@ public abstract class AbstractJpaRenameJavaElementParticipant
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return null; // the context model currently only supports 1 persistence unit
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
index 9627149c6d..31fd726b99 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -190,10 +190,10 @@ public class JpaDeleteMappingFileParticipant
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return null; // the context model currently only supports 1 persistence unit
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
index 160e216b3c..faa035ba20 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -219,10 +219,10 @@ public class JpaMoveFolderParticipant
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return null; // the context model currently only supports 1 persistence unit
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
index 0adac39634..e26e694930 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -222,10 +222,10 @@ public class JpaMoveMappingFileParticipant
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return null; // the context model currently only supports 1 persistence unit
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
index 57cd8b335d..268b0d74b4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -174,10 +174,10 @@ public class JpaRenameFolderParticipant
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return null; // the context model currently only supports 1 persistence unit
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
index 69349e3481..e4e18412dd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -169,10 +169,10 @@ public class JpaRenameMappingFileParticipant
if (persistence == null) {
return null;
}
- if (persistence.persistenceUnitsSize() != 1) {
+ if (persistence.getPersistenceUnitsSize() != 1) {
return null; // the context model currently only supports 1 persistence unit
}
- return persistence.persistenceUnits().next();
+ return persistence.getPersistenceUnits().iterator().next();
}
private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java
deleted file mode 100644
index 8cb4a5f3d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport;
-import org.eclipse.jpt.common.utility.internal.model.ChangeSupport;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-
-/**
- * Java resource containment hierarchy
- */
-public abstract class AbstractJavaResourceNode
- extends AbstractModel
- implements JavaResourceNode
-{
- protected final JavaResourceNode parent;
-
-
- // ********** constructor **********
-
- protected AbstractJavaResourceNode(JavaResourceNode parent) {
- super();
- this.checkParent(parent);
- this.parent = parent;
- }
-
-
- // ********** parent **********
-
- public JavaResourceNode getParent() {
- return this.parent;
- }
-
- protected void checkParent(JavaResourceNode p) {
- if (p == null) {
- if (this.requiresParent()) {
- throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$
- }
- } else {
- if (this.forbidsParent()) {
- throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$
- }
- }
- }
-
- protected boolean requiresParent() {
- return true;
- }
-
- protected boolean forbidsParent() {
- return ! this.requiresParent(); // assume 'parent' is not optional
- }
-
-
- // ********** change support callback hook **********
-
- @Override
- protected final ChangeSupport buildChangeSupport() {
- return new AspectChangeSupport(this, this.buildChangeSupportListener());
- }
-
- private AspectChangeSupport.Listener buildChangeSupportListener() {
- return new AspectChangeSupport.Listener() {
- public void aspectChanged(String aspectName) {
- AbstractJavaResourceNode.this.aspectChanged(aspectName);
- }
- };
- }
-
- /**
- * ignore the aspect name, we notify listeners of *every* change
- */
- protected void aspectChanged(@SuppressWarnings("unused") String aspectName) {
- this.getRoot().resourceModelChanged();
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompilationUnit#getRoot()
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPackageFragmentRoot#getRoot()
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPersistentTypeCache#getRoot()
- */
- public Root getRoot() {
- return this.parent.getRoot();
- }
-
- public IFile getFile() {
- return this.getRoot().getFile();
- }
-
-
- // ********** misc **********
-
- protected JpaAnnotationProvider getAnnotationProvider() {
- return this.getRoot().getAnnotationProvider();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
index d92334b88b..a1e61a1caa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,29 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryAssociationOverride1_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceAssociationOverride1_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.AssociationOverride
*/
public final class AssociationOverrideAnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new AssociationOverrideAnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new AssociationOverrideAnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -43,20 +41,23 @@ public final class AssociationOverrideAnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return SourceAssociationOverride1_0Annotation.buildAssociationOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceAssociationOverride1_0Annotation.buildSourceAssociationOverrideAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinaryAssociationOverride1_0Annotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryAssociationOverride1_0Annotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA.ASSOCIATION_OVERRIDE;
}
- public String getAnnotationName() {
- return AssociationOverrideAnnotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA.ASSOCIATION_OVERRIDES;
}
+ public String getElementName() {
+ return JPA.ASSOCIATION_OVERRIDES__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
index 42561b2853..e93bec5a59 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryAssociationOverrides1_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceAssociationOverrides1_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.AssociationOverrides
@@ -43,20 +41,20 @@ public final class AssociationOverridesAnnotationDefinition
super();
}
- public AssociationOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceAssociationOverrides1_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
}
- public AssociationOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
throw new UnsupportedOperationException();
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryAssociationOverrides1_0Annotation(parent, jdtAnnotation);
+ return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
}
public String getAnnotationName() {
- return AssociationOverridesAnnotation.ANNOTATION_NAME;
+ return JPA.ASSOCIATION_OVERRIDES;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
index e0c82a25cc..a675fbecce 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,29 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAttributeOverrideAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.AttributeOverride
*/
public final class AttributeOverrideAnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new AttributeOverrideAnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new AttributeOverrideAnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -43,20 +41,23 @@ public final class AttributeOverrideAnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return SourceAttributeOverrideAnnotation.buildAttributeOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceAttributeOverrideAnnotation.buildSourceAttributeOverrideAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinaryAttributeOverrideAnnotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryAttributeOverrideAnnotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA.ATTRIBUTE_OVERRIDE;
}
- public String getAnnotationName() {
- return AttributeOverrideAnnotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA.ATTRIBUTE_OVERRIDES;
}
+ public String getElementName() {
+ return JPA.ATTRIBUTE_OVERRIDES__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
index 8e0629aca6..c21211186b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAttributeOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAttributeOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.AttributeOverrides
@@ -43,20 +41,20 @@ public final class AttributeOverridesAnnotationDefinition
super();
}
- public AttributeOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceAttributeOverridesAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
}
- public AttributeOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
throw new UnsupportedOperationException();
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryAttributeOverridesAnnotation(parent, jdtAnnotation);
+ return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
}
public String getAnnotationName() {
- return AttributeOverridesAnnotation.ANNOTATION_NAME;
+ return JPA.ATTRIBUTE_OVERRIDES;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java
index a5f249a48d..d5c9f819af 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBasicAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBasicAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Basic
@@ -42,9 +40,9 @@ public final class BasicAnnotationDefinition
private BasicAnnotationDefinition() {
super();
}
-
+
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceBasicAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceBasicAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class BasicAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryBasicAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryBasicAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return BasicAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java
index 56fec881a3..be971f01c6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryColumnAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
/**
* javax.persistence.Column
@@ -44,7 +42,7 @@ public final class ColumnAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceColumnAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement, SourceColumnAnnotation.MAPPING_DECLARATION_ANNOTATION_ADAPTER);
+ return new SourceColumnAnnotation(parent, annotatedElement, SourceColumnAnnotation.MAPPING_DECLARATION_ANNOTATION_ADAPTER);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
index a9d8797d59..8869b15e8c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryDiscriminatorColumnAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceDiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.DiscriminatorColumn
@@ -45,15 +43,15 @@ public final class DiscriminatorColumnAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceDiscriminatorColumnAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent);
+ return new NullDiscriminatorColumnAnnotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryDiscriminatorColumnAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
index 1150a7d7a4..4fe3535e79 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryDiscriminatorValueAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceDiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.DiscriminatorValue
@@ -44,15 +42,15 @@ public final class DiscriminatorValueAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceDiscriminatorValueAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceDiscriminatorValueAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullDiscriminatorValueAnnotation((JavaResourcePersistentType) parent);
+ return new NullDiscriminatorValueAnnotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryDiscriminatorValueAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryDiscriminatorValueAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java
index 995417e071..b11237dddc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddableAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Embeddable
@@ -44,7 +42,7 @@ public final class EmbeddableAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceEmbeddableAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceEmbeddableAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,7 +50,7 @@ public final class EmbeddableAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddableAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryEmbeddableAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java
index 50818c215e..dc28ee26da 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddedAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Embedded
@@ -44,7 +42,7 @@ public final class EmbeddedAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceEmbeddedAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceEmbeddedAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,7 +50,7 @@ public final class EmbeddedAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddedAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryEmbeddedAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
index 572fde6d2c..840fdefbed 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddedIdAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddedIdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.EmbeddedId
@@ -44,7 +42,7 @@ public final class EmbeddedIdAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceEmbeddedIdAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceEmbeddedIdAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class EmbeddedIdAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddedIdAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryEmbeddedIdAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return EmbeddedIdAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java
index f13e842fbc..23dbdb233a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEntityAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEntityAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Entity
@@ -44,7 +42,7 @@ public final class EntityAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceEntityAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceEntityAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class EntityAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEntityAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryEntityAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return EntityAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java
index 79ce931c82..b338ee24e9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEnumeratedAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Enumerated
@@ -44,19 +42,18 @@ public final class EnumeratedAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceEnumeratedAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceEnumeratedAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullEnumeratedAnnotation((JavaResourcePersistentAttribute) parent);
+ return new NullEnumeratedAnnotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEnumeratedAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryEnumeratedAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return EnumeratedAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
index 0cc96173bb..5c0a3d01c5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryGeneratedValueAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceGeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.GeneratedValue
@@ -44,7 +42,7 @@ public final class GeneratedValueAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceGeneratedValueAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceGeneratedValueAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class GeneratedValueAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryGeneratedValueAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryGeneratedValueAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return GeneratedValueAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java
index 8628cfede1..c446b333a3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryIdAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Id
@@ -44,7 +42,7 @@ public final class IdAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceIdAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceIdAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class IdAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryIdAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryIdAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return IdAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java
index e5cbb6c281..05b066cd93 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryIdClassAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.IdClass
@@ -44,7 +42,7 @@ public final class IdClassAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceIdClassAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceIdClassAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class IdClassAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryIdClassAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryIdClassAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return IdClassAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java
index d0d4734830..8b39be25b4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryInheritanceAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceInheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Inheritance
@@ -44,19 +42,18 @@ public final class InheritanceAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceInheritanceAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceInheritanceAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullInheritanceAnnotation((JavaResourcePersistentType) parent);
+ return new NullInheritanceAnnotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryInheritanceAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryInheritanceAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return InheritanceAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java
index 8430099980..ee175d09dd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,29 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.JoinColumn
*/
public final class JoinColumnAnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new JoinColumnAnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new JoinColumnAnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -43,20 +41,23 @@ public final class JoinColumnAnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return SourceJoinColumnAnnotation.createJoinColumn((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceJoinColumnAnnotation.buildSourceJoinColumnAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinaryJoinColumnAnnotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryJoinColumnAnnotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA.JOIN_COLUMN;
}
- public String getAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA.JOIN_COLUMNS;
}
+ public String getElementName() {
+ return JPA.JOIN_COLUMNS__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
index e0e07b6efd..ffe0e7c815 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnsAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnsAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.JoinColumns
@@ -43,20 +41,20 @@ public final class JoinColumnsAnnotationDefinition
super();
}
- public JoinColumnsAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceJoinColumnsAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
}
- public JoinColumnsAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
throw new UnsupportedOperationException();
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryJoinColumnsAnnotation(parent, jdtAnnotation);
+ return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
}
public String getAnnotationName() {
- return JoinColumnsAnnotation.ANNOTATION_NAME;
+ return JPA.JOIN_COLUMNS;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java
index ad35ea19e3..3f3894be12 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
/**
@@ -44,7 +42,7 @@ public final class JoinTableAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceJoinTableAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ return new SourceJoinTableAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -58,5 +56,4 @@ public final class JoinTableAnnotationDefinition
public String getAnnotationName() {
return JoinTableAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java
index 593295e108..941bf6e2a8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryLobAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceLobAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
/**
@@ -44,7 +42,7 @@ public final class LobAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceLobAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceLobAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class LobAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryLobAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryLobAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return LobAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java
index 173ae215c9..e96d01e153 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryManyToManyAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceManyToManyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
/**
@@ -44,7 +42,7 @@ public final class ManyToManyAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceManyToManyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceManyToManyAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class ManyToManyAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryManyToManyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryManyToManyAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return ManyToManyAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java
index 7d8571e116..e2c9537623 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryManyToOneAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceManyToOneAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
/**
@@ -44,7 +42,7 @@ public final class ManyToOneAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceManyToOneAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceManyToOneAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class ManyToOneAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryManyToOneAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryManyToOneAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return ManyToOneAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java
index db92373fe0..caa04880dc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryMapKeyAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceMapKeyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
/**
@@ -44,7 +42,7 @@ public final class MapKeyAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceMapKeyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceMapKeyAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class MapKeyAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryMapKeyAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return MapKeyAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
index 2d03a17fe4..bc83790cf6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryMappedSuperclassAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceMappedSuperclassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
/**
@@ -44,7 +42,7 @@ public final class MappedSuperclassAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceMappedSuperclassAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceMappedSuperclassAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class MappedSuperclassAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMappedSuperclassAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryMappedSuperclassAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return MappedSuperclassAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
index 64d1419a8c..43ad8a23d2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedNativeQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedNativeQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.NamedNativeQueries
@@ -43,7 +42,7 @@ public final class NamedNativeQueriesAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedNativeQueriesAnnotation(parent, (Type) annotatedElement);
+ return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -51,11 +50,11 @@ public final class NamedNativeQueriesAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedNativeQueriesAnnotation(parent, jdtAnnotation);
+ return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
}
public String getAnnotationName() {
- return NamedNativeQueriesAnnotation.ANNOTATION_NAME;
+ return JPA.NAMED_NATIVE_QUERIES;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
index 07aa297403..804b262156 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,28 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedNativeQueryAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.NamedNativeQuery
*/
public final class NamedNativeQueryAnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new NamedNativeQueryAnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new NamedNativeQueryAnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -42,20 +41,23 @@ public final class NamedNativeQueryAnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return SourceNamedNativeQueryAnnotation.createNamedNativeQuery(parent, (Type) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceNamedNativeQueryAnnotation.buildSourceNamedNativeQueryAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinaryNamedNativeQueryAnnotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedNativeQueryAnnotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA.NAMED_NATIVE_QUERY;
}
- public String getAnnotationName() {
- return NamedNativeQueryAnnotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA.NAMED_NATIVE_QUERIES;
}
+ public String getElementName() {
+ return JPA.NAMED_NATIVE_QUERIES__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
index 4636029019..855f933404 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryNamedQueries1_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueries1_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.NamedQueries
@@ -43,7 +42,7 @@ public final class NamedQueriesAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedQueries1_0Annotation(parent, (Type) annotatedElement);
+ return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -51,11 +50,11 @@ public final class NamedQueriesAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedQueries1_0Annotation(parent, jdtAnnotation);
+ return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
}
public String getAnnotationName() {
- return NamedQueriesAnnotation.ANNOTATION_NAME;
+ return JPA.NAMED_QUERIES;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java
index 3b49b07818..397442f380 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,28 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryNamedQuery1_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.NamedQuery
*/
public final class NamedQueryAnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new NamedQueryAnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new NamedQueryAnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -42,20 +41,23 @@ public final class NamedQueryAnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedQuery1_0Annotation(parent, (Type) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceNamedQuery1_0Annotation.buildSourceNamedQueryAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinaryNamedQuery1_0Annotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedQuery1_0Annotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA.NAMED_QUERY;
}
- public String getAnnotationName() {
- return NamedQueryAnnotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA.NAMED_QUERIES;
}
+ public String getElementName() {
+ return JPA.NAMED_QUERIES__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java
deleted file mode 100644
index ab7a3377a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java;
-
-import java.util.Map;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-
-/**
- * Simplify null annotation classes.
- */
-public abstract class NullAnnotation<A extends Annotation>
- extends AbstractJavaResourceNode
- implements Annotation
-{
- protected NullAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public void initialize(CompilationUnit astRoot) {
- // do nothing
- }
-
- public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
- return null;
- }
-
- public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
- throw new UnsupportedOperationException();
- }
-
- public void newAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isUnset() {
- throw new UnsupportedOperationException();
- }
-
- public void storeOn(Map<String, Object> map) {
- // NOP
- }
-
- public void restoreFrom(Map<String, Object> map) {
- // NOP
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Convenience method: Cast the annotation's parent to a
- * persistent member.
- */
- protected JavaResourcePersistentMember getMember() {
- return (JavaResourcePersistentMember) this.parent;
- }
-
- /**
- * Convenience method: Add the type or attribute's annotation
- * and return it.
- * <p>
- * Pre-condition: The annotation's parent must be a persistent member
- * (type or attribute).
- */
- @SuppressWarnings("unchecked")
- protected A addAnnotation() {
- return (A) this.addAnnotation_();
- }
-
- protected Annotation addAnnotation_() {
- return this.getMember().addAnnotation(this.getAnnotationName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java
index 44696dab1c..9ab6d373cb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,9 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <ul>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java
index 931b3cd56a..b1fd557867 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,12 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java;
-import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
/**
@@ -94,11 +95,11 @@ public abstract class NullBaseTableAnnotation<A extends BaseTableAnnotation>
}
// ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return EmptyListIterator.instance();
+ public ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
+ return EmptyListIterable.instance();
}
- public int uniqueConstraintsSize() {
+ public int getUniqueConstraintsSize() {
return 0;
}
@@ -106,10 +107,6 @@ public abstract class NullBaseTableAnnotation<A extends BaseTableAnnotation>
throw new UnsupportedOperationException();
}
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- throw new UnsupportedOperationException();
- }
-
public UniqueConstraintAnnotation addUniqueConstraint(int index) {
return this.addAnnotation().addUniqueConstraint(index);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java
index 92e9045040..3cf4c61ed3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,11 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <code>javax.persistence.Column</code>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
index 54add2a0a7..9b368a5175 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* <code>javax.persistence.DiscriminatorColumn</code>
@@ -20,7 +20,7 @@ public final class NullDiscriminatorColumnAnnotation
extends NullNamedColumnAnnotation<DiscriminatorColumnAnnotation>
implements DiscriminatorColumnAnnotation
{
- public NullDiscriminatorColumnAnnotation(JavaResourcePersistentType parent) {
+ public NullDiscriminatorColumnAnnotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
index 0169a216f2..5614b6783c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,9 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* <code>javax.persistence.DiscriminatorValue</code>
@@ -21,7 +22,7 @@ public final class NullDiscriminatorValueAnnotation
extends NullAnnotation<DiscriminatorValueAnnotation>
implements DiscriminatorValueAnnotation
{
- protected NullDiscriminatorValueAnnotation(JavaResourcePersistentType parent) {
+ protected NullDiscriminatorValueAnnotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java
index 288cdd0964..2f5348fa11 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,11 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.EnumType;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* <code>javax.persistence.Enumerated</code>
@@ -22,7 +23,7 @@ public final class NullEnumeratedAnnotation
extends NullAnnotation<EnumeratedAnnotation>
implements EnumeratedAnnotation
{
- protected NullEnumeratedAnnotation(JavaResourcePersistentAttribute parent) {
+ protected NullEnumeratedAnnotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java
index 3e1db48102..b0108f3e0d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,11 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* <code>javax.persistence.Inheritance</code>
@@ -22,7 +23,7 @@ public final class NullInheritanceAnnotation
extends NullAnnotation<InheritanceAnnotation>
implements InheritanceAnnotation
{
- protected NullInheritanceAnnotation(JavaResourcePersistentType parent) {
+ protected NullInheritanceAnnotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java
index b5cbdec77b..2972666212 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java
index 7fce754e00..e1f72c0d31 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,10 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
@@ -32,11 +31,11 @@ public class NullJoinTableAnnotation
}
// ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return EmptyListIterator.instance();
+ public ListIterable<JoinColumnAnnotation> getJoinColumns() {
+ return EmptyListIterable.instance();
}
- public int joinColumnsSize() {
+ public int getJoinColumnsSize() {
return 0;
}
@@ -44,10 +43,6 @@ public class NullJoinTableAnnotation
return null;
}
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- throw new UnsupportedOperationException();
- }
-
public JoinColumnAnnotation addJoinColumn(int index) {
// the JoinTable annotation is missing, add both it and a join column at the same time
return this.addAnnotation().addJoinColumn(index);
@@ -62,11 +57,11 @@ public class NullJoinTableAnnotation
}
// ***** inverse join columns
- public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
- return EmptyListIterator.instance();
+ public ListIterable<JoinColumnAnnotation> getInverseJoinColumns() {
+ return EmptyListIterable.instance();
}
- public int inverseJoinColumnsSize() {
+ public int getInverseJoinColumnsSize() {
return 0;
}
@@ -74,10 +69,6 @@ public class NullJoinTableAnnotation
return null;
}
- public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
- throw new UnsupportedOperationException();
- }
-
public JoinColumnAnnotation addInverseJoinColumn(int index) {
// the JoinTable annotation is missing, add both it and a join column at the same time
return this.addAnnotation().addInverseJoinColumn(index);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java
index 61f04b9e6b..60dae06fe0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
index 730c7398df..2cc9e62b5a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java
index 3ffc637bd2..04dc531bac 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
/**
@@ -19,7 +19,7 @@ public final class NullTableAnnotation
extends NullBaseTableAnnotation<TableAnnotation>
implements TableAnnotation
{
- protected NullTableAnnotation(JavaResourcePersistentType parent) {
+ protected NullTableAnnotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java
index ce77b832e3..2012d08b67 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
@@ -22,7 +23,7 @@ public final class NullTemporalAnnotation
extends NullAnnotation<TemporalAnnotation>
implements TemporalAnnotation
{
- protected NullTemporalAnnotation(JavaResourcePersistentAttribute parent) {
+ protected NullTemporalAnnotation(JavaResourceAnnotatedElement parent) {
super(parent);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java
index 9f0ccaf7c1..7f4fe98296 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOneToManyAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOneToManyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
/**
@@ -44,7 +42,7 @@ public final class OneToManyAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceOneToManyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceOneToManyAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class OneToManyAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToManyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryOneToManyAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return OneToManyAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java
index d909ad2552..89c2afb754 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOneToOneAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOneToOneAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
/**
@@ -44,7 +42,7 @@ public final class OneToOneAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceOneToOneAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceOneToOneAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class OneToOneAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToOneAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryOneToOneAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return OneToOneAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java
index 21a6687fe3..a25b378539 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOrderByAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOrderByAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
/**
@@ -44,7 +42,7 @@ public final class OrderByAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceOrderByAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceOrderByAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class OrderByAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryOrderByAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryOrderByAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return OrderByAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
index 2a46e8d96a..d2731c2bd9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,29 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.PrimaryKeyJoinColumn
*/
public final class PrimaryKeyJoinColumnAnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnAnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnAnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -43,20 +41,23 @@ public final class PrimaryKeyJoinColumnAnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return SourcePrimaryKeyJoinColumnAnnotation.createPrimaryKeyJoinColumn((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourcePrimaryKeyJoinColumnAnnotation.buildSourcePrimaryKeyJoinColumnAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinaryPrimaryKeyJoinColumnAnnotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryPrimaryKeyJoinColumnAnnotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN;
}
- public String getAnnotationName() {
- return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMNS;
}
+ public String getElementName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
index 6c93d75044..8a48d9324e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.PrimaryKeyJoinColumns
@@ -43,20 +41,20 @@ public final class PrimaryKeyJoinColumnsAnnotationDefinition
super();
}
- public PrimaryKeyJoinColumnsAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourcePrimaryKeyJoinColumnsAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
+ return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
}
- public PrimaryKeyJoinColumnsAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
+ public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
throw new UnsupportedOperationException();
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryPrimaryKeyJoinColumnsAnnotation(parent, jdtAnnotation);
+ return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
}
public String getAnnotationName() {
- return PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME;
+ return JPA.PRIMARY_KEY_JOIN_COLUMNS;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
index 2ab5857808..0109ff4539 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,29 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySecondaryTableAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.SecondaryTable
*/
public final class SecondaryTableAnnotationDefinition
- implements AnnotationDefinition
+ implements NestableAnnotationDefinition
{
// singleton
- private static final AnnotationDefinition INSTANCE = new SecondaryTableAnnotationDefinition();
+ private static final NestableAnnotationDefinition INSTANCE = new SecondaryTableAnnotationDefinition();
/**
* Return the singleton.
*/
- public static AnnotationDefinition instance() {
+ public static NestableAnnotationDefinition instance() {
return INSTANCE;
}
@@ -43,20 +41,23 @@ public final class SecondaryTableAnnotationDefinition
super();
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return SourceSecondaryTableAnnotation.createSecondaryTable((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
+ return SourceSecondaryTableAnnotation.buildSourceSecondaryTableAnnotation(parent, annotatedElement, index);
}
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
+ public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
+ return new BinarySecondaryTableAnnotation(parent, jdtAnnotation);
}
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinarySecondaryTableAnnotation(parent, jdtAnnotation);
+ public String getNestableAnnotationName() {
+ return JPA.SECONDARY_TABLE;
}
- public String getAnnotationName() {
- return SecondaryTableAnnotation.ANNOTATION_NAME;
+ public String getContainerAnnotationName() {
+ return JPA.SECONDARY_TABLES;
}
+ public String getElementName() {
+ return JPA.SECONDARY_TABLES__VALUE;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
index d30934de34..64e14a199f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,13 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySecondaryTablesAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSecondaryTablesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JPA;
/**
* javax.persistence.SecondaryTables
@@ -44,7 +42,7 @@ public final class SecondaryTablesAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceSecondaryTablesAnnotation((JavaResourcePersistentType) parent, (Member) annotatedElement);
+ return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,11 @@ public final class SecondaryTablesAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinarySecondaryTablesAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
}
public String getAnnotationName() {
- return SecondaryTablesAnnotation.ANNOTATION_NAME;
+ return JPA.SECONDARY_TABLES;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
index 3e03fa5a0f..3784a290f2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinarySequenceGenerator1_0Annotation;
import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceSequenceGenerator1_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
/**
@@ -44,7 +42,7 @@ public final class SequenceGeneratorAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceSequenceGenerator1_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ return new SourceSequenceGenerator1_0Annotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -58,5 +56,4 @@ public final class SequenceGeneratorAnnotationDefinition
public String getAnnotationName() {
return SequenceGeneratorAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java
index d5ea08d3ff..d189d64a3b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTableAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
/**
@@ -44,19 +42,18 @@ public final class TableAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceTableAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement);
+ return new SourceTableAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullTableAnnotation((JavaResourcePersistentType) parent);
+ return new NullTableAnnotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryTableAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ return new BinaryTableAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return TableAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
index 3c043df606..8cbe2da7f8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTableGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTableGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
/**
@@ -44,7 +42,7 @@ public final class TableGeneratorAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceTableGeneratorAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement);
+ return new SourceTableGeneratorAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -58,5 +56,4 @@ public final class TableGeneratorAnnotationDefinition
public String getAnnotationName() {
return TableGeneratorAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java
index 47cc40ebdb..a69962e8f7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTemporalAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTemporalAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
/**
@@ -44,19 +42,18 @@ public final class TemporalAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceTemporalAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceTemporalAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullTemporalAnnotation((JavaResourcePersistentAttribute) parent);
+ return new NullTemporalAnnotation(parent);
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryTemporalAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryTemporalAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return TemporalAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java
index ab9f9f0220..930a13f526 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTransientAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTransientAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
/**
@@ -44,7 +42,7 @@ public final class TransientAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceTransientAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceTransientAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class TransientAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryTransientAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryTransientAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return TransientAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java
index c1719af680..3406e69c29 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,12 @@
package org.eclipse.jpt.jpa.core.internal.resource.java;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryVersionAnnotation;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceVersionAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
/**
@@ -44,7 +42,7 @@ public final class VersionAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceVersionAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement);
+ return new SourceVersionAnnotation(parent, annotatedElement);
}
public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
@@ -52,11 +50,10 @@ public final class VersionAnnotationDefinition
}
public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryVersionAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation);
+ return new BinaryVersionAnnotation(parent, jdtAnnotation);
}
public String getAnnotationName() {
return VersionAnnotation.ANNOTATION_NAME;
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java
deleted file mode 100644
index 3ab6aca048..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * binary annotated element
- */
-abstract class BinaryAnnotatedElement
- extends BinaryNode
- implements JavaResourceAnnotatedElement
-{
- /** JDT annotated element adapter */
- final Adapter adapter;
-
- /** annotations */
- final Vector<Annotation> annotations = new Vector<Annotation>();
-
- /**
- * these are built as needed
- */
- private final HashMap<String, Annotation> nullAnnotationsCache = new HashMap<String, Annotation>();
-
-
- // ********** construction/initialization **********
-
- public BinaryAnnotatedElement(JavaResourceNode parent, Adapter adapter) {
- super(parent);
- this.adapter = adapter;
- this.initializeAnnotations();
- }
-
- private void initializeAnnotations() {
- for (IAnnotation annotation : this.getJdtAnnotations()) {
- this.addAnnotation(annotation);
- }
- }
-
- private void addAnnotation(IAnnotation jdtAnnotation) {
- if (this.annotationIsValid(jdtAnnotation)) {
- this.annotations.add(this.buildAnnotation(jdtAnnotation));
- }
- }
-
-
- // ********** updating **********
-
- @Override
- public void update() {
- super.update();
- this.updateAnnotations();
- }
-
- // TODO
- private void updateAnnotations() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** annotations **********
-
- public Iterator<Annotation> annotations() {
- return this.getAnnotations().iterator();
- }
-
- private Iterable<Annotation> getAnnotations() {
- return new LiveCloneIterable<Annotation>(this.annotations);
- }
-
- public int annotationsSize() {
- return this.annotations.size();
- }
-
- public Annotation getAnnotation(String annotationName) {
- return this.selectAnnotationNamed(this.getAnnotations(), annotationName);
- }
-
- public Annotation getNonNullAnnotation(String annotationName) {
- Annotation annotation = this.getAnnotation(annotationName);
- return (annotation != null) ? annotation : this.getNullAnnotation(annotationName);
- }
-
- private synchronized Annotation getNullAnnotation(String annotationName) {
- Annotation annotation = this.nullAnnotationsCache.get(annotationName);
- if (annotation == null) {
- annotation = this.buildNullAnnotation(annotationName);
- this.nullAnnotationsCache.put(annotationName, annotation);
- }
- return annotation;
- }
-
- public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
- if (containerAnnotation != null) {
- return containerAnnotation.getNestedAnnotations().iterator();
- }
- NestableAnnotation nestableAnnotation = this.getNestableAnnotation(nestableAnnotationName);
- return (nestableAnnotation == null) ?
- EmptyListIterator.<NestableAnnotation>instance() :
- new SingleElementIterator<NestableAnnotation>(nestableAnnotation);
- }
-
- private NestableAnnotation getNestableAnnotation(String annotationName) {
- return (NestableAnnotation) this.getAnnotation(annotationName);
- }
-
- @SuppressWarnings("unchecked")
- private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) {
- return (ContainerAnnotation<NestableAnnotation>) this.getAnnotation(annotationName);
- }
-
- private boolean annotationIsValid(IAnnotation jdtAnnotation) {
- return CollectionTools.contains(this.validAnnotationNames(), jdtAnnotation.getElementName());
- }
-
- abstract Iterator<String> validAnnotationNames();
-
- abstract Annotation buildAnnotation(IAnnotation jdtAnnotation);
-
- abstract Annotation buildNullAnnotation(String annotationName);
-
-
- // ********** simple state **********
-
- public boolean isAnnotated() {
- return ! this.annotations.isEmpty();
- }
-
-
- // ********** misc **********
-
- IJavaElement getAnnotatedElement() {
- return this.adapter.getElement();
- }
-
- private Annotation selectAnnotationNamed(Iterable<Annotation> annotationList, String annotationName) {
- for (Annotation annotation : annotationList) {
- if (annotation.getAnnotationName().equals(annotationName)) {
- return annotation;
- }
- }
- return null;
- }
-
- private IAnnotation[] getJdtAnnotations() {
- try {
- return this.adapter.getAnnotations();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return EMPTY_JDT_ANNOTATION_ARRAY;
- }
- }
- private static final IAnnotation[] EMPTY_JDT_ANNOTATION_ARRAY = new IAnnotation[0];
-
-
- // ********** IJavaElement adapter **********
-
- interface Adapter {
- /**
- * Return the adapter's JDT element (IPackageFragment, IType, IField, IMethod).
- */
- IJavaElement getElement();
-
- /**
- * Return the adapter's element's JDT annotations.
- */
- IAnnotation[] getAnnotations() throws JavaModelException;
- }
-
-
- // ********** unsupported JavaResourcePersistentMember implementation **********
-
- public Annotation addAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java
deleted file mode 100644
index 8f59feac5e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Map;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * JAR annotation
- */
-public abstract class BinaryAnnotation
- extends BinaryNode
- implements Annotation
-{
- final IAnnotation jdtAnnotation;
-
- protected BinaryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent);
- this.jdtAnnotation = jdtAnnotation;
- }
-
-
- // ********** convenience methods **********
-
- /**
- * Return the values of the JDT annotation's member with the specified name.
- */
- protected Object[] getJdtMemberValues(String memberName) {
- Object[] values = (Object[]) this.getJdtMemberValue(memberName);
- return (values != null) ? values : EMPTY_OBJECT_ARRAY;
- }
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-
- /**
- * Return the value of the JDT annotation's member with the specified name.
- */
- protected Object getJdtMemberValue(String memberName) {
- IMemberValuePair pair = this.getJdtMemberValuePair(memberName);
- return (pair == null) ? null : pair.getValue();
- }
-
- /**
- * Return the JDT annotation's member-value pair with the specified name.
- */
- private IMemberValuePair getJdtMemberValuePair(String memberName) {
- for (IMemberValuePair pair : this.getJdtMemberValuePairs()) {
- if (pair.getMemberName().equals(memberName)) {
- return pair;
- }
- }
- return null;
- }
-
- private IMemberValuePair[] getJdtMemberValuePairs() {
- try {
- return this.jdtAnnotation.getMemberValuePairs();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return EMPTY_MEMBER_VALUE_PAIR_ARRAY;
- }
- }
- private static final IMemberValuePair[] EMPTY_MEMBER_VALUE_PAIR_ARRAY = new IMemberValuePair[0];
-
-
- // ********** Annotation implementation **********
- public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
- public void newAnnotation() {
- throw new UnsupportedOperationException();
- }
- public void removeAnnotation() {
- throw new UnsupportedOperationException();
- }
- public boolean isUnset() {
- throw new UnsupportedOperationException();
- }
-
- // ********** NestableAnnotation implementation **********
- public void moveAnnotation(@SuppressWarnings("unused") int index) {
- throw new UnsupportedOperationException();
- }
- public void convertToNested(@SuppressWarnings("unused") ContainerAnnotation<? extends NestableAnnotation> containerAnnotation, @SuppressWarnings("unused") DeclarationAnnotationAdapter containerAnnotationAdapter, @SuppressWarnings("unused") int index) {
- throw new UnsupportedOperationException();
- }
- public void convertToStandAlone() {
- throw new UnsupportedOperationException();
- }
-
- // ********** misc **********
- public void storeOn(Map<String, Object> map) {
- throw new UnsupportedOperationException();
- }
- public void restoreFrom(Map<String, Object> map) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
index f7573033bd..e148d63290 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,22 +9,21 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
/**
* javax.persistence.AssociationOverride
*/
public abstract class BinaryAssociationOverrideAnnotation
extends BinaryOverrideAnnotation
- implements NestableAssociationOverrideAnnotation
+ implements AssociationOverrideAnnotation
{
private final Vector<JoinColumnAnnotation> joinColumns;
@@ -56,11 +55,11 @@ public abstract class BinaryAssociationOverrideAnnotation
// ********** AssociationOverrideAnnotation implementation **********
// ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ public ListIterable<JoinColumnAnnotation> getJoinColumns() {
+ return new LiveCloneListIterable<JoinColumnAnnotation>(this.joinColumns);
}
- public int joinColumnsSize() {
+ public int getJoinColumnsSize() {
return this.joinColumns.size();
}
@@ -68,10 +67,6 @@ public abstract class BinaryAssociationOverrideAnnotation
return this.joinColumns.get(index);
}
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
public JoinColumnAnnotation addJoinColumn(int index) {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java
deleted file mode 100644
index 7ecda6b2f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
-
-/**
- * javax.persistence.AssociationOverrides
- */
-public abstract class BinaryAssociationOverridesAnnotation
- extends BinaryContainerAnnotation<NestableAssociationOverrideAnnotation>
- implements AssociationOverridesAnnotation
-{
- private final Vector<NestableAssociationOverrideAnnotation> associationOverrides;
-
-
- protected BinaryAssociationOverridesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.associationOverrides = this.buildAssociationOverrides();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public Iterable<NestableAssociationOverrideAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableAssociationOverrideAnnotation>(this.associationOverrides);
- }
-
- public int getNestedAnnotationsSize() {
- return this.associationOverrides.size();
- }
-
- private Vector<NestableAssociationOverrideAnnotation> buildAssociationOverrides() {
- Object[] jdtAssociationOverrides = this.getJdtMemberValues(JPA.ASSOCIATION_OVERRIDES__VALUE);
- Vector<NestableAssociationOverrideAnnotation> result = new Vector<NestableAssociationOverrideAnnotation>(jdtAssociationOverrides.length);
- for (Object jdtAssociationOverride : jdtAssociationOverrides) {
- result.add(buildAssociationOverride(jdtAssociationOverride));
- }
- return result;
- }
-
- protected abstract NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride);
-
- @Override
- public void update() {
- super.update();
- this.updateAssociationOverrides();
- }
-
- // TODO
- private void updateAssociationOverrides() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
index e7a6c90119..d5c6a4f44d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,18 +10,18 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
/**
* javax.persistence.AttributeOverride
*/
public final class BinaryAttributeOverrideAnnotation
extends BinaryOverrideAnnotation
- implements NestableAttributeOverrideAnnotation
+ implements AttributeOverrideAnnotation
{
private ColumnAnnotation column;
private final ColumnAnnotation nullColumn;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java
deleted file mode 100644
index d4a73ac475..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
-
-/**
- * javax.persistence.AttributeOverrides
- */
-public final class BinaryAttributeOverridesAnnotation
- extends BinaryContainerAnnotation<NestableAttributeOverrideAnnotation>
- implements AttributeOverridesAnnotation
-{
- private final Vector<NestableAttributeOverrideAnnotation> attributeOverrides;
-
-
- public BinaryAttributeOverridesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.attributeOverrides = this.buildAttributeOverrides();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public Iterable<NestableAttributeOverrideAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableAttributeOverrideAnnotation>(this.attributeOverrides);
- }
-
- public int getNestedAnnotationsSize() {
- return this.attributeOverrides.size();
- }
-
- private Vector<NestableAttributeOverrideAnnotation> buildAttributeOverrides() {
- Object[] jdtAttributeOverrides = this.getJdtMemberValues(JPA.ATTRIBUTE_OVERRIDES__VALUE);
- Vector<NestableAttributeOverrideAnnotation> result = new Vector<NestableAttributeOverrideAnnotation>(jdtAttributeOverrides.length);
- for (Object jdtAttributeOverride : jdtAttributeOverrides) {
- result.add(new BinaryAttributeOverrideAnnotation(this, (IAnnotation) jdtAttributeOverride));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateAttributeOverrides();
- }
-
- // TODO
- private void updateAttributeOverrides() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
index 31f4a617f4..db7ee3fbec 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,9 +11,9 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.Column
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
index 07acd58ce7..87abdef48c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,10 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.EnumType;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.Enumerated
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
index f8c35068ec..6c4e7b5a21 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,10 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.BaseJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.JoinColumn
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
index 7e410a1a7d..fb2329bf27 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,15 +9,15 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
/**
@@ -152,11 +152,12 @@ public abstract class BinaryBaseTableAnnotation
}
// ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
+
+ public ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
+ return new LiveCloneListIterable<UniqueConstraintAnnotation>(this.uniqueConstraints);
}
- public int uniqueConstraintsSize() {
+ public int getUniqueConstraintsSize() {
return this.uniqueConstraints.size();
}
@@ -164,10 +165,6 @@ public abstract class BinaryBaseTableAnnotation
return this.uniqueConstraints.get(index);
}
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- return this.uniqueConstraints.indexOf(uniqueConstraint);
- }
-
public UniqueConstraintAnnotation addUniqueConstraint(int index) {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
index 5c98ccf8b3..604bffa2f6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,8 +11,9 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java
index 17ba837fae..bab7a35295 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.FetchType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Basic
@@ -28,7 +29,7 @@ public final class BinaryBasicAnnotation
private FetchType fetch;
- public BinaryBasicAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryBasicAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.optional = this.buildOptional();
this.fetch = this.buildFetch();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java
deleted file mode 100644
index 28721d9178..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceClassFile;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * binary class file
- */
-final class BinaryClassFile
- extends BinaryNode
- implements JavaResourceClassFile
-{
- /** JDT class file */
- private final IClassFile classFile;
-
- /** class file's persistent type */
- private final JavaResourcePersistentType persistentType;
-
-
- // ********** construction/initialization **********
-
- /**
- * The JDT type gets passed in because the package fragment inspects it
- * beforehand to determine whether it is "persistable". (We only build
- * class files for "persistable" types.)
- */
- BinaryClassFile(JavaResourcePackageFragment parent, IClassFile classFile, IType jdtType) {
- super(parent);
- this.classFile = classFile;
- this.persistentType = this.buildPersistentType(jdtType);
- }
-
- private JavaResourcePersistentType buildPersistentType(IType jdtType) {
- return new BinaryPersistentType(this, jdtType);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.classFile.getElementName());
- }
-
-
- // ********** JavaResourceClassFile implementation **********
-
- public JavaResourcePersistentType getPersistentType() {
- return this.persistentType;
- }
-
- // TODO
- @Override
- public void update() {
- super.update();
-// this.persistentType.update(this.classFile.getType());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java
index 840041256d..60434795da 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,9 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.Column
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
index b1bc0bd745..4bd844d4bd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,9 +11,9 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* Abstract implementation of ColumnAnnotation to be used for JPA annotations:
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java
deleted file mode 100644
index fdd3f152a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * JAR annotations do not support most of the container annotation protocol.
- */
-public abstract class BinaryContainerAnnotation<T extends NestableAnnotation>
- extends BinaryAnnotation
- implements ContainerAnnotation<T>
-{
-
- protected BinaryContainerAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getElementName() {
- throw new UnsupportedOperationException();
- }
-
- public String getNestedAnnotationName() {
- throw new UnsupportedOperationException();
- }
-
- public T addNestedAnnotation() {
- throw new UnsupportedOperationException();
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- throw new UnsupportedOperationException();
- }
-
- public T moveNestedAnnotation(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public T removeNestedAnnotation(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- throw new UnsupportedOperationException();
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- throw new UnsupportedOperationException();
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- throw new UnsupportedOperationException();
- }
-
- public void removeLastNestedAnnotation() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
index 3346100136..90c442f966 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.DiscriminatorColumn
@@ -26,7 +26,7 @@ public final class BinaryDiscriminatorColumnAnnotation
private Integer length;
- public BinaryDiscriminatorColumnAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryDiscriminatorColumnAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.discriminatorType = this.buildDiscriminatorType();
this.length = this.buildLength();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
index 9b86088033..6ea557a0e5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,10 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.DiscriminatorValue
@@ -26,7 +27,7 @@ public final class BinaryDiscriminatorValueAnnotation
private String value;
- public BinaryDiscriminatorValueAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryDiscriminatorValueAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.value = this.buildValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
index 7457e74476..8b7f468f68 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Embeddable
@@ -21,7 +22,7 @@ public final class BinaryEmbeddableAnnotation
implements EmbeddableAnnotation
{
- public BinaryEmbeddableAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryEmbeddableAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
index 6f2bd59e8e..26fee36772 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Embedded
@@ -21,7 +22,7 @@ public final class BinaryEmbeddedAnnotation
implements EmbeddedAnnotation
{
- public BinaryEmbeddedAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryEmbeddedAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
index 5636c3f215..e37c65f6d8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.EmbeddedId
@@ -21,7 +22,7 @@ public final class BinaryEmbeddedIdAnnotation
implements EmbeddedIdAnnotation
{
- public BinaryEmbeddedIdAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryEmbeddedIdAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java
index acb9b3de4a..6c04b94af6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,10 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Entity
@@ -26,7 +27,7 @@ public final class BinaryEntityAnnotation
private String name;
- public BinaryEntityAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryEntityAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.name = this.buildName();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
index 73abbe72e3..0439e1ad2f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,9 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Enumerated
@@ -22,7 +22,7 @@ public final class BinaryEnumeratedAnnotation
implements EnumeratedAnnotation
{
- public BinaryEnumeratedAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryEnumeratedAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
index f232dfaf42..d441b066be 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.GenerationType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.GeneratedValue
@@ -28,7 +29,7 @@ public final class BinaryGeneratedValueAnnotation
private String generator;
- public BinaryGeneratedValueAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryGeneratedValueAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.strategy = this.buildStrategy();
this.generator = this.buildGenerator();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
index df5549d573..e03025b43d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,9 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.SequenceGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java
index 5c3323827c..61294a3af4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Id
@@ -21,7 +22,7 @@ public final class BinaryIdAnnotation
implements IdAnnotation
{
- public BinaryIdAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryIdAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
index 5eef8693d8..b574a69716 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,10 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.IdClass
@@ -26,7 +27,7 @@ public final class BinaryIdClassAnnotation
private String value;
- public BinaryIdClassAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryIdClassAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.value = this.buildValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
index 41a01e25e0..ac209388da 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,12 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Inheritance
@@ -27,7 +28,7 @@ public final class BinaryInheritanceAnnotation
private InheritanceType strategy;
- public BinaryInheritanceAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryInheritanceAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.strategy = this.buildStrategy();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
index 6ec2b225cd..8bafa27240 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,16 +10,16 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
/**
* javax.persistence.JoinColumn
*/
public final class BinaryJoinColumnAnnotation
extends BinaryBaseJoinColumnAnnotation
- implements NestableJoinColumnAnnotation
+ implements JoinColumnAnnotation
{
public BinaryJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java
deleted file mode 100644
index 6a55a85ffb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
-
-/**
- * javax.persistence.JoinColumns
- */
-public final class BinaryJoinColumnsAnnotation
- extends BinaryContainerAnnotation<NestableJoinColumnAnnotation>
- implements JoinColumnsAnnotation
-{
- private final Vector<NestableJoinColumnAnnotation> joinColumns;
-
-
- public BinaryJoinColumnsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.joinColumns = this.buildJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
- }
-
- public int getNestedAnnotationsSize() {
- return this.joinColumns.size();
- }
-
- private Vector<NestableJoinColumnAnnotation> buildJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_COLUMNS__VALUE);
- Vector<NestableJoinColumnAnnotation> result = new Vector<NestableJoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJoinColumns();
- }
-
- // TODO
- private void updateJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
index 5113f1a2cd..1ce1051898 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,13 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
@@ -74,11 +73,11 @@ public final class BinaryJoinTableAnnotation
// ********** JoinTableAnnotation implementation **********
// ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
+ public ListIterable<JoinColumnAnnotation> getJoinColumns() {
+ return new LiveCloneListIterable<JoinColumnAnnotation>(this.joinColumns);
}
- public int joinColumnsSize() {
+ public int getJoinColumnsSize() {
return this.joinColumns.size();
}
@@ -86,10 +85,6 @@ public final class BinaryJoinTableAnnotation
return this.joinColumns.get(index);
}
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
public JoinColumnAnnotation addJoinColumn(int index) {
throw new UnsupportedOperationException();
}
@@ -118,11 +113,11 @@ public final class BinaryJoinTableAnnotation
// ***** inverse join columns
- public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.inverseJoinColumns);
+ public ListIterable<JoinColumnAnnotation> getInverseJoinColumns() {
+ return new LiveCloneListIterable<JoinColumnAnnotation>(this.inverseJoinColumns);
}
- public int inverseJoinColumnsSize() {
+ public int getInverseJoinColumnsSize() {
return this.inverseJoinColumns.size();
}
@@ -130,10 +125,6 @@ public final class BinaryJoinTableAnnotation
return this.inverseJoinColumns.get(index);
}
- public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.inverseJoinColumns.indexOf(joinColumn);
- }
-
public JoinColumnAnnotation addInverseJoinColumn(int index) {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java
index 660ea9f218..1a76ccda72 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,7 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
/**
@@ -20,7 +21,7 @@ public final class BinaryLobAnnotation
extends BinaryAnnotation
implements LobAnnotation
{
- public BinaryLobAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryLobAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
index 13e474a8b5..4ddce31bf8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,10 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToMany2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.ManyToMany
@@ -26,7 +26,7 @@ public final class BinaryManyToManyAnnotation
private String mappedBy;
- public BinaryManyToManyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryManyToManyAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.mappedBy = this.buildMappedBy();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
index f3f9ae511e..22354e7e5d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,10 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToOne2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.ManyToOne
@@ -26,7 +26,7 @@ public final class BinaryManyToOneAnnotation
private Boolean optional;
- public BinaryManyToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryManyToOneAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.optional = this.buildOptional();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
index 06cced26d1..f6a6365d9d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,9 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
/**
@@ -26,7 +27,7 @@ public final class BinaryMapKeyAnnotation
private String name;
- public BinaryMapKeyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryMapKeyAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.name = this.buildName();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
index 94053e7423..9f23315f7e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,15 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
public final class BinaryMappedSuperclassAnnotation
extends BinaryAnnotation
implements MappedSuperclassAnnotation
{
- public BinaryMappedSuperclassAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryMappedSuperclassAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
index a10b169070..3ccea81a5a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,8 +11,9 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java
deleted file mode 100644
index 2163b1fd50..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
-
-/**
- * javax.persistence.NamedNativeQueries
- */
-public final class BinaryNamedNativeQueriesAnnotation
- extends BinaryContainerAnnotation<NestableNamedNativeQueryAnnotation>
- implements NamedNativeQueriesAnnotation
-{
- private final Vector<NestableNamedNativeQueryAnnotation> namedNativeQueries;
-
-
- public BinaryNamedNativeQueriesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.namedNativeQueries = this.buildNamedNativeQueries();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public Iterable<NestableNamedNativeQueryAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableNamedNativeQueryAnnotation>(this.namedNativeQueries);
- }
-
- public int getNestedAnnotationsSize() {
- return this.namedNativeQueries.size();
- }
-
- private Vector<NestableNamedNativeQueryAnnotation> buildNamedNativeQueries() {
- Object[] jdtQueries = this.getJdtMemberValues(JPA.NAMED_NATIVE_QUERIES__VALUE);
- Vector<NestableNamedNativeQueryAnnotation> result = new Vector<NestableNamedNativeQueryAnnotation>(jdtQueries.length);
- for (Object jdtQuery : jdtQueries) {
- result.add(new BinaryNamedNativeQueryAnnotation(this, (IAnnotation) jdtQuery));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNamedNativeQueries();
- }
-
- // TODO
- private void updateNamedNativeQueries() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
index dfd105b1b6..f815dc0b8e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,17 +11,17 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
/**
* javax.persistence.NamedNativeQuery
*/
public final class BinaryNamedNativeQueryAnnotation
extends BinaryQueryAnnotation
- implements NestableNamedNativeQueryAnnotation
+ implements NamedNativeQueryAnnotation
{
private String resultClass;
private String resultSetMapping;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java
deleted file mode 100644
index 9c6a2e4965..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
-
-/**
- * javax.persistence.NamedQueries
- */
-public abstract class BinaryNamedQueriesAnnotation
- extends BinaryContainerAnnotation<NestableNamedQueryAnnotation>
- implements NamedQueriesAnnotation
-{
- private final Vector<NestableNamedQueryAnnotation> namedQueries;
-
-
- public BinaryNamedQueriesAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.namedQueries = this.buildNamedQueries();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public Iterable<NestableNamedQueryAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableNamedQueryAnnotation>(this.namedQueries);
- }
-
- public int getNestedAnnotationsSize() {
- return this.namedQueries.size();
- }
-
- private Vector<NestableNamedQueryAnnotation> buildNamedQueries() {
- Object[] jdtQueries = this.getJdtMemberValues(JPA.NAMED_QUERIES__VALUE);
- Vector<NestableNamedQueryAnnotation> result = new Vector<NestableNamedQueryAnnotation>(jdtQueries.length);
- for (Object jdtQuery : jdtQueries) {
- result.add(this.buildNamedQuery(jdtQuery));
- }
- return result;
- }
-
- protected abstract NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery);
-
- @Override
- public void update() {
- super.update();
- this.updateNamedQueries();
- }
-
- // TODO
- private void updateNamedQueries() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
index 938575cbb0..878abcbded 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,16 +10,16 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
/**
* javax.persistence.NamedQuery
*/
public abstract class BinaryNamedQueryAnnotation
extends BinaryQueryAnnotation
- implements NestableNamedQueryAnnotation
+ implements NamedQueryAnnotation
{
public BinaryNamedQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java
deleted file mode 100644
index 5cc726ad3a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-
-/**
- * Binary convenience methods
- */
-// TODO hopefully this class can go away with some sort of refactoring of the
-// source and binary hierarchies...
-public abstract class BinaryNode
- extends AbstractJavaResourceNode
-{
- // ********** construction **********
-
- protected BinaryNode(JavaResourceNode parent) {
- super(parent);
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- @Override
- public IFile getFile() {
- return null; // only BinaryPackageFragmentRoot has a file...
- }
-
- public void update() {
- // nothing by default
- }
-
- public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public void initialize(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
index 67775fa2aa..e01e8b6358 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToMany2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.OneToMany
@@ -28,7 +28,7 @@ public final class BinaryOneToManyAnnotation
private Boolean orphanRemoval; //added in JPA 2.0
- public BinaryOneToManyAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryOneToManyAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.mappedBy = this.buildMappedBy();
this.orphanRemoval = this.buildOrphanRemoval();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
index ac9bce72a0..8f5ea9c86d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToOne2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.OneToOne
@@ -28,7 +28,7 @@ public class BinaryOneToOneAnnotation
private String mappedBy;
private Boolean orphanRemoval; //added in JPA 2.0
- public BinaryOneToOneAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryOneToOneAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.optional = this.buildOptional();
this.mappedBy = this.buildMappedBy();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
index 1f9df3c60c..6baa37d375 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,9 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
/**
@@ -26,7 +27,7 @@ public final class BinaryOrderByAnnotation
private String value;
- public BinaryOrderByAnnotation(JavaResourcePersistentAttribute parent, IAnnotation annotation) {
+ public BinaryOrderByAnnotation(JavaResourceAnnotatedElement parent, IAnnotation annotation) {
super(parent, annotation);
this.value = this.buildValue();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
index 642e936e55..096800ba09 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,8 +11,9 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java
deleted file mode 100644
index cc8623e16f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceClassFile;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * binary package fragment
- */
-final class BinaryPackageFragment
- extends BinaryNode
- implements JavaResourcePackageFragment
-{
- /** JDT package fragment */
- private final IPackageFragment packageFragment;
-
- /**
- * class files in the package fragment;
- * we only hold class files/types that are actually annotated;
- * if the unannotated types are needed (e.g. for orm.xml or an
- * inheritance tree) they can be discovered on the classpath as needed
- */
- private final Vector<JavaResourceClassFile> classFiles = new Vector<JavaResourceClassFile>();
-
-
- // ********** construction/initialization **********
-
- BinaryPackageFragment(JavaResourcePackageFragmentRoot parent, IPackageFragment packageFragment) {
- super(parent);
- this.packageFragment = packageFragment;
- this.classFiles.addAll(this.buildClassFiles());
- }
-
- private Collection<JavaResourceClassFile> buildClassFiles() {
- IJavaElement[] children = this.getJDTChildren();
- ArrayList<JavaResourceClassFile> result = new ArrayList<JavaResourceClassFile>(children.length);
- for (IJavaElement child : children) {
- IClassFile jdtClassFile = (IClassFile) child;
- IType jdtType = jdtClassFile.getType();
- if (BinaryPersistentType.typeIsPersistable(jdtType)) {
- JavaResourceClassFile classFile = new BinaryClassFile(this, jdtClassFile, jdtType);
- if (classFile.getPersistentType().isAnnotated()) { // we only hold annotated types
- result.add(classFile);
- }
- }
- }
- return result;
- }
-
-
- // ********** JarResourceNode implementation **********
-
- @Override
- public void update() {
- super.update();
- this.updateClassFiles();
- }
-
- // TODO
- private void updateClassFiles() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** JavaResourcePackageFragment implementation **********
-
- public ListIterator<JavaResourceClassFile> classFiles() {
- return new CloneListIterator<JavaResourceClassFile>(this.classFiles);
- }
-
- public int classFilesSize() {
- return this.classFiles.size();
- }
-
- public Iterator<JavaResourcePersistentType> persistedTypes() {
- return new TransformationIterator<JavaResourceClassFile, JavaResourcePersistentType>(this.classFiles()) {
- @Override
- protected JavaResourcePersistentType transform(JavaResourceClassFile classFile) {
- return classFile.getPersistentType(); // we only hold annotated types
- }
- };
- }
-
-
- // ********** misc **********
-
- private IJavaElement[] getJDTChildren() {
- try {
- return this.packageFragment.getChildren();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return EMPTY_JAVA_ELEMENT_ARRAY;
- }
- }
- protected static final IJavaElement[] EMPTY_JAVA_ELEMENT_ARRAY = new IJavaElement[0];
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.packageFragment.getElementName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java
deleted file mode 100644
index dd6367e6ae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jpt.common.core.internal.utility.JDTTools;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * binary package fragment root
- */
-public final class BinaryPackageFragmentRoot
- extends RootBinaryNode
- implements JavaResourcePackageFragmentRoot
-{
- /** JDT package fragment root */
- private final IPackageFragmentRoot packageFragmentRoot;
-
- /** package fragments in the JAR */
- private final Vector<JavaResourcePackageFragment> packageFragments = new Vector<JavaResourcePackageFragment>();
-
-
- // ********** construction/initialization **********
-
- public BinaryPackageFragmentRoot(IPackageFragmentRoot packageFragmentRoot, JpaAnnotationProvider annotationProvider) {
- super(null, annotationProvider); // the package fragment root is the root of its sub-tree
- this.packageFragmentRoot = packageFragmentRoot;
- this.packageFragments.addAll(this.buildPackageFragments());
- }
-
- private Collection<JavaResourcePackageFragment> buildPackageFragments() {
- IJavaElement[] jdtChildren = this.getJDTChildren();
- ArrayList<JavaResourcePackageFragment> result = new ArrayList<JavaResourcePackageFragment>(jdtChildren.length);
- for (IJavaElement child : jdtChildren) {
- result.add(new BinaryPackageFragment(this, (IPackageFragment) child));
- }
- return result;
- }
-
-
- // ********** overrides **********
-
- @Override
- public IFile getFile() {
- return (IFile) this.packageFragmentRoot.getResource();
- }
-
- @Override
- public void update() {
- super.update();
- this.updatePackageFragments();
- }
-
- // TODO
- private void updatePackageFragments() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- /**
- * NB: we hold only annotated types
- */
- public Iterator<JavaResourcePersistentType> persistentTypes() {
- return new CompositeIterator<JavaResourcePersistentType>(this.persistedTypesLists());
- }
-
- private Iterator<Iterator<JavaResourcePersistentType>> persistedTypesLists() {
- return new TransformationIterator<JavaResourcePackageFragment, Iterator<JavaResourcePersistentType>>(this.packageFragments()) {
- @Override
- protected Iterator<JavaResourcePersistentType> transform(JavaResourcePackageFragment fragment) {
- return fragment.persistedTypes();
- }
- };
- }
-
-
- // ********** JavaResourcePackageFragmentRoot implementation **********
-
- public Iterator<JavaResourcePackageFragment> packageFragments() {
- return new CloneIterator<JavaResourcePackageFragment>(this.packageFragments);
- }
-
- public int packageFragmentsSize() {
- return this.packageFragments.size();
- }
-
-
- // ********** misc **********
-
- private IJavaElement[] getJDTChildren() {
- return JDTTools.getChildren(this.packageFragmentRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java
deleted file mode 100644
index 5dd4678578..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java
+++ /dev/null
@@ -1,657 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools;
-import org.eclipse.jpt.common.utility.MethodSignature;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.NameTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * binary persistent attribute (field or property)
- */
-final class BinaryPersistentAttribute
- extends BinaryPersistentMember
- implements JavaResourcePersistentAttribute
-{
- private int modifiers;
-
- private String typeName;
-
- private boolean typeIsInterface;
-
- private boolean typeIsEnum;
-
- private final Vector<String> typeSuperclassNames = new Vector<String>();
-
- private final Vector<String> typeInterfaceNames = new Vector<String>();
-
- private final Vector<String> typeTypeArgumentNames = new Vector<String>();
-
-
- BinaryPersistentAttribute(JavaResourcePersistentType parent, IField field) {
- this(parent, new FieldAdapter(field));
- }
-
- BinaryPersistentAttribute(JavaResourcePersistentType parent, IMethod method) {
- this(parent, new MethodAdapter(method));
- }
-
- private BinaryPersistentAttribute(JavaResourcePersistentType parent, Adapter adapter) {
- super(parent, adapter);
- this.modifiers = this.buildModifiers();
- this.typeName = this.buildTypeName();
-
- IType type = this.getType(); // shouldn't be an array...
- this.typeIsInterface = this.buildTypeIsInterface(type);
- this.typeIsEnum = this.buildTypeIsEnum(type);
- this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(type));
- this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(type));
-
- this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames());
- }
-
-
- // ******** overrides ********
-
- @Override
- public void update() {
- super.update();
- this.setModifiers(this.buildModifiers());
- this.setTypeName(this.buildTypeName());
-
- IType type = this.getType(); // shouldn't be an array...
- this.setTypeIsInterface(this.buildTypeIsInterface(type));
- this.setTypeIsEnum(this.buildTypeIsEnum(type));
- this.setTypeSuperclassNames(this.buildTypeSuperclassNames(type));
- this.setTypeInterfaceNames(this.buildTypeInterfaceNames(type));
-
- this.setTypeTypeArgumentNames(this.buildTypeTypeArgumentNames());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ********** BinaryPersistentMember implementation **********
-
- private Adapter getAdapter() {
- return (Adapter) this.adapter;
- }
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().attributeAnnotationNames();
- }
-
- @Override
- Annotation buildAnnotation(IAnnotation jdtAnnotation) {
- return this.getAnnotationProvider().buildAttributeAnnotation(this, jdtAnnotation);
- }
-
- Annotation buildNullAnnotation_(String annotationName) {
- return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
- }
-
-
- // ********** JavaResourcePersistentAttribute implementation **********
-
- @Override
- public JavaResourcePersistentType getParent() {
- return (JavaResourcePersistentType) super.getParent();
- }
-
- public JavaResourcePersistentType getResourcePersistentType() {
- return this.getParent();
- }
-
- public String getName() {
- return this.getAdapter().getAttributeName();
- }
-
- @Override
- public Annotation buildNullAnnotation(String annotationName) {
- return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
- }
-
- public boolean isField() {
- return this.getAdapter().isField();
- }
-
- public boolean isProperty() {
- return ! this.isField();
- }
-
- public boolean isFor(MethodSignature methodSignature, int occurrence) {
- throw new UnsupportedOperationException();
- }
-
- public AccessType getSpecifiedAccess() {
- Access2_0Annotation accessAnnotation = (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
- return accessAnnotation == null ? null : accessAnnotation.getValue();
- }
-
- public boolean typeIsSubTypeOf(String tn) {
- return ((this.typeName != null) && this.typeName.equals(tn))
- || this.typeInterfaceNames.contains(tn)
- || this.typeSuperclassNames.contains(tn);
- }
-
- public boolean typeIsVariablePrimitive() {
- return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName);
- }
-
- // ***** modifiers
- public int getModifiers() {
- return this.modifiers;
- }
-
- private void setModifiers(int modifiers) {
- int old = this.modifiers;
- this.modifiers = modifiers;
- this.firePropertyChanged(MODIFIERS_PROPERTY, old, modifiers);
- }
-
- /**
- * zero seems like a reasonable default...
- */
- private int buildModifiers() {
- try {
- return this.getMember().getFlags();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return 0;
- }
- }
-
- // ***** type name
- public String getTypeName() {
- return this.typeName;
- }
-
- private void setTypeName(String typeName) {
- String old = this.typeName;
- this.typeName = typeName;
- this.firePropertyChanged(TYPE_NAME_PROPERTY, old, typeName);
- }
-
- /**
- * JARs don't have array types;
- * also, no generic type parameters
- */
- private String buildTypeName() {
- return convertTypeSignatureToTypeName(this.getTypeSignature());
- }
-
- // ***** type is interface
- public boolean typeIsInterface() {
- return this.typeIsInterface;
- }
-
- private void setTypeIsInterface(boolean typeIsInterface) {
- boolean old = this.typeIsInterface;
- this.typeIsInterface = typeIsInterface;
- this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, typeIsInterface);
- }
-
- private boolean buildTypeIsInterface(IType type) {
- try {
- return (type != null) && type.isInterface();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- // ***** type is enum
- public boolean typeIsEnum() {
- return this.typeIsEnum;
- }
-
- private void setTypeIsEnum(boolean typeIsEnum) {
- boolean old = this.typeIsEnum;
- this.typeIsEnum = typeIsEnum;
- this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, typeIsEnum);
- }
-
- private boolean buildTypeIsEnum(IType type) {
- try {
- return (type != null) && type.isEnum();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- // ***** type superclass hierarchy
- public ListIterator<String> typeSuperclassNames() {
- return new CloneListIterator<String>(this.typeSuperclassNames);
- }
-
- public boolean typeSuperclassNamesContains(String superclassName) {
- return this.typeSuperclassNames.contains(superclassName);
- }
-
- private void setTypeSuperclassNames(List<String> typeSuperclassNames) {
- this.synchronizeList(typeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST);
- }
-
- private List<String> buildTypeSuperclassNames(IType type) {
- if (type == null) {
- return Collections.emptyList();
- }
-
- ArrayList<String> names = new ArrayList<String>();
- type = this.findSuperclass(type);
- while (type != null) {
- names.add(type.getFullyQualifiedName('.')); // no parameters are included here
- type = this.findSuperclass(type);
- }
- return names;
- }
-
- // ***** type interface hierarchy
- public Iterator<String> typeInterfaceNames() {
- return new CloneIterator<String>(this.typeInterfaceNames);
- }
-
- public boolean typeInterfaceNamesContains(String interfaceName) {
- return this.typeInterfaceNames.contains(interfaceName);
- }
-
- private void setTypeInterfaceNames(Collection<String> typeInterfaceNames) {
- this.synchronizeCollection(typeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION);
- }
-
- private Collection<String> buildTypeInterfaceNames(IType type) {
- if (type == null) {
- return Collections.emptySet();
- }
-
- HashSet<String> names = new HashSet<String>();
- while (type != null) {
- this.addInterfaceNamesTo(type, names);
- type = this.findSuperclass(type);
- }
- return names;
- }
-
- private void addInterfaceNamesTo(IType type, HashSet<String> names) {
- for (String interfaceSignature : this.getSuperInterfaceTypeSignatures(type)) {
- String interfaceName = convertTypeSignatureToTypeName(interfaceSignature);
- names.add(interfaceName);
- IType interfaceType = this.findType(interfaceName);
- if (interfaceType != null) {
- this.addInterfaceNamesTo(interfaceType, names); // recurse
- }
- }
- }
-
- // ***** type type argument names
- public ListIterator<String> typeTypeArgumentNames() {
- return new CloneListIterator<String>(this.typeTypeArgumentNames);
- }
-
- public int typeTypeArgumentNamesSize() {
- return this.typeTypeArgumentNames.size();
- }
-
- public String getTypeTypeArgumentName(int index) {
- return this.typeTypeArgumentNames.get(index);
- }
-
- private void setTypeTypeArgumentNames(List<String> typeTypeArgumentNames) {
- this.synchronizeList(typeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST);
- }
-
- /**
- * these types can be arrays (e.g. "java.lang.String[]");
- * but they won't have any further nested generic type arguments
- * (e.g. "java.util.Collection<java.lang.String>")
- */
- private List<String> buildTypeTypeArgumentNames() {
- String typeSignature = this.getTypeSignature();
- if (typeSignature == null) {
- return Collections.emptyList();
- }
-
- String[] typeArgumentSignatures = Signature.getTypeArguments(typeSignature);
- if (typeArgumentSignatures.length == 0) {
- return Collections.emptyList();
- }
-
- ArrayList<String> names = new ArrayList<String>(typeArgumentSignatures.length);
- for (String typeArgumentSignature : typeArgumentSignatures) {
- names.add(convertTypeSignatureToTypeName(typeArgumentSignature));
- }
- return names;
- }
-
-
- // ********** convenience methods **********
-
- private String getTypeSignature() {
- try {
- return this.getAdapter().getTypeSignature();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return null;
- }
- }
-
- private IType findSuperclass(IType type) {
- return this.findTypeBySignature(this.getSuperclassSignature(type));
- }
-
- private String getSuperclassSignature(IType type) {
- try {
- return type.getSuperclassTypeSignature();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return null;
- }
- }
-
- private String[] getSuperInterfaceTypeSignatures(IType type) {
- try {
- return type.getSuperInterfaceTypeSignatures();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return StringTools.EMPTY_STRING_ARRAY;
- }
- }
-
- private IType findTypeBySignature(String typeSignature) {
- return (typeSignature == null) ? null : this.findType(convertTypeSignatureToTypeName_(typeSignature));
- }
-
- private IType getType() {
- return (this.typeName == null) ? null : this.findType(this.typeName);
- }
-
- private IType findType(String fullyQualifiedName) {
- try {
- return this.getJavaProject().findType(fullyQualifiedName);
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return null;
- }
- }
-
- private IJavaProject getJavaProject() {
- return this.getMember().getJavaProject();
- }
-
-
-
- // ********** adapters **********
-
- /**
- * Adapt an IField or IMethod.
- */
- interface Adapter
- extends BinaryPersistentMember.Adapter
- {
- /**
- * Return the field or getter method's "attribute" name
- * (e.g. field "foo" -> "foo"; method "getFoo" -> "foo").
- */
- String getAttributeName();
-
- /**
- * Return whether the attribute is a Java field (as opposed to a method).
- */
- boolean isField();
-
- /**
- * Return the attribute's type signature.
- */
- String getTypeSignature() throws JavaModelException;
- }
-
- /**
- * IField adapter
- */
- static class FieldAdapter
- implements Adapter
- {
- final IField field;
-
- FieldAdapter(IField field) {
- super();
- this.field = field;
- }
-
- public IField getElement() {
- return this.field;
- }
-
- public boolean isPersistable() {
- return this.field.exists() && JPTTools.fieldIsPersistable(new JPTToolsAdapter());
- }
-
- public IAnnotation[] getAnnotations() throws JavaModelException {
- return this.field.getAnnotations();
- }
-
- public String getAttributeName() {
- return this.field.getElementName();
- }
-
- public boolean isField() {
- return true;
- }
-
- public String getTypeSignature() throws JavaModelException {
- return this.field.getTypeSignature();
- }
-
- /**
- * JPTTools needs an adapter so it can work with either an IField
- * or an IVariableBinding etc.
- */
- class JPTToolsAdapter implements JPTTools.FieldAdapter {
- public int getModifiers() {
- try {
- return FieldAdapter.this.field.getFlags();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return 0;
- }
- }
-
- }
-
- }
-
- /**
- * IMethod adapter
- */
- static class MethodAdapter
- implements Adapter
- {
- final IMethod method;
- static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0];
-
- MethodAdapter(IMethod method) {
- super();
- this.method = method;
- }
-
- public IMethod getElement() {
- return this.method;
- }
-
- public boolean isPersistable() {
- return JPTTools.methodIsPersistablePropertyGetter(new JPTToolsAdapter());
- }
-
- public IAnnotation[] getAnnotations() throws JavaModelException {
- return this.method.getAnnotations();
- }
-
- public String getAttributeName() {
- return NameTools.convertGetterSetterMethodNameToPropertyName(this.method.getElementName());
- }
-
- public boolean isField() {
- return false;
- }
-
- public String getTypeSignature() throws JavaModelException {
- return this.method.getReturnType();
- }
-
- /**
- * JPTTools needs an adapter so it can work with either an IMethod
- * or an IMethodBinding etc.
- */
- abstract static class AbstractJPTToolsAdapter
- implements JPTTools.SimpleMethodAdapter
- {
- AbstractJPTToolsAdapter() {
- super();
- }
-
- abstract IMethod getMethod();
-
- public int getModifiers() {
- try {
- return this.getMethod().getFlags();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return 0;
- }
- }
-
- public String getReturnTypeErasureName() {
- return convertTypeSignatureToTypeName(this.getReturnTypeSignature());
- }
-
- private String getReturnTypeSignature() {
- try {
- return this.getMethod().getReturnType();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return null;
- }
- }
-
- public boolean isConstructor() {
- try {
- return this.getMethod().isConstructor();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- }
-
- static class SimpleJPTToolsAdapter
- extends AbstractJPTToolsAdapter
- {
- private final IMethod method;
-
- SimpleJPTToolsAdapter(IMethod method) {
- super();
- this.method = method;
- }
-
- @Override
- IMethod getMethod() {
- return this.method;
- }
-
- }
-
- class JPTToolsAdapter
- extends AbstractJPTToolsAdapter
- implements JPTTools.MethodAdapter
- {
- JPTToolsAdapter() {
- super();
- }
-
- @Override
- IMethod getMethod() {
- return MethodAdapter.this.method;
- }
-
- public String getName() {
- return this.getMethod().getElementName();
- }
-
- public int getParametersLength() {
- return this.getMethod().getParameterTypes().length;
- }
-
- public JPTTools.SimpleMethodAdapter getSibling(String name) {
- for (IMethod sibling : this.getSiblings()) {
- if ((sibling.getParameterTypes().length == 0)
- && sibling.getElementName().equals(name)) {
- return new SimpleJPTToolsAdapter(sibling);
- }
- }
- return null;
- }
-
- public JPTTools.SimpleMethodAdapter getSibling(String name, String parameterTypeErasureName) {
- for (IMethod sibling : this.getSiblings()) {
- String[] parmTypes = sibling.getParameterTypes();
- if ((parmTypes.length == 1)
- && sibling.getElementName().equals(name)
- && convertTypeSignatureToTypeName(parmTypes[0]).equals(parameterTypeErasureName)) {
- return new SimpleJPTToolsAdapter(sibling);
- }
- }
- return null;
- }
-
- private IMethod[] getSiblings() {
- try {
- return this.getMethod().getDeclaringType().getMethods();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return EMPTY_METHOD_ARRAY;
- }
- }
-
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java
deleted file mode 100644
index 90fc759dca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * binary persistent member
- */
-abstract class BinaryPersistentMember
- extends BinaryAnnotatedElement
- implements JavaResourcePersistentMember
-{
-
- boolean persistable;
-
- private boolean final_; // 'final' is a reserved word
-
-
- // ********** construction/initialization **********
-
- public BinaryPersistentMember(JavaResourceNode parent, Adapter adapter) {
- super(parent, adapter);
- this.persistable = this.buildPersistable();
- this.final_ = this.buildFinal();
- }
-
-
- private Adapter getAdapter() {
- return (Adapter) this.adapter;
- }
-
- // ********** updating **********
-
- @Override
- public void update() {
- super.update();
- this.setPersistable(this.buildPersistable());
- this.setFinal(this.buildFinal());
- }
-
-
- // ********** simple state **********
-
- public boolean isPersistable() {
- return this.persistable;
- }
-
- private void setPersistable(boolean persistable) {
- boolean old = this.persistable;
- this.persistable = persistable;
- this.firePropertyChanged(PERSISTABLE_PROPERTY, old, persistable);
- }
-
- private boolean buildPersistable() {
- return this.getAdapter().isPersistable();
- }
-
- // ***** final
- public boolean isFinal() {
- return this.final_;
- }
-
- private void setFinal(boolean final_) {
- boolean old = this.final_;
- this.final_ = final_;
- this.firePropertyChanged(FINAL_PROPERTY, old, final_);
- }
-
- private boolean buildFinal() {
- try {
- return Flags.isFinal(this.getMember().getFlags());
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
-
- // ********** miscellaneous **********
-
- IMember getMember() {
- return (IMember) this.adapter.getElement();
- }
-
- /**
- * convenience method
- */
- <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) {
- @SuppressWarnings("unchecked")
- Filter<T> filter = (Filter<T>) PERSISTABLE_MEMBER_FILTER;
- return new FilteringIterator<T>(members, filter);
- }
-
- /**
- * Strip off the type signature's parameters if present.
- * Convert to a readable string.
- */
- static String convertTypeSignatureToTypeName(String typeSignature) {
- return (typeSignature == null) ? null : convertTypeSignatureToTypeName_(typeSignature);
- }
-
- /**
- * no null check
- */
- static String convertTypeSignatureToTypeName_(String typeSignature) {
- return Signature.toString(Signature.getTypeErasure(typeSignature));
- }
-
-
- // ********** IMember adapter **********
-
- interface Adapter extends BinaryAnnotatedElement.Adapter {
- /**
- * Return the adapter's JDT member (IType, IField, IMethod).
- */
- IMember getElement();
-
- /**
- * Return whether the adapter's member is "persistable"
- * (i.e. according to the JPA spec the member can be mapped)
- */
- boolean isPersistable();
- }
-
-
- // ********** unsupported JavaResourceAnnotatedElement implementation **********
-
- @Override
- public Annotation addAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void removeAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public void resolveTypes(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isFor(String memberName, int occurrence) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java
deleted file mode 100644
index 876a38c278..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java
+++ /dev/null
@@ -1,700 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools;
-import org.eclipse.jpt.common.utility.MethodSignature;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * binary persistent type
- */
-final class BinaryPersistentType
- extends BinaryPersistentMember
- implements JavaResourcePersistentType2_0
-{
- private String name;
-
- private String qualifiedName;
-
- private String packageName;
-
- private String superclassQualifiedName;
-
- private String declaringTypeName;
-
- private boolean abstract_; // 'abstract' is a reserved word
-
- private boolean static_; // 'static' is a reserved word
-
- private boolean memberType;
-
- private boolean hasPrivateNoArgConstructor;
-
- private boolean hasNoArgConstructor;
-
- private final Vector<JavaResourcePersistentAttribute> fields;
-
- private final Vector<JavaResourcePersistentAttribute> methods;
-
-
- // ********** construction/initialization **********
-
- BinaryPersistentType(JavaResourceNode parent, IType type) {
- super(parent, new TypeAdapter(type));
- this.name = this.buildName();
- this.qualifiedName = this.buildQualifiedName();
- this.packageName = this.buildPackageName();
- this.superclassQualifiedName = this.buildSuperclassQualifiedName();
- this.declaringTypeName = this.buildDeclaringTypeName();
- this.abstract_ = this.buildAbstract();
- this.static_ = this.buildStatic();
- this.memberType = this.buildMemberType();
- this.hasNoArgConstructor = this.buildHasNoArgConstructor();
- this.hasPrivateNoArgConstructor = this.buildHasPrivateNoArgConstructor();
- this.fields = this.buildFields();
- this.methods = this.buildMethods();
- }
-
-
- // ********** overrides **********
-
- @Override
- public void update() {
- super.update();
- this.setName(this.buildName());
- this.setQualifiedName(this.buildQualifiedName());
- this.setPackageName(this.buildPackageName());
- this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName());
- this.setDeclaringTypeName(this.buildDeclaringTypeName());
- this.setAbstract(this.buildAbstract());
- this.setStatic(this.buildStatic());
- this.setMemberType(this.buildMemberType());
- this.setHasNoArgConstructor(this.buildHasNoArgConstructor());
- this.setHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor());
- this.updateFields();
- this.updateMethods();
- }
-
- // TODO
- private void updateFields() {
- throw new UnsupportedOperationException();
- }
-
- // TODO
- private void updateMethods() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** BinaryPersistentMember implementation **********
-
- @Override
- Annotation buildAnnotation(IAnnotation jdtAnnotation) {
- return this.getAnnotationProvider().buildTypeAnnotation(this, jdtAnnotation);
- }
-
- @Override
- Annotation buildNullAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName);
- }
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().typeAnnotationNames();
- }
-
-
- // ********** JavaResourcePersistentType implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- private void setName(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return this.getMember().getElementName();
- }
-
- // ***** qualified name
- public String getQualifiedName() {
- return this.qualifiedName;
- }
-
- private void setQualifiedName(String qualifiedName) {
- String old = this.qualifiedName;
- this.qualifiedName = qualifiedName;
- this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, qualifiedName);
- }
-
- private String buildQualifiedName() {
- return this.getMember().getFullyQualifiedName('.'); // no parameters are included here
- }
-
- // ***** package
- public String getPackageName() {
- return this.packageName;
- }
-
- private void setPackageName(String packageName) {
- String old = this.packageName;
- this.packageName = packageName;
- this.firePropertyChanged(PACKAGE_NAME_PROPERTY, old, packageName);
- }
-
- private String buildPackageName() {
- return this.getMember().getPackageFragment().getElementName();
- }
-
- public boolean isIn(IPackageFragment packageFragment) {
- return StringTools.stringsAreEqual(packageFragment.getElementName(), this.packageName);
- }
-
- // ***** superclass qualified name
- public String getSuperclassQualifiedName() {
- return this.superclassQualifiedName;
- }
-
- private void setSuperclassQualifiedName(String superclassQualifiedName) {
- String old = this.superclassQualifiedName;
- this.superclassQualifiedName = superclassQualifiedName;
- this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, superclassQualifiedName);
- }
-
- private String buildSuperclassQualifiedName() {
- return convertTypeSignatureToTypeName(this.getSuperclassTypeSignature());
- }
-
- private String getSuperclassTypeSignature() {
- try {
- return this.getMember().getSuperclassTypeSignature();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return null;
- }
- }
-
- // ***** declaring type name
- public String getDeclaringTypeName() {
- return this.declaringTypeName;
- }
-
- private void setDeclaringTypeName(String declaringTypeName) {
- String old = this.declaringTypeName;
- this.declaringTypeName = declaringTypeName;
- this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, declaringTypeName);
- }
-
- private String buildDeclaringTypeName() {
- IType declaringType = this.getMember().getDeclaringType();
- return (declaringType == null) ? null : declaringType.getFullyQualifiedName('.'); // no parameters are included here
- }
-
- // ***** abstract
- public boolean isAbstract() {
- return this.abstract_;
- }
-
- private void setAbstract(boolean abstract_) {
- boolean old = this.abstract_;
- this.abstract_ = abstract_;
- this.firePropertyChanged(ABSTRACT_PROPERTY, old, abstract_);
- }
-
- private boolean buildAbstract() {
- try {
- return Flags.isAbstract(this.getMember().getFlags());
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- // ***** static
- public boolean isStatic() {
- return this.static_;
- }
-
- private void setStatic(boolean static_) {
- boolean old = this.static_;
- this.static_ = static_;
- this.firePropertyChanged(STATIC_PROPERTY, old, static_);
- }
-
- private boolean buildStatic() {
- try {
- return Flags.isStatic(this.getMember().getFlags());
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- // ***** member
- public boolean isMemberType() {
- return this.memberType;
- }
-
- private void setMemberType(boolean memberType) {
- boolean old = this.memberType;
- this.memberType = memberType;
- this.firePropertyChanged(MEMBER_TYPE_PROPERTY, old, memberType);
- }
-
- private boolean buildMemberType() {
- try {
- return this.getMember().isMember();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- // ***** no-arg constructor
- public boolean hasNoArgConstructor() {
- return this.hasNoArgConstructor;
- }
-
- private void setHasNoArgConstructor(boolean hasNoArgConstructor) {
- boolean old = this.hasNoArgConstructor;
- this.hasNoArgConstructor = hasNoArgConstructor;
- this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, hasNoArgConstructor);
- }
-
- private boolean buildHasNoArgConstructor() {
- return this.findNoArgConstructor() != null;
- }
-
- private IMethod findNoArgConstructor() {
- try {
- for (IMethod method : this.getMember().getMethods()) {
- if (method.isConstructor()) {
- return method;
- }
- }
- }
- catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- }
- return null;
- }
-
- // ***** private no-arg constructor
- public boolean hasPrivateNoArgConstructor() {
- return this.hasPrivateNoArgConstructor;
- }
-
- private void setHasPrivateNoArgConstructor(boolean hasPrivateNoArgConstructor) {
- boolean old = this.hasPrivateNoArgConstructor;
- this.hasPrivateNoArgConstructor = hasPrivateNoArgConstructor;
- this.firePropertyChanged(PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY, old, hasPrivateNoArgConstructor);
- }
-
- private boolean buildHasPrivateNoArgConstructor() {
- IMethod method = this.findNoArgConstructor();
- try {
- return method != null && Flags.isPrivate(method.getFlags());
- }
- catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
-
- // ********** misc **********
-
- public boolean isMapped() {
- for (Annotation annotation : CollectionTools.iterable(annotations())) {
- if (this.annotationIsMappingAnnotation(annotation)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean annotationIsMappingAnnotation(Annotation annotation) {
- return CollectionTools.contains(this.mappingAnnotationNames(), annotation.getAnnotationName());
- }
-
- private Iterator<String> mappingAnnotationNames() {
- return this.getAnnotationProvider().typeMappingAnnotationNames();
- }
-
- /**
- * check only persistable attributes
- */
- public boolean hasAnyAnnotatedAttributes() {
- for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) {
- if (stream.next().isAnnotated()) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public IType getMember() {
- return (IType) super.getMember();
- }
-
-
- // ********** fields **********
-
- public Iterator<JavaResourcePersistentAttribute> fields() {
- return this.getFields().iterator();
- }
-
- private Iterable<JavaResourcePersistentAttribute> getFields() {
- return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.fields);
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableFields() {
- return this.persistableMembers(this.fields());
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() {
- return new FilteringIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- FIELD_ACCESS_TYPE_FILTER
- );
- }
-
- private void addField(JavaResourcePersistentAttribute field) {
- this.addItemToCollection(field, this.fields, FIELDS_COLLECTION);
- }
-
- private JavaResourcePersistentAttribute getField(String fieldName, int occurrence) {
- for (JavaResourcePersistentAttribute field : this.getFields()) {
- if (field.isFor(fieldName, occurrence)) {
- return field;
- }
- }
- return null;
- }
-
- private void removeFields(Collection<JavaResourcePersistentAttribute> remove) {
- this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION);
- }
-
- private Vector<JavaResourcePersistentAttribute> buildFields() {
- IField[] jdtFields = this.getFields(this.getMember());
- Vector<JavaResourcePersistentAttribute> result = new Vector<JavaResourcePersistentAttribute>(jdtFields.length);
- for (IField jdtField : jdtFields) {
- result.add(this.buildField(jdtField));
- }
- return result;
- }
-
- private IField[] getFields(IType type) {
- try {
- return type.getFields();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return EMPTY_FIELD_ARRAY;
- }
- }
- private static final IField[] EMPTY_FIELD_ARRAY = new IField[0];
-
- private JavaResourcePersistentAttribute buildField(IField jdtField) {
- return new BinaryPersistentAttribute(this, jdtField);
- }
-
-
- // ********** methods **********
-
- public Iterator<JavaResourcePersistentAttribute> methods() {
- return this.getMethods().iterator();
- }
-
- private Iterable<JavaResourcePersistentAttribute> getMethods() {
- return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.methods);
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableProperties() {
- return persistableMembers(this.methods());
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() {
- return new FilteringIterator<JavaResourcePersistentAttribute>(
- this.persistableProperties(),
- PROPERTY_ACCESS_TYPE_FILTER
- );
- }
-
- private JavaResourcePersistentAttribute getMethod(MethodSignature signature, int occurrence) {
- for (JavaResourcePersistentAttribute method : this.getMethods()) {
- if (method.isFor(signature, occurrence)) {
- return method;
- }
- }
- return null;
- }
-
- private void addMethod(JavaResourcePersistentAttribute method) {
- this.addItemToCollection(method, this.methods, METHODS_COLLECTION);
- }
-
- private void removeMethods(Collection<JavaResourcePersistentAttribute> remove) {
- this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION);
- }
-
- private Vector<JavaResourcePersistentAttribute> buildMethods() {
- IMethod[] jdtMethods = this.getMethods(this.getMember());
- Vector<JavaResourcePersistentAttribute> result = new Vector<JavaResourcePersistentAttribute>(jdtMethods.length);
- for (IMethod jdtMethod : jdtMethods) {
- result.add(this.buildMethod(jdtMethod));
- }
- return result;
- }
-
- private IMethod[] getMethods(IType type) {
- try {
- return type.getMethods();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return EMPTY_METHOD_ARRAY;
- }
- }
- private static final IMethod[] EMPTY_METHOD_ARRAY = new IMethod[0];
-
- private JavaResourcePersistentAttribute buildMethod(IMethod jdtMethod) {
- return new BinaryPersistentAttribute(this, jdtMethod);
- }
-
-
- // ********** attributes **********
-
- @SuppressWarnings("unchecked")
- public Iterator<JavaResourcePersistentAttribute> persistableAttributes() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- this.persistableProperties()
- );
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess) {
- switch (specifiedAccess) {
- case FIELD :
- return this.persistableAttributesForFieldAccessType();
- case PROPERTY :
- return this.persistableAttributesForPropertyAccessType();
- default :
- throw new IllegalArgumentException("unknown access: " + specifiedAccess); //$NON-NLS-1$
- }
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<JavaResourcePersistentAttribute> persistableAttributesForFieldAccessType() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- this.persistablePropertiesWithSpecifiedPropertyAccess()
- );
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<JavaResourcePersistentAttribute> persistableAttributesForPropertyAccessType() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableProperties(),
- this.persistableFieldsWithSpecifiedFieldAccess()
- );
- }
-
-
- // ********** IType adapter **********
-
- static class TypeAdapter implements Adapter {
- private final IType type;
-
- TypeAdapter(IType type) {
- super();
- this.type = type;
- }
-
- public IType getElement() {
- return this.type;
- }
-
- public boolean isPersistable() {
- return true; // we only build a JAR type if it is "persistable"
- }
-
- public IAnnotation[] getAnnotations() throws JavaModelException {
- return this.type.getAnnotations();
- }
-
- }
-
-
- // ********** "persistable" check **********
-
- static boolean typeIsPersistable(IType type) {
- return (type != null)
- && type.exists()
- && JPTTools.typeIsPersistable(new JPTToolsAdapter(type));
- }
-
-
- // ********** JPT tools adapter **********
-
- /**
- * JPTTools needs an adapter so it can work with either an IType
- * or an ITypeBinding etc.
- */
- static class JPTToolsAdapter implements JPTTools.TypeAdapter {
- private final IType type;
-
- protected JPTToolsAdapter(IType type) {
- super();
- if (type == null) {
- throw new NullPointerException();
- }
- this.type = type;
- }
-
- public int getModifiers() {
- try {
- return this.type.getFlags();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return 0;
- }
- }
-
- public boolean isAnnotation() {
- try {
- return this.type.isAnnotation();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isAnonymous() {
- try {
- return this.type.isAnonymous();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isArray() {
- return false; // ???
- }
-
- public boolean isEnum() {
- try {
- return this.type.isEnum();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isInterface() {
- try {
- return this.type.isInterface();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isLocal() {
- try {
- return this.type.isLocal();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isMember() {
- try {
- return this.type.isMember();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isPrimitive() {
- return false; // ???
- }
-
- }
-
-
- // ********** unsupported JavaResourcePersistentType implementation **********
-
- public Iterator<JavaResourcePersistentType> types() {
- throw new UnsupportedOperationException();
- }
-
- public Iterator<JavaResourcePersistentType> allTypes() {
- throw new UnsupportedOperationException();
- }
-
- public Iterator<JavaResourcePersistentType> persistableTypes() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isGeneratedMetamodelTopLevelType(IPackageFragmentRoot sourceFolder) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isGeneratedMetamodelTopLevelType() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isMetamodel() {
- throw new UnsupportedOperationException();
- }
-
- public GeneratedAnnotation getGeneratedAnnotation() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java
deleted file mode 100644
index 6452d7a519..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentTypeCache;
-
-/**
- * cache used to hold binary "external" Java resource persistent types
- * (typically derived from JARs on the project's build path)
- */
-public final class BinaryPersistentTypeCache
- extends RootBinaryNode
- implements JavaResourcePersistentTypeCache
-{
- /** populated on-demand */
- private final Vector<Entry> entries = new Vector<Entry>();
-
-
- // ********** construction **********
-
- public BinaryPersistentTypeCache(JpaAnnotationProvider annotationProvider) {
- super(null, annotationProvider);
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- public Iterator<JavaResourcePersistentType> persistentTypes() {
- return this.getPersistentTypes().iterator();
- }
-
- private Iterable<JavaResourcePersistentType> getPersistentTypes() {
- return new TransformationIterable<Entry, JavaResourcePersistentType>(this.getEntries()) {
- @Override
- protected JavaResourcePersistentType transform(Entry entry) {
- return entry.persistentType;
- }
- };
- }
-
- private Iterable<Entry> getEntries() {
- return new LiveCloneIterable<Entry>(this.entries);
- }
-
-
- // ********** JavaResourcePersistentTypeCache implementation **********
-
- public int persistentTypesSize() {
- return this.entries.size();
- }
-
- public JavaResourcePersistentType addPersistentType(IType jdtType) {
- Entry entry = this.buildEntry(jdtType);
- this.entries.add(entry);
- this.fireItemAdded(PERSISTENT_TYPES_COLLECTION, entry.persistentType);
- return entry.persistentType;
- }
-
- private Entry buildEntry(IType jdtType) {
- return new Entry(this.buildPersistentType(jdtType), jdtType.getResource());
- }
-
- private JavaResourcePersistentType buildPersistentType(IType jdtType) {
- return new BinaryPersistentType(this, jdtType);
- }
-
- public boolean removePersistentTypes(IFile jarFile) {
- boolean modified = false;
- for (Entry entry : this.getEntries()) {
- IResource resource = entry.resource;
- if ((resource != null) && resource.equals(jarFile)) {
- this.removeEntry(entry);
- modified = true;
- }
- }
- return modified;
- }
-
- private void removeEntry(Entry entry) {
- this.entries.remove(entry);
- this.fireItemRemoved(PERSISTENT_TYPES_COLLECTION, entry.persistentType);
- }
-
-
- // ********** overrides **********
-
- /**
- * Ignore changes to this collection. Adds can be ignored since they are triggered
- * by requests that will, themselves, trigger updates (typically during the
- * update of an object that calls a setter with the newly-created resource
- * type). Deletes will be accompanied by manual updates.
- */
- @Override
- protected void aspectChanged(String aspectName) {
- if ((aspectName != null) && ! aspectName.equals(PERSISTENT_TYPES_COLLECTION)) {
- super.aspectChanged(aspectName);
- }
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.entries);
- }
-
-
- // ********** cache entry **********
-
- /**
- * Associate a persistent type with its resource.
- * This will be a JAR in the case of a type loaded from a JAR that is in
- * the Eclipse workspace. The resource will be null for a type loaded
- * from a JAR or class directory outside of the workspace.
- */
- static class Entry {
- final JavaResourcePersistentType persistentType;
- final IResource resource;
-
- Entry(JavaResourcePersistentType persistentType, IResource resource) {
- super();
- this.persistentType = persistentType;
- this.resource = resource;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.persistentType);
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
index 9165a8395b..831e4c3ec2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,17 +11,17 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
/**
* javax.persistence.PrimaryKeyJoinColumn
*/
public final class BinaryPrimaryKeyJoinColumnAnnotation
extends BinaryNamedColumnAnnotation
- implements NestablePrimaryKeyJoinColumnAnnotation
+ implements PrimaryKeyJoinColumnAnnotation
{
private String referencedColumnName;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java
deleted file mode 100644
index e24dedd4c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumns
- */
-public final class BinaryPrimaryKeyJoinColumnsAnnotation
- extends BinaryContainerAnnotation<NestablePrimaryKeyJoinColumnAnnotation>
- implements PrimaryKeyJoinColumnsAnnotation
-{
- private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns;
-
-
- public BinaryPrimaryKeyJoinColumnsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.pkJoinColumns = this.buildPkJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- public int getNestedAnnotationsSize() {
- return this.pkJoinColumns.size();
- }
-
- private Vector<NestablePrimaryKeyJoinColumnAnnotation> buildPkJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE);
- Vector<NestablePrimaryKeyJoinColumnAnnotation> result = new Vector<NestablePrimaryKeyJoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryPrimaryKeyJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updatePkJoinColumns();
- }
-
- // TODO
- private void updatePkJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
-
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java
index bc528de494..9f9ce90081 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,14 +9,14 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
@@ -107,11 +107,12 @@ abstract class BinaryQueryAnnotation
}
// ***** hints
- public ListIterator<QueryHintAnnotation> hints() {
- return new CloneListIterator<QueryHintAnnotation>(this.hints);
+
+ public ListIterable<QueryHintAnnotation> getHints() {
+ return new LiveCloneListIterable<QueryHintAnnotation>(this.hints);
}
- public int hintsSize() {
+ public int getHintsSize() {
return this.hints.size();
}
@@ -119,10 +120,6 @@ abstract class BinaryQueryAnnotation
return this.hints.get(index);
}
- public int indexOfHint(QueryHintAnnotation queryHint) {
- return this.hints.indexOf(queryHint);
- }
-
public QueryHintAnnotation addHint(int index) {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
index f1d4ac8f92..119f055030 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,9 +11,10 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
index 365d2e5263..3c1056ace7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,12 +11,13 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.CascadeType;
import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.ManyToMany
@@ -38,7 +39,7 @@ abstract class BinaryRelationshipMappingAnnotation
boolean cascadeDetach; //added in JPA 2.0
- BinaryRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ BinaryRelationshipMappingAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
this.targetEntity = this.buildTargetEntity();
this.fetch = this.buildFetch();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
index f5c1983fea..fce7c76e93 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,22 +9,21 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
/**
* javax.persistence.SecondaryTable
*/
public final class BinarySecondaryTableAnnotation
extends BinaryBaseTableAnnotation
- implements NestableSecondaryTableAnnotation
+ implements SecondaryTableAnnotation
{
private final Vector<PrimaryKeyJoinColumnAnnotation> pkJoinColumns;
@@ -70,11 +69,11 @@ public final class BinarySecondaryTableAnnotation
// ************* SecondaryTableAnnotation implementation *******************
// ***** pk join columns
- public ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns() {
- return new CloneListIterator<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
+ public ListIterable<PrimaryKeyJoinColumnAnnotation> getPkJoinColumns() {
+ return new LiveCloneListIterable<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
}
- public int pkJoinColumnsSize() {
+ public int getPkJoinColumnsSize() {
return this.pkJoinColumns.size();
}
@@ -82,10 +81,6 @@ public final class BinarySecondaryTableAnnotation
return this.pkJoinColumns.get(index);
}
- public int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation pkJoinColumn) {
- return this.pkJoinColumns.indexOf(pkJoinColumn);
- }
-
public PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java
deleted file mode 100644
index 08d36f54c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
-
-/**
- * javax.persistence.SecondaryTables
- */
-public final class BinarySecondaryTablesAnnotation
- extends BinaryContainerAnnotation<NestableSecondaryTableAnnotation>
- implements SecondaryTablesAnnotation
-{
- private final Vector<NestableSecondaryTableAnnotation> secondaryTables;
-
-
- public BinarySecondaryTablesAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.secondaryTables = this.buildSecondaryTables();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public Iterable<NestableSecondaryTableAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableSecondaryTableAnnotation>(this.secondaryTables);
- }
-
- public int getNestedAnnotationsSize() {
- return this.secondaryTables.size();
- }
-
- private Vector<NestableSecondaryTableAnnotation> buildSecondaryTables() {
- Object[] jdtSecondaryTables = this.getJdtMemberValues(JPA.SECONDARY_TABLES__VALUE);
- Vector<NestableSecondaryTableAnnotation> result = new Vector<NestableSecondaryTableAnnotation>(jdtSecondaryTables.length);
- for (Object jdtSecondaryTable : jdtSecondaryTables) {
- result.add(new BinarySecondaryTableAnnotation(this, (IAnnotation) jdtSecondaryTable));
- }
- return result;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateSecondaryTables();
- }
-
- // TODO
- private void updateSecondaryTables() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
index e4d09f7098..2d382036a6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,9 +11,9 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java
index 939515dea4..ea667ebc11 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
/**
@@ -21,7 +21,7 @@ public final class BinaryTableAnnotation
extends BinaryBaseTableAnnotation
implements TableAnnotation
{
- public BinaryTableAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ public BinaryTableAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
index 4c3540ae1d..747e97689f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,15 +9,14 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
@@ -248,11 +247,11 @@ public final class BinaryTableGeneratorAnnotation
}
// ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
+ public ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
+ return new LiveCloneListIterable<UniqueConstraintAnnotation>(this.uniqueConstraints);
}
- public int uniqueConstraintsSize() {
+ public int getUniqueConstraintsSize() {
return this.uniqueConstraints.size();
}
@@ -260,10 +259,6 @@ public final class BinaryTableGeneratorAnnotation
return this.uniqueConstraints.get(index);
}
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- return this.uniqueConstraints.indexOf(uniqueConstraint);
- }
-
public UniqueConstraintAnnotation addUniqueConstraint(int index) {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
index c8faac2678..780b2aea62 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
/**
@@ -22,7 +22,7 @@ public final class BinaryTemporalAnnotation
implements TemporalAnnotation
{
- public BinaryTemporalAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryTemporalAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java
index dd7ad500ac..c6b06c9ed1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,7 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
/**
@@ -21,7 +22,7 @@ public final class BinaryTransientAnnotation
implements TransientAnnotation
{
- public BinaryTransientAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryTransientAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
index c88b2370bb..15536e6519 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,14 +9,14 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-import java.util.ListIterator;
import java.util.Vector;
-
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
/**
@@ -53,14 +53,18 @@ final class BinaryUniqueConstraintAnnotation
// ********** UniqueConstraintAnnotation implementation **********
// ***** column names
- public ListIterator<String> columnNames() {
- return new CloneListIterator<String>(this.columnNames);
+ public ListIterable<String> getColumnNames() {
+ return new LiveCloneListIterable<String>(this.columnNames);
}
- public int columnNamesSize() {
+ public int getColumnNamesSize() {
return this.columnNames.size();
}
+ public String columnNameAt(int index) {
+ return this.columnNames.elementAt(index);
+ }
+
private Vector<String> buildColumnNames() {
Object[] jdtColumnNames = this.getJdtMemberValues(JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES);
Vector<String> result = new Vector<String>(jdtColumnNames.length);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java
index d0a856b11b..df5cea5e93 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,7 +10,8 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
/**
@@ -21,7 +22,7 @@ public final class BinaryVersionAnnotation
implements VersionAnnotation
{
- public BinaryVersionAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ public BinaryVersionAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
super(parent, jdtAnnotation);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java
deleted file mode 100644
index baf9b674e1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceModelListener;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.utility.internal.ListenerList;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-
-/**
- * JAR and external types
- */
-abstract class RootBinaryNode
- extends BinaryNode
- implements JavaResourceNode.Root
-{
- /** pluggable annotation provider */
- private final JpaAnnotationProvider annotationProvider;
-
- /** listeners notified whenever the resource model changes */
- private final ListenerList<JptResourceModelListener> resourceModelListenerList = new ListenerList<JptResourceModelListener>(JptResourceModelListener.class);
-
-
- // ********** construction **********
-
- RootBinaryNode(JavaResourceNode parent, JpaAnnotationProvider annotationProvider) {
- super(parent);
- this.annotationProvider = annotationProvider;
- }
-
-
- // ********** overrides **********
-
- @Override
- protected boolean requiresParent() {
- return false;
- }
-
- @Override
- public Root getRoot() {
- return this;
- }
-
- @Override
- public JpaAnnotationProvider getAnnotationProvider() {
- return this.annotationProvider;
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- public void resourceModelChanged() {
- for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
- listener.resourceModelChanged(this);
- }
- }
-
-
- // ********** JptResourceModel implementation **********
-
- public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
-
- public void addResourceModelListener(JptResourceModelListener listener) {
- this.resourceModelListenerList.add(listener);
- }
-
- public void removeResourceModelListener(JptResourceModelListener listener) {
- this.resourceModelListenerList.remove(listener);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java
deleted file mode 100644
index 3a050867fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * Utility methods for manipulating annotation containers.
- */
-public final class AnnotationContainerTools {
-
- /**
- * Add a nested annotation to the specified annotation container
- * at the specified index.
- * This method modifies both the resource model annotation container and the
- * AST; with <em>no</em> change notification.
- */
- public static <T extends NestableAnnotation> NestableAnnotation addNestedAnnotation(int index, AnnotationContainer<T> annotationContainer) {
- // add a new annotation to the end of the list...
- int sourceIndex = annotationContainer.getNestedAnnotationsSize();
- T nestedAnnotation = annotationContainer.addNestedAnnotation();
- nestedAnnotation.newAnnotation();
- // ...then move it to the specified index
- moveNestedAnnotation(index, sourceIndex, annotationContainer);
- return nestedAnnotation;
- }
-
- /**
- * Move the nested annotation at the specified source index in the
- * specified annotation container to the specified target index.
- * This method modifies both the resource model annotation container and the
- * AST; with <em>no</em> change notification.
- */
- public static <T extends NestableAnnotation> void moveNestedAnnotation(int targetIndex, int sourceIndex, AnnotationContainer<T> annotationContainer) {
- if (targetIndex != sourceIndex) {
- moveNestedAnnotation_(targetIndex, sourceIndex, annotationContainer);
- }
- }
-
- private static <T extends NestableAnnotation> void moveNestedAnnotation_(int targetIndex, int sourceIndex, AnnotationContainer<T> annotationContainer) {
- NestableAnnotation nestedAnnotation = annotationContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- syncAstAnnotationsAfterMove(targetIndex, sourceIndex, annotationContainer, nestedAnnotation);
- }
-
- /**
- * An annotation was moved within the specified annotation container from
- * the specified source index to the specified target index.
- * Synchronize the AST annotations with the resource model annotation container,
- * starting with the lower index to prevent overlap.
- */
- private static <T extends NestableAnnotation> void syncAstAnnotationsAfterMove(int targetIndex, int sourceIndex, AnnotationContainer<T> annotationContainer, NestableAnnotation nestedAnnotation) {
- // move the Java annotation to the end of the list...
- nestedAnnotation.moveAnnotation(annotationContainer.getNestedAnnotationsSize());
- // ...then shift the other AST annotations over one slot...
- List<T> nestableAnnotations = CollectionTools.list(annotationContainer.getNestedAnnotations());
- if (sourceIndex < targetIndex) {
- for (int i = sourceIndex; i < targetIndex; i++) {
- nestableAnnotations.get(i).moveAnnotation(i);
- }
- } else {
- for (int i = sourceIndex; i > targetIndex; i-- ) {
- nestableAnnotations.get(i).moveAnnotation(i);
- }
- }
- // ...then move the AST annotation to the now empty slot at the target index
- nestedAnnotation.moveAnnotation(targetIndex);
- }
-
- /**
- * Remove the nested annotation at the specified index in the
- * specified annotation container.
- * This method modifies both the resource model annotation container and the
- * AST; with <em>no</em> change notification.
- */
- public static <T extends NestableAnnotation> void removeNestedAnnotation(int index, AnnotationContainer<T> annotationContainer) {
- T nestedAnnotation = annotationContainer.removeNestedAnnotation(index);
- nestedAnnotation.removeAnnotation();
- syncAstAnnotationsAfterRemove(index, annotationContainer);
- }
-
- /**
- * An annotation was removed from the specified annotation container at the
- * specified index.
- * Synchronize the AST annotations with the resource model annotation container,
- * starting at the specified index to prevent overlap.
- */
- private static <T extends NestableAnnotation> void syncAstAnnotationsAfterRemove(int index, AnnotationContainer<T> annotationContainer) {
- List<T> nestableAnnotations = CollectionTools.list(annotationContainer.getNestedAnnotations());
- for (int i = index; i < nestableAnnotations.size(); i++) {
- // the indices are the same because the model annotations are
- // already in the proper locations - it's the AST annotations that
- // need to be moved to the matching location
- nestableAnnotations.get(i).moveAnnotation(i);
- }
- }
-
- /**
- * Initialize the specified resource model annotation container to be in
- * sync with the specified AST. No change notification will occur.
- */
- public static <T extends NestableAnnotation> void initialize(AnnotationContainer<T> annotationContainer, CompilationUnit astRoot) {
- // ignore the nested AST annotations themselves
- // (maybe someday we can use them during initialization...)
- int size = getNestedAstAnnotations(astRoot, annotationContainer).size();
- for (int i = 0; i < size; i++) {
- T nestedAnnotation = annotationContainer.addNestedAnnotation();
- nestedAnnotation.initialize(astRoot);
- }
- }
-
- /**
- * Return a list of the nested AST annotations.
- */
- private static <T extends NestableAnnotation> List<Annotation> getNestedAstAnnotations(CompilationUnit astRoot, AnnotationContainer<T> annotationContainer) {
- Annotation astContainerAnnotation = annotationContainer.getAstAnnotation(astRoot);
- if (astContainerAnnotation == null) {
- // seems unlikely the AST container annotation would be null,
- // since the resource container annotation is only created and
- // initialized (or synchronized) when the AST container annotation
- // is discovered
- return Collections.emptyList();
- }
-
- if (astContainerAnnotation.isMarkerAnnotation()) {
- return Collections.emptyList(); // no nested annotations
- }
-
- if (astContainerAnnotation.isSingleMemberAnnotation()) {
- return getNestedAstAnnotations((SingleMemberAnnotation) astContainerAnnotation, annotationContainer);
- }
-
- if (astContainerAnnotation.isNormalAnnotation()) {
- return getNestedAstAnnotations((NormalAnnotation) astContainerAnnotation, annotationContainer);
- }
-
- throw new IllegalStateException("unknown annotation type: " + astContainerAnnotation); //$NON-NLS-1$
- }
-
- private static <T extends NestableAnnotation> List<Annotation> getNestedAstAnnotations(SingleMemberAnnotation astContainerAnnotation, AnnotationContainer<T> annotationContainer) {
- return annotationContainer.getElementName().equals("value") ? //$NON-NLS-1$
- getAstAnnotations(astContainerAnnotation.getValue(), annotationContainer) :
- Collections.<Annotation>emptyList();
- }
-
- private static <T extends NestableAnnotation> List<Annotation> getNestedAstAnnotations(NormalAnnotation astContainerAnnotation, AnnotationContainer<T> annotationContainer) {
- MemberValuePair pair = getMemberValuePair(astContainerAnnotation, annotationContainer.getElementName());
- return (pair != null) ?
- getAstAnnotations(pair.getValue(), annotationContainer) :
- Collections.<Annotation>emptyList();
- }
-
- private static <T extends NestableAnnotation> List<Annotation> getAstAnnotations(Expression expression, AnnotationContainer<T> annotationContainer) {
- return (expression != null) ?
- getAstAnnotations_(expression, annotationContainer.getNestedAnnotationName()) :
- Collections.<Annotation>emptyList();
- }
-
- /**
- * pre-condition: expression is not null
- */
- private static <T extends NestableAnnotation> List<Annotation> getAstAnnotations_(Expression expression, String annotationName) {
- ArrayList<Annotation> result = new ArrayList<Annotation>();
- addAstAnnotationsTo(expression, annotationName, result);
- return result;
- }
-
- /**
- * pre-condition: expression is not null
- * <p>
- * Add whatever annotations are represented by the specified expression to
- * the specified list. Skip any non-annotation expressions.
- */
- private static void addAstAnnotationsTo(Expression expression, String annotationName, ArrayList<Annotation> astAnnotations) {
- if (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) {
- addAstAnnotationsTo((ArrayInitializer) expression, annotationName, astAnnotations);
- } else {
- addAstAnnotationTo(expression, annotationName, astAnnotations);
- }
- }
-
- private static void addAstAnnotationsTo(ArrayInitializer arrayInitializer, String annotationName, ArrayList<Annotation> astAnnotations) {
- @SuppressWarnings("unchecked")
- List<Expression> expressions = arrayInitializer.expressions();
- for (Expression expression : expressions) {
- if (expression != null) {
- addAstAnnotationTo(expression, annotationName, astAnnotations);
- }
- }
- }
-
- private static void addAstAnnotationTo(Expression expression, String annotationName, ArrayList<Annotation> astAnnotations) {
- switch (expression.getNodeType()) {
- case ASTNode.NORMAL_ANNOTATION:
- case ASTNode.SINGLE_MEMBER_ANNOTATION:
- case ASTNode.MARKER_ANNOTATION:
- Annotation astAnnotation = (Annotation) expression;
- if (getQualifiedName(astAnnotation).equals(annotationName)) {
- astAnnotations.add(astAnnotation);
- }
- break;
- default:
- break;
- }
- }
-
- private static String getQualifiedName(Annotation astAnnotation) {
- ITypeBinding typeBinding = astAnnotation.resolveTypeBinding();
- if (typeBinding != null) {
- String resolvedName = typeBinding.getQualifiedName();
- if (resolvedName != null) {
- return resolvedName;
- }
- }
- return astAnnotation.getTypeName().getFullyQualifiedName();
- }
-
- private static MemberValuePair getMemberValuePair(NormalAnnotation annotation, String elementName) {
- @SuppressWarnings("unchecked")
- List<MemberValuePair> pairs = annotation.values();
- for (MemberValuePair pair : pairs) {
- if (pair.getName().getFullyQualifiedName().equals(elementName)) {
- return pair;
- }
- }
- return null;
- }
-
- /**
- * Synchronize the resource model annotations in the specified annotation
- * container with those in the specified AST. Trigger the appropriate change
- * notification.
- */
- public static <T extends NestableAnnotation> void synchronize(AnnotationContainer<T> annotationContainer, CompilationUnit astRoot) {
- List<Annotation> astAnnotations = getNestedAstAnnotations(astRoot, annotationContainer);
- Iterator<Annotation> astAnnotationStream = astAnnotations.iterator();
-
- for (T nestedAnnotation : annotationContainer.getNestedAnnotations()) {
- if (astAnnotationStream.hasNext()) {
- // matching AST annotation is present - synchronize the nested annotation
- astAnnotationStream.next(); // maybe someday we can pass this to the update
- nestedAnnotation.synchronizeWith(astRoot);
- } else {
- // no more AST annotations - remove the remaining nested annotations and exit
- annotationContainer.syncRemoveNestedAnnotations(astAnnotations.size());
- return;
- }
- }
-
- // add nested annotations for any remaining AST annotations
- while (astAnnotationStream.hasNext()) {
- annotationContainer.syncAddNestedAnnotation(astAnnotationStream.next());
- }
- }
-
- private AnnotationContainerTools() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java
deleted file mode 100644
index 1f3388ef62..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * Java source annotated element (annotations)
- */
-abstract class SourceAnnotatedElement<A extends AnnotatedElement>
- extends SourceNode
- implements JavaResourceAnnotatedElement
-{
- final A annotatedElement;
-
- /**
- * annotations; no duplicates (java compiler has an error for duplicates)
- */
- final Vector<Annotation> annotations = new Vector<Annotation>();
-
- /**
- * these are built as needed
- */
- private final HashMap<String, Annotation> nullAnnotationCache = new HashMap<String, Annotation>();
-
-
- // ********** construction/initialization **********
-
- SourceAnnotatedElement(JavaResourceNode parent, A annotatedElement) {
- super(parent);
- this.annotatedElement = annotatedElement;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.annotatedElement.getBodyDeclaration(astRoot).accept(this.buildInitialAnnotationVisitor(astRoot));
- }
-
- private ASTVisitor buildInitialAnnotationVisitor(CompilationUnit astRoot) {
- return new InitialAnnotationVisitor(astRoot, this.annotatedElement.getBodyDeclaration(astRoot));
- }
-
- /**
- * called from {@link InitialAnnotationVisitor#visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation)}
- */
- /* CU private */ void addInitialAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot) {
- String astAnnotationName = ASTTools.resolveAnnotation(node);
- if (astAnnotationName != null) {
- this.addInitialAnnotation(astAnnotationName, astRoot);
- }
- }
-
- /**
- * pre-condition: <code>astAnnotationName</code> is not <code>null</code>
- */
- void addInitialAnnotation(String astAnnotationName, CompilationUnit astRoot) {
- if (this.annotationIsValid(astAnnotationName)) {
- if (this.selectAnnotationNamed(this.annotations, astAnnotationName) == null) { // ignore duplicates
- Annotation annotation = this.buildAnnotation(astAnnotationName);
- annotation.initialize(astRoot);
- this.annotations.add(annotation);
- }
- }
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncAnnotations(astRoot);
- }
-
-
- // ********** annotations **********
-
- public Iterator<Annotation> annotations() {
- return this.getAnnotations().iterator();
- }
-
- Iterable<Annotation> getAnnotations() {
- return new LiveCloneIterable<Annotation>(this.annotations);
- }
-
- public int annotationsSize() {
- return this.annotations.size();
- }
-
- public Annotation getAnnotation(String annotationName) {
- return this.selectAnnotationNamed(this.getAnnotations(), annotationName);
- }
-
- public Annotation getNonNullAnnotation(String annotationName) {
- Annotation annotation = this.getAnnotation(annotationName);
- return (annotation != null) ? annotation : this.getNullAnnotation(annotationName);
- }
-
- private synchronized Annotation getNullAnnotation(String annotationName) {
- Annotation annotation = this.nullAnnotationCache.get(annotationName);
- if (annotation == null) {
- annotation = this.buildNullAnnotation(annotationName);
- this.nullAnnotationCache.put(annotationName, annotation);
- }
- return annotation;
- }
-
- public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
- if (containerAnnotation != null) {
- return containerAnnotation.getNestedAnnotations().iterator();
- }
- NestableAnnotation nestableAnnotation = this.getNestableAnnotation(nestableAnnotationName);
- if (nestableAnnotation != null) {
- return new SingleElementIterator<NestableAnnotation>(nestableAnnotation);
- }
- return EmptyIterator.instance();
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) {
- return (ContainerAnnotation<NestableAnnotation>) this.getAnnotation(annotationName);
- }
-
- private NestableAnnotation getNestableAnnotation(String annotationName) {
- return (NestableAnnotation) this.getAnnotation(annotationName);
- }
-
- public Annotation addAnnotation(String annotationName) {
- Annotation annotation = this.buildAnnotation(annotationName);
- this.annotations.add(annotation);
- annotation.newAnnotation();
- return annotation;
- }
-
- /**
- * <ol>
- * <li>Check for a container annotation;
- * if it is present, add a nested annotation to it.
- * <li>Check for a stand-alone nested annotation;
- * if it is missing, add a stand-alone nested annotation.
- * <li>If there is an existing stand-alone nested annotation,
- * add a container annotation and move the stand-alone nested annotation to it
- * and add a new nested annotation to it also
- * <ol>
- */
- public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
- if (containerAnnotation != null) {
- // ignore any stand-alone nestable annotations and just add to the container annotation
- return AnnotationContainerTools.addNestedAnnotation(index, containerAnnotation);
- }
- NestableAnnotation standAloneAnnotation = this.getNestableAnnotation(nestableAnnotationName);
- if (standAloneAnnotation == null) {
- // add a stand-alone nestable annotation since neither the nestable nor the container exist
- return (NestableAnnotation) this.addAnnotation(nestableAnnotationName);
- }
- // move the stand-alone nestable annotation to a container and add another nestable
- return this.addSecondNestedAnnotation(index, containerAnnotationName, standAloneAnnotation);
- }
-
- /**
- * <ol>
- * <li>Build a new container annotation
- * <li>If the new annotation is to be added at index 0<ol>
- * <li>Add a new nestable annotation to the new container annotation
- * at index 0
- * <li>Move the existing stand-alone nestable annotation to the new
- * container annotation at index 1
- * </ol>
- * <li>If the new annotation is to be added at index 1<ol>
- * <li>Move the existing stand-alone nestable annotation to the new
- * container annotation at index 0
- * <li>Add a new nestable annotation to the new container annotation
- * at index 1
- * </ol>
- * </ol>
- */
- private NestableAnnotation addSecondNestedAnnotation(int index, String containerAnnotationName, NestableAnnotation standAloneAnnotation) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.buildContainerAnnotation(containerAnnotationName);
- this.annotations.add(containerAnnotation);
- containerAnnotation.newAnnotation();
-
- NestableAnnotation nestedAnnotation = null;
- switch (index) {
- case 0 :
- // adding new annotation at 0, so move the stand-alone to slot 1
- nestedAnnotation = containerAnnotation.addNestedAnnotation();
- nestedAnnotation.newAnnotation();
- this.annotations.remove(standAloneAnnotation);
- containerAnnotation.nestStandAloneAnnotation(standAloneAnnotation);
- break;
- case 1 :
- // adding new annotation at 1, so move the stand-alone to slot 0
- this.annotations.remove(standAloneAnnotation);
- containerAnnotation.nestStandAloneAnnotation(standAloneAnnotation);
- nestedAnnotation = containerAnnotation.addNestedAnnotation();
- nestedAnnotation.newAnnotation();
- break;
- default :
- throw new IllegalArgumentException("invalid index: " + index); //$NON-NLS-1$
- }
-
- return nestedAnnotation;
- }
-
- public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
- this.moveAnnotation(targetIndex, sourceIndex, this.getContainerAnnotation(containerAnnotationName));
- }
-
- private void moveAnnotation(int targetIndex, int sourceIndex, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, containerAnnotation);
- }
-
- public void removeAnnotation(String annotationName) {
- Annotation annotation = this.getAnnotation(annotationName);
- if (annotation != null) {
- this.removeAnnotation(annotation);
- }
- }
-
- private void removeAnnotation(Annotation annotation) {
- this.annotations.remove(annotation);
- annotation.removeAnnotation();
- }
-
- public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
- if (containerAnnotation == null) {
- if (index != 0) {
- throw new IllegalArgumentException("invalid index: " + index); //$NON-NLS-1$
- }
- this.removeAnnotation(this.getAnnotation(nestableAnnotationName));
- } else {
- this.removeAnnotation(index, containerAnnotation);
- }
- }
-
- /**
- * After we remove the nested annotation, check to see whether we need to
- * either remove the container (if it is empty) or convert the last nested
- * annotation to a stand-alone annotation.
- */
- private void removeAnnotation(int index, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
- AnnotationContainerTools.removeNestedAnnotation(index, containerAnnotation);
- switch (containerAnnotation.getNestedAnnotationsSize()) {
- case 0:
- this.removeAnnotation(containerAnnotation);
- break;
- case 1:
- this.convertLastNestedAnnotation(containerAnnotation);
- break;
- default:
- break;
- }
- }
-
- /**
- * Convert the last nested annotation in the container to a stand-alone
- * annotation and remove the container annotation.
- */
- private void convertLastNestedAnnotation(ContainerAnnotation<NestableAnnotation> containerAnnotation) {
- containerAnnotation.convertLastNestedAnnotationToStandAlone();
- this.annotations.remove(containerAnnotation);
- containerAnnotation.removeAnnotation();
- }
-
- public void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.annotations.add(standAloneAnnotation);
- }
-
- private boolean annotationIsValid(String annotationName) {
- return CollectionTools.contains(this.validAnnotationNames(), annotationName);
- }
-
- abstract Iterator<String> validAnnotationNames();
-
- abstract Annotation buildAnnotation(String annotationName);
-
- abstract Annotation buildNullAnnotation(String annotationName);
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private ContainerAnnotation<NestableAnnotation> buildContainerAnnotation(String annotationName) {
- return (ContainerAnnotation<NestableAnnotation>) this.buildAnnotation(annotationName);
- }
-
- private void syncAnnotations(CompilationUnit astRoot) {
- HashSet<Annotation> annotationsToRemove = new HashSet<Annotation>(this.annotations);
-
- this.annotatedElement.getBodyDeclaration(astRoot).accept(this.buildSynchronizeAnnotationVisitor(astRoot, annotationsToRemove));
-
- this.removeItemsFromCollection(annotationsToRemove, this.annotations, ANNOTATIONS_COLLECTION);
- }
-
- private ASTVisitor buildSynchronizeAnnotationVisitor(CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- return new SynchronizeAnnotationVisitor(astRoot, this.annotatedElement.getBodyDeclaration(astRoot), annotationsToRemove);
- }
-
- /**
- * called from {@link SynchronizeAnnotationVisitor#visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation)}
- */
- /* CU private */ void addOrSyncAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- String astAnnotationName = ASTTools.resolveAnnotation(astAnnotation);
- if (astAnnotationName != null) {
- this.addOrSyncAnnotation(astAnnotationName, astRoot, annotationsToRemove);
- }
- }
-
- /**
- * pre-condition: <code>astAnnotationName</code> is not <code>null</code>
- */
- void addOrSyncAnnotation(String astAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- if (this.annotationIsValid(astAnnotationName)) {
- this.addOrSyncAnnotation_(astAnnotationName, astRoot, annotationsToRemove);
- }
- }
-
- /**
- * pre-condition: <code>astAnnotationName</code> is valid
- */
- private void addOrSyncAnnotation_(String astAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- Annotation annotation = this.selectAnnotationNamed(annotationsToRemove, astAnnotationName);
- if (annotation != null) {
- annotation.synchronizeWith(astRoot);
- annotationsToRemove.remove(annotation);
- } else {
- annotation = this.buildAnnotation(astAnnotationName);
- annotation.initialize(astRoot);
- this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
- }
- }
-
-
- // ********** misc **********
-
- public boolean isAnnotated() {
- return ! this.annotations.isEmpty();
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- // the AST is null for virtual Java attributes
- // TODO remove the AST null check once we start storing text ranges
- // in the resource model
- return (astRoot == null) ? null : this.buildTextRange(this.annotatedElement.getBodyDeclaration(astRoot));
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- // the AST is null for virtual Java attributes
- // TODO remove the AST null check once we start storing text ranges
- // in the resource model
- return (astRoot == null) ? null : this.annotatedElement.getNameTextRange(astRoot);
- }
-
- private Annotation selectAnnotationNamed(Iterable<Annotation> list, String annotationName) {
- for (Annotation annotation : list) {
- if (annotation.getAnnotationName().equals(annotationName)) {
- return annotation;
- }
- }
- return null;
- }
-
- private TextRange buildTextRange(ASTNode astNode) {
- return (astNode == null) ? null : ASTTools.buildTextRange(astNode);
- }
-
-
- // ********** AST visitors **********
-
- /**
- * annotation visitor
- */
- static abstract class AnnotationVisitor
- extends ASTVisitor
- {
- final CompilationUnit astRoot;
- final ASTNode node;
-
-
- protected AnnotationVisitor(CompilationUnit astRoot, ASTNode node) {
- super();
- this.astRoot = astRoot;
- this.node = node;
- }
-
- @Override
- public boolean visit(SingleMemberAnnotation annotation) {
- return this.visit_(annotation);
- }
-
- @Override
- public boolean visit(NormalAnnotation annotation) {
- return this.visit_(annotation);
- }
-
- @Override
- public boolean visit(MarkerAnnotation annotation) {
- return this.visit_(annotation);
- }
-
- protected boolean visit_(org.eclipse.jdt.core.dom.Annotation annotation) {
- // ignore annotations for child members, only this member
- if (annotation.getParent() == this.node) {
- this.visitChildAnnotation(annotation);
- }
- return false;
- }
-
- protected abstract void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation annotation);
- }
-
-
- /**
- * initial annotation visitor
- */
- class InitialAnnotationVisitor
- extends AnnotationVisitor
- {
- protected InitialAnnotationVisitor(CompilationUnit astRoot, ASTNode node) {
- super(astRoot, node);
- }
-
- @Override
- protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation annotation) {
- SourceAnnotatedElement.this.addInitialAnnotation(annotation, this.astRoot);
- }
- }
-
-
- /**
- * synchronize annotation visitor
- */
- class SynchronizeAnnotationVisitor
- extends AnnotationVisitor
- {
- protected final Set<Annotation> annotationsToRemove;
-
- protected SynchronizeAnnotationVisitor(CompilationUnit astRoot, ASTNode node, Set<Annotation> annotationsToRemove) {
- super(astRoot, node);
- this.annotationsToRemove = annotationsToRemove;
- }
-
- @Override
- protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation annotation) {
- SourceAnnotatedElement.this.addOrSyncAnnotation(annotation, this.astRoot, this.annotationsToRemove);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java
deleted file mode 100644
index 132cc1b507..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
-import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * some common state and behavior for Java source annotations;
- * and lots of convenience methods
- */
-public abstract class SourceAnnotation<A extends AnnotatedElement>
- extends SourceNode
- implements Annotation
-{
- protected final A annotatedElement;
-
- // TODO - make 'final' if we start using combination annotation adapters(?)
- protected DeclarationAnnotationAdapter daa;
-
- // TODO - make 'final' if we start using combination annotation adapters(?)
- protected AnnotationAdapter annotationAdapter;
-
-
- /**
- * constructor for straight member annotation
- */
- protected SourceAnnotation(JavaResourceNode parent, A annotatedElement, DeclarationAnnotationAdapter daa) {
- this(parent, annotatedElement, daa, new ElementAnnotationAdapter(annotatedElement, daa));
- }
-
- /**
- * constructor for nested annotation (typically)
- */
- protected SourceAnnotation(JavaResourceNode parent, A annotatedElement, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent);
- this.annotatedElement = annotatedElement;
- this.daa = daa;
- this.annotationAdapter = annotationAdapter;
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- return this.getAnnotationTextRange(astRoot);
- }
-
-
- // ********** Annotation implementation **********
-
- public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- public void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- public void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
- public boolean isUnset() {
- return true;
- }
-
-
- // ********** convenience methods **********
-
- @Override
- public JavaResourcePersistentMember getParent() {
- return (JavaResourcePersistentMember) super.getParent();
- }
-
- protected IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
- return (IndexedAnnotationAdapter) this.annotationAdapter;
- }
-
- protected DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, elementName);
- }
-
- protected DeclarationAnnotationElementAdapter<Boolean> buildBooleanElementAdapter(String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forBooleans(this.daa, elementName);
- }
-
- protected DeclarationAnnotationElementAdapter<Integer> buildIntegerElementAdapter(String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forNumbers(this.daa, elementName);
- }
-
- protected AnnotationElementAdapter<String> buildStringElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
- }
-
- protected AnnotationElementAdapter<Boolean> buildBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
- return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea);
- }
-
- protected AnnotationElementAdapter<Integer> buildIntegerElementAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
- return new AnnotatedElementAnnotationElementAdapter<Integer>(this.annotatedElement, daea);
- }
-
- /**
- * Return the text range corresponding to the annotation.
- * If the annotation is missing, return <code>null</code>.
- */
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- // the AST is null for virtual Java attributes
- // TODO remove the AST null check once we start storing text ranges
- // in the resource model
- return (astRoot == null) ? null : this.getTextRange(this.getAstAnnotation(astRoot));
- }
-
- /**
- * Convenience method.
- * Return the text range corresponding to the specified element.
- * If the specified element is missing, return the annotation's text range instead.
- */
- protected TextRange getElementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) {
- return this.getElementTextRange(this.getAnnotationElementTextRange(elementAdapter, astRoot), astRoot);
- }
-
- /**
- * Convenience method. If the specified element text range is null
- * return the member's text range instead.
- */
- protected TextRange getElementTextRange(TextRange elementTextRange, CompilationUnit astRoot) {
- return (elementTextRange != null) ? elementTextRange : this.getAnnotationTextRange(astRoot);
- }
-
- /**
- * Convenience method. Return whether the specified position exists and
- * touches the specified element.
- */
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
- return this.textRangeTouches(this.getAnnotationElementTextRange(elementAdapter, astRoot), pos);
- }
-
- /**
- * Convenience method. Return whether the specified text range is not
- * null (meaning the corresponding AST node exists) and the specified position touches it.
- */
- protected boolean textRangeTouches(TextRange textRange, int pos) {
- return (textRange != null) && textRange.touches(pos);
- }
-
- /**
- * Return the text range corresponding to the specified element.
- * If the element is missing, return <code>null</code>.
- */
- protected TextRange getAnnotationElementTextRange(DeclarationAnnotationElementAdapter<?> adapter, CompilationUnit astRoot) {
- // the AST is null for virtual Java attributes
- // TODO remove the AST null check once we start storing text ranges
- // in the resource model
- return (astRoot == null) ? null : this.getTextRange(this.getAnnotationElementExpression(adapter, astRoot));
- }
-
- /**
- * Return the specified AST DOM element.
- */
- protected Expression getAnnotationElementExpression(DeclarationAnnotationElementAdapter<?> adapter, CompilationUnit astRoot) {
- return adapter.getExpression(this.annotatedElement.getModifiedDeclaration(astRoot));
- }
-
- /**
- * Return the text range corresponding to the specified AST node.
- * If the AST node is <code>null</code>, return <code>null</code>.
- */
- protected TextRange getTextRange(ASTNode astNode) {
- return (astNode == null) ? null : ASTTools.buildTextRange(astNode);
- }
-
- /**
- * Return the text range corresponding to the specified AST node.
- * If the AST node is <code>null</code>, return <code>null</code>.
- */
- protected TextRange getTextRange(ASTNode astNode, TextRange textRange) {
- return (astNode == null) ? null : ASTTools.buildTextRange(astNode, textRange);
- }
-
- /**
- * Convenience implementation of
- * {@link org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation#convertToNested(ContainerAnnotation, DeclarationAnnotationAdapter, int)}
- * used by subclasses.
- */
- public void convertToNested(ContainerAnnotation<? extends NestableAnnotation> containerAnnotation, DeclarationAnnotationAdapter containerAnnotationAdapter, int index) {
- Map<String, Object> map = this.buildState();
- this.removeAnnotation(); // this annotation has already been removed from the model
- IndexedDeclarationAnnotationAdapter idaa = this.buildNestedDeclarationAnnotationAdapter(containerAnnotationAdapter, index);
- this.daa = idaa;
- this.annotationAdapter = new ElementIndexedAnnotationAdapter(this.annotatedElement, idaa);
- this.rebuildAdapters();
- containerAnnotation.addNestedAnnotation(index, (NestableAnnotation) this);
- this.newAnnotation();
- this.restoreFrom(map);
- }
-
- /**
- * Convenience implementation of
- * {@link org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation#convertToStandAlone()}
- * used by subclasses.
- */
- public void convertToStandAlone() {
- Map<String, Object> map = this.buildState();
- this.removeAnnotation(); // this annotation has already been removed from the model
- this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
- this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
- this.rebuildAdapters();
- this.getParent().addStandAloneAnnotation((NestableAnnotation) this);
- this.newAnnotation();
- this.restoreFrom(map);
- }
-
- private Map<String, Object> buildState() {
- Map<String, Object> map = new HashMap<String, Object>();
- this.storeOn(map);
- return map;
- }
-
- protected void rebuildAdapters() {
- // this is only needed by nestable annotations
- }
-
- public void storeOn(Map<String, Object> map) {
- // this is only needed by nestable annotations
- }
-
- public void restoreFrom(Map<String, Object> map) {
- // this is only needed by nestable annotations
- }
-
- protected List<Map<String, Object>> buildStateList(int initialCapacity) {
- return (initialCapacity == 0) ?
- Collections.<Map<String, Object>>emptyList() :
- new ArrayList<Map<String, Object>>(initialCapacity);
- }
-
- protected IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter containerAnnotationAdapter, int index) {
- return buildNestedDeclarationAnnotationAdapter(index, containerAnnotationAdapter, this.getAnnotationName());
- }
-
- protected static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter containerAnnotationAdapter, String annotationName) {
- return new NestedIndexedDeclarationAnnotationAdapter(containerAnnotationAdapter, index, annotationName);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
index 94a233d5d0..d7285ac8e7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,45 +9,41 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
/**
* <code>javax.persistence.AssociationOverride</code>
*/
public abstract class SourceAssociationOverrideAnnotation
extends SourceOverrideAnnotation
- implements NestableAssociationOverrideAnnotation
+ implements AssociationOverrideAnnotation
{
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ public static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ASSOCIATION_OVERRIDES);
- private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
+
- protected SourceAssociationOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+ protected SourceAssociationOverrideAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
}
+
public String getAnnotationName() {
return ANNOTATION_NAME;
}
@@ -55,13 +51,13 @@ public abstract class SourceAssociationOverrideAnnotation
@Override
public void initialize(CompilationUnit astRoot) {
super.initialize(astRoot);
- AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot);
+ this.joinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
}
@Override
public void synchronizeWith(CompilationUnit astRoot) {
super.synchronizeWith(astRoot);
- AnnotationContainerTools.synchronize(this.joinColumnsContainer, astRoot);
+ this.joinColumnsContainer.synchronize(this.getAstAnnotation(astRoot));
}
@@ -75,171 +71,87 @@ public abstract class SourceAssociationOverrideAnnotation
// ********** AssociationOverrideAnnotation implementation **********
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
- }
-
- Iterable<NestableJoinColumnAnnotation> getNestableJoinColumns() {
- return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
- }
-
- public int joinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public NestableJoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
- private NestableJoinColumnAnnotation addJoinColumn() {
- return this.addJoinColumn(this.joinColumns.size());
- }
+ // **************** join columns *************************************************
- public NestableJoinColumnAnnotation addJoinColumn(int index) {
- return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer);
+ public ListIterable<JoinColumnAnnotation> getJoinColumns() {
+ return this.joinColumnsContainer.getNestedAnnotations();
}
- NestableJoinColumnAnnotation addJoinColumn_() {
- return this.addJoinColumn_(this.joinColumns.size());
+ public int getJoinColumnsSize() {
+ return this.joinColumnsContainer.getNestedAnnotationsSize();
}
- private NestableJoinColumnAnnotation addJoinColumn_(int index) {
- NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index);
- this.joinColumns.add(index, joinColumn);
- return joinColumn;
+ public JoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumnsContainer.nestedAnnotationAt(index);
}
- void syncAddJoinColumn(Annotation astAnnotation) {
- int index = this.joinColumns.size();
- NestableJoinColumnAnnotation joinColumn = this.addJoinColumn_(index);
- joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ public JoinColumnAnnotation addJoinColumn(int index) {
+ return this.joinColumnsContainer.addNestedAnnotation(index);
}
- private NestableJoinColumnAnnotation buildJoinColumn(int index) {
- return SourceJoinColumnAnnotation.createAssociationOverrideJoinColumn(this.daa, this, this.annotatedElement, index);
+ private JoinColumnAnnotation buildJoinColumn(int index) {
+ return SourceJoinColumnAnnotation.buildNestedSourceJoinColumnAnnotation(
+ this, this.annotatedElement, this.buildJoinColumnIndexedDeclarationAnnotationAdapter(index));
}
- void joinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ private IndexedDeclarationAnnotationAdapter buildJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(
+ this.daa, JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
}
public void moveJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation moveJoinColumn_(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
+ this.joinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
}
public void removeJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation removeJoinColumn_(int index) {
- return this.joinColumns.remove(index);
+ this.joinColumnsContainer.removeNestedAnnotation(index);
}
-
- void syncRemoveJoinColumns(int index) {
- this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
- }
-
-
- // ********** join column container **********
-
+
/**
- * adapt the AnnotationContainer interface to the override's join columns
+ * adapt the AnnotationContainer interface to the association override's join columns
*/
- class JoinColumnsAnnotationContainer
- implements AnnotationContainer<NestableJoinColumnAnnotation>
+ class JoinColumnsAnnotationContainer
+ extends AnnotationContainer<JoinColumnAnnotation>
{
- public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
- return SourceAssociationOverrideAnnotation.this.getAstAnnotation(astRoot);
+ @Override
+ protected String getAnnotationsPropertyName() {
+ return JOIN_COLUMNS_LIST;
}
-
- public String getElementName() {
+ @Override
+ protected String getElementName() {
return JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS;
}
-
- public String getNestedAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
- return SourceAssociationOverrideAnnotation.this.getNestableJoinColumns();
- }
-
- public int getNestedAnnotationsSize() {
- return SourceAssociationOverrideAnnotation.this.joinColumnsSize();
- }
-
- public NestableJoinColumnAnnotation addNestedAnnotation() {
- return SourceAssociationOverrideAnnotation.this.addJoinColumn_();
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- SourceAssociationOverrideAnnotation.this.syncAddJoinColumn(astAnnotation);
- }
-
- public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceAssociationOverrideAnnotation.this.moveJoinColumn_(targetIndex, sourceIndex);
- }
-
- public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
- return SourceAssociationOverrideAnnotation.this.removeJoinColumn_(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- SourceAssociationOverrideAnnotation.this.syncRemoveJoinColumns(index);
+ @Override
+ protected String getNestedAnnotationName() {
+ return JPA.JOIN_COLUMN;
}
-
@Override
- public String toString() {
- return StringTools.buildToStringFor(this);
+ protected JoinColumnAnnotation buildNestedAnnotation(int index) {
+ return SourceAssociationOverrideAnnotation.this.buildJoinColumn(index);
}
}
-
// ********** misc **********
@Override
public boolean isUnset() {
return super.isUnset() &&
- this.joinColumns.isEmpty();
+ this.joinColumnsContainer.isEmpty();
}
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- }
+ // ********** static methods **********
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
-
- List<Map<String, Object>> joinColumnsState = this.buildStateList(this.joinColumns.size());
- for (NestableJoinColumnAnnotation joinColumn : this.getNestableJoinColumns()) {
- Map<String, Object> joinColumnState = new HashMap<String, Object>();
- joinColumn.storeOn(joinColumnState);
- joinColumnsState.add(joinColumnState);
- }
- map.put(JOIN_COLUMNS_LIST, joinColumnsState);
- this.joinColumns.clear();
+ protected static IndexedAnnotationAdapter buildAssociationOverrideAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
+ return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
}
- @Override
- public void restoreFrom(Map<String,Object> map) {
- super.restoreFrom(map);
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> joinColumnsState = (List<Map<String, Object>>) map.get(JOIN_COLUMNS_LIST);
- for (Map<String, Object> joinColumnState : joinColumnsState) {
- this.addJoinColumn().restoreFrom(joinColumnState);
- }
+ protected static IndexedDeclarationAnnotationAdapter buildAssociationOverrideDeclarationAnnotationAdapter(int index) {
+ IndexedDeclarationAnnotationAdapter idaa =
+ new CombinationIndexedDeclarationAnnotationAdapter(
+ DECLARATION_ANNOTATION_ADAPTER,
+ CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
+ index,
+ ANNOTATION_NAME);
+ return idaa;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java
deleted file mode 100644
index 4591355155..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation;
-
-/**
- * <code>javax.persistence.AssociationOverrides</code>
- */
-public abstract class SourceAssociationOverridesAnnotation
- extends SourceAnnotation<Member>
- implements AssociationOverridesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableAssociationOverrideAnnotation> associationOverrides = new Vector<NestableAssociationOverrideAnnotation>();
-
-
- protected SourceAssociationOverridesAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- AnnotationContainerTools.synchronize(this, astRoot);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.associationOverrides.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.associationOverrides);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getElementName() {
- return JPA.ASSOCIATION_OVERRIDES__VALUE;
- }
-
- public String getNestedAnnotationName() {
- return AssociationOverrideAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableAssociationOverrideAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableAssociationOverrideAnnotation>(this.associationOverrides);
- }
-
- public int getNestedAnnotationsSize() {
- return this.associationOverrides.size();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.nestStandAloneAnnotation(standAloneAnnotation, this.associationOverrides.size());
- }
-
- private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
- standAloneAnnotation.convertToNested(this, this.daa, index);
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- this.associationOverrides.add(index, (NestableAssociationOverrideAnnotation) annotation);
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- this.associationOverrides.remove(0).convertToStandAlone();
- }
-
- public NestableAssociationOverrideAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.associationOverrides.size());
- }
-
- private NestableAssociationOverrideAnnotation addNestedAnnotation(int index) {
- NestableAssociationOverrideAnnotation associationOverride = this.buildAssociationOverride(index);
- this.associationOverrides.add(index, associationOverride);
- return associationOverride;
- }
-
- protected abstract NestableAssociationOverrideAnnotation buildAssociationOverride(int index);
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- int index = this.associationOverrides.size();
- NestableAssociationOverrideAnnotation associationOverride = this.addNestedAnnotation(index);
- associationOverride.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(ASSOCIATION_OVERRIDES_LIST, index, associationOverride);
- }
-
- public NestableAssociationOverrideAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.associationOverrides, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public NestableAssociationOverrideAnnotation removeNestedAnnotation(int index) {
- return this.associationOverrides.remove(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.associationOverrides, ASSOCIATION_OVERRIDES_LIST);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
index d1151a8487..4b90c84ed5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,39 +9,84 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.HashMap;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
/**
* <code>javax.persistence.AttributeOverride</code>
*/
public final class SourceAttributeOverrideAnnotation
extends SourceOverrideAnnotation
- implements NestableAttributeOverrideAnnotation
+ implements AttributeOverrideAnnotation
{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ATTRIBUTE_OVERRIDES);
private ElementAnnotationAdapter columnAdapter;
private ColumnAnnotation column;
private final ColumnAnnotation nullColumn;
-
- public SourceAttributeOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+
+ public static SourceAttributeOverrideAnnotation buildSourceAttributeOverrideAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element) {
+
+ return new SourceAttributeOverrideAnnotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public static SourceAttributeOverrideAnnotation buildSourceAttributeOverrideAnnotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement annotatedElement,
+ int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildAttributeOverrideDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildAttributeOverrideAnnotationAdapter(annotatedElement, idaa);
+ return new SourceAttributeOverrideAnnotation(
+ parent,
+ annotatedElement,
+ idaa,
+ iaa);
+ }
+
+ public static SourceAttributeOverrideAnnotation buildNestedSourceAttributeOverrideAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ return new SourceAttributeOverrideAnnotation(parent, element, idaa);
+ }
+
+ private SourceAttributeOverrideAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ DeclarationAnnotationAdapter daa) {
+
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
+ }
+
+ private SourceAttributeOverrideAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
+ }
+
+ private SourceAttributeOverrideAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.columnAdapter = this.buildColumnAdapter();
this.nullColumn = this.buildNullColumn();
}
@@ -140,43 +185,20 @@ public final class SourceAttributeOverrideAnnotation
(this.column == null);
}
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.columnAdapter = this.buildColumnAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- if (this.column != null) {
- Map<String, Object> columnState = new HashMap<String, Object>();
- this.column.storeOn(columnState);
- map.put(COLUMN_PROPERTY, columnState);
- this.column = null;
- }
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- @SuppressWarnings("unchecked")
- Map<String, Object> columnState = (Map<String, Object>) map.get(COLUMN_PROPERTY);
- if (columnState != null) {
- this.addColumn().restoreFrom(columnState);
- }
- }
-
// ********** static methods **********
- public static SourceAttributeOverrideAnnotation buildAttributeOverride(JavaResourceNode parent, Member member) {
- return new SourceAttributeOverrideAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ protected static IndexedAnnotationAdapter buildAttributeOverrideAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
+ return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
}
- static SourceAttributeOverrideAnnotation buildNestedAttributeOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
- return new SourceAttributeOverrideAnnotation(parent, member, idaa, annotationAdapter);
+ protected static IndexedDeclarationAnnotationAdapter buildAttributeOverrideDeclarationAnnotationAdapter(int index) {
+ IndexedDeclarationAnnotationAdapter idaa =
+ new CombinationIndexedDeclarationAnnotationAdapter(
+ DECLARATION_ANNOTATION_ADAPTER,
+ CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
+ index,
+ ANNOTATION_NAME);
+ return idaa;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
deleted file mode 100644
index d1d75c6f31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAttributeOverrideAnnotation;
-
-/**
- * <code>javax.persistence.AttributeOverrides</code>
- */
-public final class SourceAttributeOverridesAnnotation
- extends SourceAnnotation<Member>
- implements AttributeOverridesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableAttributeOverrideAnnotation> attributeOverrides = new Vector<NestableAttributeOverrideAnnotation>();
-
-
- public SourceAttributeOverridesAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- AnnotationContainerTools.synchronize(this, astRoot);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.attributeOverrides.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.attributeOverrides);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getElementName() {
- return JPA.ATTRIBUTE_OVERRIDES__VALUE;
- }
-
- public String getNestedAnnotationName() {
- return AttributeOverrideAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableAttributeOverrideAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableAttributeOverrideAnnotation>(this.attributeOverrides);
- }
-
- public int getNestedAnnotationsSize() {
- return this.attributeOverrides.size();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.nestStandAloneAnnotation(standAloneAnnotation, this.attributeOverrides.size());
- }
-
- private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
- standAloneAnnotation.convertToNested(this, this.daa, index);
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- this.attributeOverrides.add(index, (NestableAttributeOverrideAnnotation) annotation);
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- this.attributeOverrides.remove(0).convertToStandAlone();
- }
-
- public NestableAttributeOverrideAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.attributeOverrides.size());
- }
-
- private NestableAttributeOverrideAnnotation addNestedAnnotation(int index) {
- NestableAttributeOverrideAnnotation attributeOverride = this.buildAttributeOverride(index);
- this.attributeOverrides.add(index, attributeOverride);
- return attributeOverride;
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- int index = this.attributeOverrides.size();
- NestableAttributeOverrideAnnotation attributeOverride = this.addNestedAnnotation(index);
- attributeOverride.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
- }
-
- private NestableAttributeOverrideAnnotation buildAttributeOverride(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceAttributeOverrideAnnotation.buildNestedAttributeOverride(this.parent, this.annotatedElement, index, this.daa);
- }
-
- public NestableAttributeOverrideAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.attributeOverrides, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public NestableAttributeOverrideAnnotation removeNestedAnnotation(int index) {
- return this.attributeOverrides.remove(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.attributeOverrides, ATTRIBUTE_OVERRIDES_LIST);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
index 37730073e4..463a31d15f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,17 +9,16 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <ul>
@@ -54,12 +53,12 @@ public abstract class SourceBaseColumnAnnotation
protected Boolean updatable;
- protected SourceBaseColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ protected SourceBaseColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
}
- protected SourceBaseColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+ protected SourceBaseColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.tableDeclarationAdapter = this.buildTableDeclarationAdapter();
this.tableAdapter = this.buildTableAdapter();
this.uniqueDeclarationAdapter = this.buildUniqueDeclarationAdapter();
@@ -291,44 +290,4 @@ public abstract class SourceBaseColumnAnnotation
(this.insertable == null) &&
(this.updatable == null);
}
-
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.tableDeclarationAdapter = this.buildTableDeclarationAdapter();
- this.tableAdapter = this.buildTableAdapter();
- this.uniqueDeclarationAdapter = this.buildUniqueDeclarationAdapter();
- this.uniqueAdapter = this.buildUniqueAdapter();
- this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter();
- this.nullableAdapter = this.buildNullableAdapter();
- this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter();
- this.insertableAdapter = this.buildInsertableAdapter();
- this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter();
- this.updatableAdapter = this.buildUpdatableAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(TABLE_PROPERTY, this.table);
- this.table = null;
- map.put(UNIQUE_PROPERTY, this.unique);
- this.unique = null;
- map.put(NULLABLE_PROPERTY, this.nullable);
- this.nullable = null;
- map.put(INSERTABLE_PROPERTY, this.insertable);
- this.insertable = null;
- map.put(UPDATABLE_PROPERTY, this.updatable);
- this.updatable = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setTable((String) map.get(TABLE_PROPERTY));
- this.setUnique((Boolean) map.get(UNIQUE_PROPERTY));
- this.setNullable((Boolean) map.get(NULLABLE_PROPERTY));
- this.setInsertable((Boolean) map.get(INSERTABLE_PROPERTY));
- this.setUpdatable((Boolean) map.get(UPDATABLE_PROPERTY));
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
index 20d6cce5d1..7af43e55ba 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,23 +10,24 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.resource.java.EnumType;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.Enumerated
* javax.persistence.MapKeyEnumerated
*/
public abstract class SourceBaseEnumeratedAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements EnumeratedAnnotation
{
private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
@@ -34,10 +35,10 @@ public abstract class SourceBaseEnumeratedAnnotation
private EnumType value;
- protected SourceBaseEnumeratedAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
- super(parent, attribute, daa);
+ protected SourceBaseEnumeratedAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ super(parent, element, daa);
this.valueDeclarationAdapter = new EnumDeclarationAnnotationElementAdapter(daa, getValueElementName());
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, this.valueDeclarationAdapter);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, this.valueDeclarationAdapter);
}
public void initialize(CompilationUnit astRoot) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
index c32e64df6a..8b87f97783 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,19 +9,18 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.BaseJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <ul>
@@ -38,18 +37,18 @@ public abstract class SourceBaseJoinColumnAnnotation
private String referencedColumnName;
- protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+ protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
}
- protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
}
- protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, idaa));
+ protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
}
@Override
@@ -108,13 +107,6 @@ public abstract class SourceBaseJoinColumnAnnotation
protected abstract String getReferencedColumnNameElementName();
- // ********** NestableAnnotation implementation **********
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
-
// ********** misc **********
@Override
@@ -122,24 +114,4 @@ public abstract class SourceBaseJoinColumnAnnotation
return super.isUnset() &&
(this.referencedColumnName == null);
}
-
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
- this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(REFERENCED_COLUMN_NAME_PROPERTY, this.referencedColumnName);
- this.referencedColumnName = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setReferencedColumnName((String) map.get(REFERENCED_COLUMN_NAME_PROPERTY));
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java
index 770574872f..336f5503e8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,32 +9,22 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableUniqueConstraintAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
/**
@@ -46,7 +36,7 @@ import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
* </ul>
*/
public abstract class SourceBaseTableAnnotation
- extends SourceAnnotation<Member>
+ extends SourceAnnotation
implements BaseTableAnnotation
{
DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
@@ -61,16 +51,16 @@ public abstract class SourceBaseTableAnnotation
AnnotationElementAdapter<String> catalogAdapter;
String catalog;
- final Vector<NestableUniqueConstraintAnnotation> uniqueConstraints = new Vector<NestableUniqueConstraintAnnotation>();
+
final UniqueConstraintsAnnotationContainer uniqueConstraintsContainer = new UniqueConstraintsAnnotationContainer();
- protected SourceBaseTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ protected SourceBaseTableAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
}
- protected SourceBaseTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+ protected SourceBaseTableAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
this.nameAdapter = this.buildNameAdapter();
this.schemaDeclarationAdapter = this.buildSchemaDeclarationAdapter();
@@ -83,14 +73,14 @@ public abstract class SourceBaseTableAnnotation
this.name = this.buildName(astRoot);
this.schema = this.buildSchema(astRoot);
this.catalog = this.buildCatalog(astRoot);
- AnnotationContainerTools.initialize(this.uniqueConstraintsContainer, astRoot);
+ this.uniqueConstraintsContainer.initialize(this.getAstAnnotation(astRoot));
}
public void synchronizeWith(CompilationUnit astRoot) {
this.syncName(this.buildName(astRoot));
this.syncSchema(this.buildSchema(astRoot));
this.syncCatalog(this.buildCatalog(astRoot));
- AnnotationContainerTools.synchronize(this.uniqueConstraintsContainer, astRoot);
+ this.uniqueConstraintsContainer.synchronize(this.getAstAnnotation(astRoot));
}
/**
@@ -223,137 +213,64 @@ public abstract class SourceBaseTableAnnotation
}
// ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
- }
- Iterable<NestableUniqueConstraintAnnotation> getNestableUniqueConstraints() {
- return new LiveCloneIterable<NestableUniqueConstraintAnnotation>(this.uniqueConstraints);
+ public ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
+ return this.uniqueConstraintsContainer.getNestedAnnotations();
}
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
+ public int getUniqueConstraintsSize() {
+ return this.uniqueConstraintsContainer.getNestedAnnotationsSize();
}
- public NestableUniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraints.get(index);
+ public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
+ return this.uniqueConstraintsContainer.nestedAnnotationAt(index);
}
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- return this.uniqueConstraints.indexOf(uniqueConstraint);
+ public UniqueConstraintAnnotation addUniqueConstraint(int index) {
+ return this.uniqueConstraintsContainer.addNestedAnnotation(index);
}
-
- private NestableUniqueConstraintAnnotation addUniqueConstraint() {
- return this.addUniqueConstraint(this.uniqueConstraints.size());
- }
-
- public NestableUniqueConstraintAnnotation addUniqueConstraint(int index) {
- return (NestableUniqueConstraintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation addUniqueConstraint_() {
- return this.addUniqueConstraint_(this.uniqueConstraints.size());
- }
-
- private NestableUniqueConstraintAnnotation addUniqueConstraint_(int index) {
- NestableUniqueConstraintAnnotation uniqueConstraint = this.buildUniqueConstraint(index);
- this.uniqueConstraints.add(index, uniqueConstraint);
- return uniqueConstraint;
- }
-
- void syncAddUniqueConstraint(Annotation astAnnotation) {
- int index = this.uniqueConstraints.size();
- NestableUniqueConstraintAnnotation uniqueConstraint = this.addUniqueConstraint_(index);
- uniqueConstraint.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
- }
-
- NestableUniqueConstraintAnnotation buildUniqueConstraint(int index) {
- return new SourceUniqueConstraintAnnotation(this, this.annotatedElement, buildUniqueConstraintAnnotationAdapter(index));
- }
-
- IndexedDeclarationAnnotationAdapter buildUniqueConstraintAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, getUniqueConstraintsElementName(), index, JPA.UNIQUE_CONSTRAINT);
+
+ private UniqueConstraintAnnotation buildUniqueConstraint(int index) {
+ return new SourceUniqueConstraintAnnotation(
+ this, this.annotatedElement, buildUniqueConstraintIndexedDeclarationAnnotationAdapter(index));
}
-
- void uniqueConstraintAdded(int index, NestableUniqueConstraintAnnotation constraint) {
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, constraint);
+
+ private IndexedDeclarationAnnotationAdapter buildUniqueConstraintIndexedDeclarationAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(
+ this.daa, this.getUniqueConstraintsElementName(), index, JPA.UNIQUE_CONSTRAINT);
}
public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation moveUniqueConstraint_(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex).get(targetIndex);
+ this.uniqueConstraintsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
}
public void removeUniqueConstraint(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation removeUniqueConstraint_(int index) {
- return this.uniqueConstraints.remove(index);
+ this.uniqueConstraintsContainer.removeNestedAnnotation(index);
}
-
- void syncRemoveUniqueConstraints(int index) {
- this.removeItemsFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
-
- // ********** unique constraint container **********
+
/**
* adapt the AnnotationContainer interface to the table's unique constraints
*/
- class UniqueConstraintsAnnotationContainer
- implements AnnotationContainer<NestableUniqueConstraintAnnotation>
+ class UniqueConstraintsAnnotationContainer
+ extends AnnotationContainer<UniqueConstraintAnnotation>
{
- public Annotation getAstAnnotation(CompilationUnit astRoot) {
- return SourceBaseTableAnnotation.this.getAstAnnotation(astRoot);
+ @Override
+ protected String getAnnotationsPropertyName() {
+ return UNIQUE_CONSTRAINTS_LIST;
}
-
- public String getElementName() {
+ @Override
+ protected String getElementName() {
return SourceBaseTableAnnotation.this.getUniqueConstraintsElementName();
}
-
- public String getNestedAnnotationName() {
+ @Override
+ protected String getNestedAnnotationName() {
return UniqueConstraintAnnotation.ANNOTATION_NAME;
}
-
- public Iterable<NestableUniqueConstraintAnnotation> getNestedAnnotations() {
- return SourceBaseTableAnnotation.this.getNestableUniqueConstraints();
- }
-
- public int getNestedAnnotationsSize() {
- return SourceBaseTableAnnotation.this.uniqueConstraintsSize();
- }
-
- public NestableUniqueConstraintAnnotation addNestedAnnotation() {
- return SourceBaseTableAnnotation.this.addUniqueConstraint_();
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- SourceBaseTableAnnotation.this.syncAddUniqueConstraint(astAnnotation);
- }
-
- public NestableUniqueConstraintAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceBaseTableAnnotation.this.moveUniqueConstraint_(targetIndex, sourceIndex);
- }
-
- public NestableUniqueConstraintAnnotation removeNestedAnnotation(int index) {
- return SourceBaseTableAnnotation.this.removeUniqueConstraint_(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- SourceBaseTableAnnotation.this.syncRemoveUniqueConstraints(index);
- }
-
@Override
- public String toString() {
- return StringTools.buildToStringFor(this);
+ protected UniqueConstraintAnnotation buildNestedAnnotation(int index) {
+ return SourceBaseTableAnnotation.this.buildUniqueConstraint(index);
}
-
}
@@ -365,54 +282,7 @@ public abstract class SourceBaseTableAnnotation
(this.name == null) &&
(this.schema == null) &&
(this.catalog == null) &&
- this.uniqueConstraints.isEmpty();
- }
-
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
- this.nameAdapter = this.buildNameAdapter();
- this.schemaDeclarationAdapter = this.buildSchemaDeclarationAdapter();
- this.schemaAdapter = this.buildSchemaAdapter();
- this.catalogDeclarationAdapter = this.buildCatalogDeclarationAdapter();
- this.catalogAdapter = this.buildCatalogAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
-
- map.put(NAME_PROPERTY, this.name);
- this.name = null;
- map.put(SCHEMA_PROPERTY, this.schema);
- this.schema = null;
- map.put(CATALOG_PROPERTY, this.catalog);
- this.catalog = null;
-
- List<Map<String, Object>> constraintsState = this.buildStateList(this.uniqueConstraints.size());
- for (NestableUniqueConstraintAnnotation constraint : this.getNestableUniqueConstraints()) {
- Map<String, Object> constraintState = new HashMap<String, Object>();
- constraint.storeOn(constraintState);
- constraintsState.add(constraintState);
- }
- map.put(UNIQUE_CONSTRAINTS_LIST, constraintsState);
- this.uniqueConstraints.clear();
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
-
- this.setName((String) map.get(NAME_PROPERTY));
- this.setSchema((String) map.get(SCHEMA_PROPERTY));
- this.setCatalog((String) map.get(CATALOG_PROPERTY));
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> constraintsState = (List<Map<String, Object>>) map.get(UNIQUE_CONSTRAINTS_LIST);
- for (Map<String, Object> constraintState : constraintsState) {
- this.addUniqueConstraint().restoreFrom(constraintState);
- }
+ this.uniqueConstraintsContainer.isEmpty();
}
private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
index abc301e316..16a0cde56f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,14 +10,15 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
@@ -27,7 +28,7 @@ import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
* javax.persistence.MapKeyTemporal
*/
public abstract class SourceBaseTemporalAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements TemporalAnnotation
{
protected final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
@@ -35,10 +36,10 @@ public abstract class SourceBaseTemporalAnnotation
private TemporalType value;
- protected SourceBaseTemporalAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
- super(parent, attribute, daa);
+ protected SourceBaseTemporalAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ super(parent, element, daa);
this.valueDeclarationAdapter = new EnumDeclarationAnnotationElementAdapter(daa, getValueElementName());
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, this.valueDeclarationAdapter);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, this.valueDeclarationAdapter);
}
public void initialize(CompilationUnit astRoot) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java
index ee9c9d9138..16d5a2f71d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,26 +10,27 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.FetchType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Basic
*/
public final class SourceBasicAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements BasicAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -43,10 +44,10 @@ public final class SourceBasicAnnotation
private FetchType fetch;
- public SourceBasicAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.optionalAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(attribute, OPTIONAL_ADAPTER);
- this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER);
+ public SourceBasicAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.optionalAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, OPTIONAL_ADAPTER);
+ this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, FETCH_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java
index b0b90584bf..8ca2e22f8a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <code>javax.persistence.Column</code>
@@ -28,8 +28,8 @@ public final class SourceColumnAnnotation
public static final DeclarationAnnotationAdapter MAPPING_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- super(parent, member, daa);
+ public SourceColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ super(parent, element, daa);
}
public String getAnnotationName() {
@@ -96,8 +96,8 @@ public final class SourceColumnAnnotation
// ********** static methods **********
- static ColumnAnnotation createAttributeOverrideColumn(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
- return new SourceColumnAnnotation(parent, member, buildAttributeOverrideAnnotationAdapter(attributeOverrideAnnotationAdapter));
+ static ColumnAnnotation createAttributeOverrideColumn(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
+ return new SourceColumnAnnotation(parent, element, buildAttributeOverrideAnnotationAdapter(attributeOverrideAnnotationAdapter));
}
static DeclarationAnnotationAdapter buildAttributeOverrideAnnotationAdapter(DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java
deleted file mode 100644
index 49e760889b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptResourceModelListener;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.common.utility.CommandExecutor;
-import org.eclipse.jpt.common.utility.internal.ListenerList;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-
-/**
- * Java compilation unit (source file)
- */
-public abstract class SourceCompilationUnit
- extends SourceNode
- implements JavaResourceCompilationUnit
-{
- /** JDT compilation unit */
- final ICompilationUnit compilationUnit;
-
- /** pluggable annotation provider */
- private final JpaAnnotationProvider annotationProvider;
-
- /** improved annotation formatting */
- private final AnnotationEditFormatter annotationEditFormatter;
-
- /** pluggable executor that allows the document to be modified on another thread */
- private final CommandExecutor modifySharedDocumentCommandExecutor;
-
- /** listeners notified whenever the resource model changes */
- private final ListenerList<JptResourceModelListener> resourceModelListenerList;
-
-
- // ********** construction **********
-
- protected SourceCompilationUnit(
- ICompilationUnit compilationUnit,
- JpaAnnotationProvider annotationProvider,
- AnnotationEditFormatter annotationEditFormatter,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- super(null); // the JPA compilation unit is the root of its sub-tree
- this.compilationUnit = compilationUnit;
- this.annotationProvider = annotationProvider;
- this.annotationEditFormatter = annotationEditFormatter;
- this.modifySharedDocumentCommandExecutor = modifySharedDocumentCommandExecutor;
- this.resourceModelListenerList = new ListenerList<JptResourceModelListener>(JptResourceModelListener.class);
- }
-
- public void initialize(CompilationUnit astRoot) {
- // never called?
- }
-
- void openCompilationUnit() {
- try {
- this.compilationUnit.open(null);
- } catch (JavaModelException ex) {
- // do nothing - we just won't have a primary type in this case
- }
- }
-
- void closeCompilationUnit() {
- try {
- this.compilationUnit.close();
- } catch (JavaModelException ex) {
- // hmmm
- }
- }
-
-
- // ********** AbstractJavaResourceNode overrides **********
-
- @Override
- protected boolean requiresParent() {
- return false;
- }
-
- @Override
- public JavaResourceCompilationUnit getRoot() {
- return this;
- }
-
- @Override
- public IFile getFile() {
- return (IFile) this.compilationUnit.getResource();
- }
-
- @Override
- public JpaAnnotationProvider getAnnotationProvider() {
- return this.annotationProvider;
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- // since this is the entire file, point to the top of the file
- return TextRange.Empty.instance();
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- public void resourceModelChanged() {
- for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
- listener.resourceModelChanged(this);
- }
- }
-
-
- // ********** JavaResourceCompilationUnit implementation **********
-
- public ICompilationUnit getCompilationUnit() {
- return this.compilationUnit;
- }
-
- public CommandExecutor getModifySharedDocumentCommandExecutor() {
- return this.modifySharedDocumentCommandExecutor;
- }
-
- public AnnotationEditFormatter getAnnotationEditFormatter() {
- return this.annotationEditFormatter;
- }
-
- @Override
- public CompilationUnit buildASTRoot() {
- return ASTTools.buildASTRoot(this.compilationUnit);
- }
-
-
- // ********** JptResourceModel implementation **********
-
- public void addResourceModelListener(JptResourceModelListener listener) {
- this.resourceModelListenerList.add(listener);
- }
-
- public void removeResourceModelListener(JptResourceModelListener listener) {
- this.resourceModelListenerList.remove(listener);
- }
-
-
- // ********** Java changes **********
-
- public void synchronizeWithJavaSource() {
- this.synchronizeWith(this.buildASTRoot());
- }
-
-
- // ********** internal **********
-
- String getCompilationUnitName() {
- return this.removeJavaExtension(this.compilationUnit.getElementName());
- }
-
- private String removeJavaExtension(String fileName) {
- int index = fileName.lastIndexOf(".java"); //$NON-NLS-1$
- return (index == -1) ? fileName : fileName.substring(0, index);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getCompilationUnitName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
index 0401a234ad..c49deb0266 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,15 +9,14 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* <ul>
@@ -42,8 +41,8 @@ public abstract class SourceCompleteColumnAnnotation
protected Integer scale;
- protected SourceCompleteColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- super(parent, member, daa);
+ protected SourceCompleteColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ super(parent, element, daa);
this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
this.lengthAdapter = this.buildLengthAdapter();
this.precisionDeclarationAdapter = this.buildPrecisionDeclarationAdapter();
@@ -190,33 +189,4 @@ public abstract class SourceCompleteColumnAnnotation
(this.scale == null);
}
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
- this.lengthAdapter = this.buildLengthAdapter();
- this.precisionDeclarationAdapter = this.buildPrecisionDeclarationAdapter();
- this.precisionAdapter = this.buildPrecisionAdapter();
- this.scaleDeclarationAdapter = this.buildScaleDeclarationAdapter();
- this.scaleAdapter = this.buildScaleAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(LENGTH_PROPERTY, this.length);
- this.length = null;
- map.put(PRECISION_PROPERTY, this.precision);
- this.precision = null;
- map.put(SCALE_PROPERTY, this.scale);
- this.scale = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setLength((Integer) map.get(LENGTH_PROPERTY));
- this.setPrecision((Integer) map.get(PRECISION_PROPERTY));
- this.setScale((Integer) map.get(SCALE_PROPERTY));
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
index 2957c055a4..1be3475532 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,19 +9,18 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* <code>javax.persistence.DiscriminatorColumn</code>
@@ -41,8 +40,8 @@ public final class SourceDiscriminatorColumnAnnotation
private Integer length;
- public SourceDiscriminatorColumnAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceDiscriminatorColumnAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.discriminatorTypeAdapter = this.buildDiscriminatorTypeAdapter();
this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
this.lengthAdapter = this.buildLengthAdapter();
@@ -148,30 +147,6 @@ public final class SourceDiscriminatorColumnAnnotation
(this.length == null);
}
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.discriminatorTypeAdapter = this.buildDiscriminatorTypeAdapter();
- this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
- this.lengthAdapter = this.buildLengthAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(DISCRIMINATOR_TYPE_PROPERTY, this.discriminatorType);
- this.discriminatorType = null;
- map.put(LENGTH_PROPERTY, this.length);
- this.length = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setDiscriminatorType((DiscriminatorType) map.get(DISCRIMINATOR_TYPE_PROPERTY));
- this.setLength((Integer) map.get(LENGTH_PROPERTY));
- }
-
// ********** static methods **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
index 319fb9370e..3fa13799f0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,23 +10,24 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.DiscriminatorValue
*/
public final class SourceDiscriminatorValueAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements DiscriminatorValueAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -36,9 +37,9 @@ public final class SourceDiscriminatorValueAnnotation
private String value;
- public SourceDiscriminatorValueAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ public SourceDiscriminatorValueAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
index f613e515cb..901cd71017 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Embeddable
*/
public final class SourceEmbeddableAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements EmbeddableAnnotation
{
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceEmbeddableAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceEmbeddableAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
@@ -41,5 +42,4 @@ public final class SourceEmbeddableAnnotation
public void synchronizeWith(CompilationUnit astRoot) {
// nothing to update
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
index 30b31f86ed..5981e7fa67 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Embedded
*/
public final class SourceEmbeddedAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements EmbeddedAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceEmbeddedAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceEmbeddedAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
@@ -41,5 +42,4 @@ public final class SourceEmbeddedAnnotation
public void synchronizeWith(CompilationUnit astRoot) {
// nothing to update
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
index fb9c29db44..013de1fcb9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.EmbeddedId
*/
public final class SourceEmbeddedIdAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements EmbeddedIdAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceEmbeddedIdAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceEmbeddedIdAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
@@ -41,5 +42,4 @@ public final class SourceEmbeddedIdAnnotation
public void synchronizeWith(CompilationUnit astRoot) {
// nothing to update
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java
index 37bd89f01c..b6d30ccf97 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,23 +10,24 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Entity
*/
public final class SourceEntityAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements EntityAnnotation
{
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -37,8 +38,8 @@ public final class SourceEntityAnnotation
TextRange nameTextRange;
- public SourceEntityAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceEntityAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.nameAdapter = new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, NAME_ADAPTER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
index 7d53beac94..65e389a38e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Enumerated
@@ -23,8 +23,8 @@ public final class SourceEnumeratedAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceEnumeratedAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceEnumeratedAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
index 81ad170950..8977f5363c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,26 +10,26 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.GenerationType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.GeneratedValue
*/
public final class SourceGeneratedValueAnnotation
- extends SourceAnnotation<Member>
+ extends SourceAnnotation
implements GeneratedValueAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -43,10 +43,10 @@ public final class SourceGeneratedValueAnnotation
private String generator;
- public SourceGeneratedValueAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.strategyAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, STRATEGY_ADAPTER);
- this.generatorAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, GENERATOR_ADAPTER);
+ public SourceGeneratedValueAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.strategyAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, STRATEGY_ADAPTER);
+ this.generatorAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, GENERATOR_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
index 0aaa15274e..8a6f6bf962 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
@@ -10,23 +10,24 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.NumberIntegerExpressionConverter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
/**
* javax.persistence.SequenceGenerator
* javax.persistence.TableGenerator
*/
abstract class SourceGeneratorAnnotation
- extends SourceAnnotation<Member>
+ extends SourceAnnotation
implements GeneratorAnnotation
{
final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
@@ -43,8 +44,8 @@ abstract class SourceGeneratorAnnotation
Integer allocationSize;
- SourceGeneratorAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- super(parent, member, daa);
+ SourceGeneratorAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ super(parent, element, daa);
this.nameDeclarationAdapter = this.getNameAdapter();
this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
this.initialValueDeclarationAdapter = this.getInitialValueAdapter();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java
index 3a9cb91a67..411223e26b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Id
*/
public final class SourceIdAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements IdAnnotation
{
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceIdAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceIdAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java
index 7eb7d61573..ba8c2eb44a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,25 +10,26 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.IdClass
*/
public final class SourceIdClassAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements IdClassAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -67,9 +68,9 @@ public final class SourceIdClassAnnotation
private boolean fqClassNameStale = true;
- public SourceIdClassAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ public SourceIdClassAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java
index 580f00164a..698fc5f1b3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* javax.persistence.Inheritance
*/
public final class SourceInheritanceAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements InheritanceAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -37,9 +38,9 @@ public final class SourceInheritanceAnnotation
private InheritanceType strategy;
- public SourceInheritanceAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.strategyAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, STRATEGY_ADAPTER);
+ public SourceInheritanceAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.strategyAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, STRATEGY_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
index afdb776e6b..9cbe5e4144 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,41 +9,73 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
+import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
/**
* <code>javax.persistence.JoinColumn</code>
*/
public final class SourceJoinColumnAnnotation
extends SourceBaseJoinColumnAnnotation
- implements NestableJoinColumnAnnotation
+ implements JoinColumnAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.JOIN_COLUMNS);
+
+ public static SourceJoinColumnAnnotation buildSourceJoinColumnAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element) {
+
+ return new SourceJoinColumnAnnotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public static SourceJoinColumnAnnotation buildSourceJoinColumnAnnotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement annotatedElement,
+ int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildJoinColumnDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildJoinColumnAnnotationAdapter(annotatedElement, idaa);
+ return new SourceJoinColumnAnnotation(
+ parent,
+ annotatedElement,
+ idaa,
+ iaa);
+ }
+
+
+ public static SourceJoinColumnAnnotation buildNestedSourceJoinColumnAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ return new SourceJoinColumnAnnotation(parent, element, idaa);
+ }
- public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+ private SourceJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
}
- public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ private SourceJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
}
- public SourceJoinColumnAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, idaa));
+ private SourceJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
}
+
public String getAnnotationName() {
return ANNOTATION_NAME;
}
@@ -99,21 +131,17 @@ public final class SourceJoinColumnAnnotation
// ********** static methods **********
- public static SourceJoinColumnAnnotation createJoinColumn(JavaResourceNode parent, Member member) {
- return new SourceJoinColumnAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- static SourceJoinColumnAnnotation createNestedJoinColumn(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter joinColumnsAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
- return new SourceJoinColumnAnnotation(parent, member, idaa, annotationAdapter);
- }
-
- static NestableJoinColumnAnnotation createAssociationOverrideJoinColumn(DeclarationAnnotationAdapter associationOverrideAdapter, JavaResourceNode parent, Member member, int index) {
- return new SourceJoinColumnAnnotation(parent, member, buildAssociationOverrideAnnotationAdapter(associationOverrideAdapter, index));
+ private static IndexedAnnotationAdapter buildJoinColumnAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
+ return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
}
- private static IndexedDeclarationAnnotationAdapter buildAssociationOverrideAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(associationOverrideAdapter, JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS, index, ANNOTATION_NAME);
+ private static IndexedDeclarationAnnotationAdapter buildJoinColumnDeclarationAnnotationAdapter(int index) {
+ IndexedDeclarationAnnotationAdapter idaa =
+ new CombinationIndexedDeclarationAnnotationAdapter(
+ DECLARATION_ANNOTATION_ADAPTER,
+ CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
+ index,
+ ANNOTATION_NAME);
+ return idaa;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java
deleted file mode 100644
index 8361a6faf4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
-
-/**
- * <code>javax.persistence.JoinColumns</code>
- */
-public final class SourceJoinColumnsAnnotation
- extends SourceAnnotation<Member>
- implements JoinColumnsAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
-
-
- public SourceJoinColumnsAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- AnnotationContainerTools.synchronize(this, astRoot);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.joinColumns.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.joinColumns);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getElementName() {
- return JPA.JOIN_COLUMNS__VALUE;
- }
-
- public String getNestedAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
- }
-
- public int getNestedAnnotationsSize() {
- return this.joinColumns.size();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.nestStandAloneAnnotation(standAloneAnnotation, this.joinColumns.size());
- }
-
- private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
- standAloneAnnotation.convertToNested(this, this.daa, index);
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- this.joinColumns.add(index, (NestableJoinColumnAnnotation) annotation);
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- this.joinColumns.remove(0).convertToStandAlone();
- }
-
- public NestableJoinColumnAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.joinColumns.size());
- }
-
- private NestableJoinColumnAnnotation addNestedAnnotation(int index) {
- NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index);
- this.joinColumns.add(index, joinColumn);
- return joinColumn;
- }
-
- public void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
- int index = this.joinColumns.size();
- NestableJoinColumnAnnotation joinColumn = this.addNestedAnnotation(index);
- joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
- }
-
- private NestableJoinColumnAnnotation buildJoinColumn(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceJoinColumnAnnotation.createNestedJoinColumn(this.parent, this.annotatedElement, index, this.daa);
- }
-
- public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
- return this.joinColumns.remove(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java
index a00a620b26..d001219ce6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,29 +9,19 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation;
/**
* <code>javax.persistence.JoinTable</code>
@@ -43,19 +33,17 @@ public final class SourceJoinTableAnnotation
public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JoinTableAnnotation.ANNOTATION_NAME);
- private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>();
private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
- private final Vector<NestableJoinColumnAnnotation> inverseJoinColumns = new Vector<NestableJoinColumnAnnotation>();
- private final InverseJoinColumnsContainerAnnotation inverseJoinColumnsContainer = new InverseJoinColumnsContainerAnnotation();
+ private final InverseJoinColumnsAnnotationContainer inverseJoinColumnsContainer = new InverseJoinColumnsAnnotationContainer();
- public SourceJoinTableAnnotation(JavaResourceNode parent, Member member) {
- this(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceJoinTableAnnotation(JavaResourceNode parent, AnnotatedElement element) {
+ this(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
- public SourceJoinTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- super(parent, member, daa);
+ public SourceJoinTableAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ super(parent, element, daa);
}
public String getAnnotationName() {
@@ -65,15 +53,15 @@ public final class SourceJoinTableAnnotation
@Override
public void initialize(CompilationUnit astRoot) {
super.initialize(astRoot);
- AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot);
- AnnotationContainerTools.initialize(this.inverseJoinColumnsContainer, astRoot);
+ this.joinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
+ this.inverseJoinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
}
@Override
public void synchronizeWith(CompilationUnit astRoot) {
super.synchronizeWith(astRoot);
- AnnotationContainerTools.synchronize(this.joinColumnsContainer, astRoot);
- AnnotationContainerTools.synchronize(this.inverseJoinColumnsContainer, astRoot);
+ this.joinColumnsContainer.synchronize(this.getAstAnnotation(astRoot));
+ this.inverseJoinColumnsContainer.synchronize(this.getAstAnnotation(astRoot));
}
@@ -101,309 +89,133 @@ public final class SourceJoinTableAnnotation
// ********** JoinTableAnnotation implementation **********
- // ***** join columns
- public ListIterator<JoinColumnAnnotation> joinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns);
- }
-
- Iterable<NestableJoinColumnAnnotation> getNestableJoinColumns() {
- return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns);
- }
-
- public int joinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public NestableJoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.joinColumns.indexOf(joinColumn);
- }
-
- private NestableJoinColumnAnnotation addJoinColumn() {
- return this.addJoinColumn(this.joinColumns.size());
- }
+ // **************** join columns *************************************************
- public NestableJoinColumnAnnotation addJoinColumn(int index) {
- return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer);
+ public ListIterable<JoinColumnAnnotation> getJoinColumns() {
+ return this.joinColumnsContainer.getNestedAnnotations();
}
- NestableJoinColumnAnnotation addJoinColumn_() {
- return this.addJoinColumn_(this.joinColumns.size());
+ public int getJoinColumnsSize() {
+ return this.joinColumnsContainer.getNestedAnnotationsSize();
}
- private NestableJoinColumnAnnotation addJoinColumn_(int index) {
- NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index);
- this.joinColumns.add(index, joinColumn);
- return joinColumn;
+ public JoinColumnAnnotation joinColumnAt(int index) {
+ return this.joinColumnsContainer.nestedAnnotationAt(index);
}
- void syncAddJoinColumn(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
- int index = this.joinColumns.size();
- NestableJoinColumnAnnotation joinColumn = this.addJoinColumn_(index);
- joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn);
+ public JoinColumnAnnotation addJoinColumn(int index) {
+ return this.joinColumnsContainer.addNestedAnnotation(index);
}
-
- private NestableJoinColumnAnnotation buildJoinColumn(int index) {
- return new SourceJoinColumnAnnotation(this, this.annotatedElement, buildJoinColumnAnnotationAdapter(index));
+
+ private JoinColumnAnnotation buildJoinColumn(int index) {
+ return SourceJoinColumnAnnotation.buildNestedSourceJoinColumnAnnotation(
+ this, this.annotatedElement, this.buildJoinColumnIndexedDeclarationAnnotationAdapter(index));
}
-
- private IndexedDeclarationAnnotationAdapter buildJoinColumnAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
+
+ private IndexedDeclarationAnnotationAdapter buildJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(
+ this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
}
public void moveJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation moveJoinColumn_(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex);
+ this.joinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
}
public void removeJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation removeJoinColumn_(int index) {
- return this.joinColumns.remove(index);
- }
-
- void syncRemoveJoinColumns(int index) {
- this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
- }
-
- // ***** inverse join columns
- public ListIterator<JoinColumnAnnotation> inverseJoinColumns() {
- return new CloneListIterator<JoinColumnAnnotation>(this.inverseJoinColumns);
- }
-
- Iterable<NestableJoinColumnAnnotation> getNestableInverseJoinColumns() {
- return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.inverseJoinColumns);
- }
-
- public int inverseJoinColumnsSize() {
- return this.inverseJoinColumns.size();
- }
-
- public NestableJoinColumnAnnotation inverseJoinColumnAt(int index) {
- return this.inverseJoinColumns.get(index);
- }
-
- public int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn) {
- return this.inverseJoinColumns.indexOf(joinColumn);
+ this.joinColumnsContainer.removeNestedAnnotation(index);
}
-
- private NestableJoinColumnAnnotation addInverseJoinColumn() {
- return this.addInverseJoinColumn(this.inverseJoinColumns.size());
+
+ /**
+ * adapt the AnnotationContainer interface to the collection table's join columns
+ */
+ class JoinColumnsAnnotationContainer
+ extends AnnotationContainer<JoinColumnAnnotation>
+ {
+ @Override
+ protected String getAnnotationsPropertyName() {
+ return JOIN_COLUMNS_LIST;
+ }
+ @Override
+ protected String getElementName() {
+ return JPA.JOIN_TABLE__JOIN_COLUMNS;
+ }
+ @Override
+ protected String getNestedAnnotationName() {
+ return JPA.JOIN_COLUMN;
+ }
+ @Override
+ protected JoinColumnAnnotation buildNestedAnnotation(int index) {
+ return SourceJoinTableAnnotation.this.buildJoinColumn(index);
+ }
}
- public NestableJoinColumnAnnotation addInverseJoinColumn(int index) {
- return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.inverseJoinColumnsContainer);
- }
+ // **************** inverse join columns *************************************************
- NestableJoinColumnAnnotation addInverseJoinColumn_() {
- return this.addInverseJoinColumn_(this.inverseJoinColumns.size());
+ public ListIterable<JoinColumnAnnotation> getInverseJoinColumns() {
+ return this.inverseJoinColumnsContainer.getNestedAnnotations();
}
- private NestableJoinColumnAnnotation addInverseJoinColumn_(int index) {
- NestableJoinColumnAnnotation joinColumn = this.buildInverseJoinColumn(index);
- this.inverseJoinColumns.add(index, joinColumn);
- return joinColumn;
+ public int getInverseJoinColumnsSize() {
+ return this.inverseJoinColumnsContainer.getNestedAnnotationsSize();
}
- void syncAddInverseJoinColumn(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
- int index = this.inverseJoinColumns.size();
- NestableJoinColumnAnnotation joinColumn = this.addInverseJoinColumn_(index);
- joinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
+ public JoinColumnAnnotation inverseJoinColumnAt(int index) {
+ return this.inverseJoinColumnsContainer.nestedAnnotationAt(index);
}
- private NestableJoinColumnAnnotation buildInverseJoinColumn(int index) {
- return new SourceJoinColumnAnnotation(this, this.annotatedElement, buildInverseJoinColumnAnnotationAdapter(index));
+ public JoinColumnAnnotation addInverseJoinColumn(int index) {
+ return this.inverseJoinColumnsContainer.addNestedAnnotation(index);
}
-
- private IndexedDeclarationAnnotationAdapter buildInverseJoinColumnAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
+
+ private JoinColumnAnnotation buildInverseJoinColumn(int index) {
+ return SourceJoinColumnAnnotation.buildNestedSourceJoinColumnAnnotation(
+ this, this.annotatedElement, buildInverseJoinColumnIndexedDeclarationAnnotationAdapter(index));
}
-
- void inverseJoinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) {
- this.fireItemAdded(INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
+
+ private IndexedDeclarationAnnotationAdapter buildInverseJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(
+ this.daa, JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
}
public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.inverseJoinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation moveInverseJoinColumn_(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.inverseJoinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- void inverseJoinColumnMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ this.inverseJoinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
}
public void removeInverseJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.inverseJoinColumnsContainer);
- }
-
- NestableJoinColumnAnnotation removeInverseJoinColumn_(int index) {
- return this.inverseJoinColumns.remove(index);
- }
-
- void syncRemoveInverseJoinColumns(int index) {
- this.removeItemsFromList(index, this.inverseJoinColumns, INVERSE_JOIN_COLUMNS_LIST);
+ this.inverseJoinColumnsContainer.removeNestedAnnotation(index);
}
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.joinColumns.isEmpty() &&
- this.inverseJoinColumns.isEmpty();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
-
- List<Map<String, Object>> joinColumnsState = this.buildStateList(this.joinColumns.size());
- for (NestableJoinColumnAnnotation joinColumn : this.getNestableJoinColumns()) {
- Map<String, Object> joinColumnState = new HashMap<String, Object>();
- joinColumn.storeOn(joinColumnState);
- joinColumnsState.add(joinColumnState);
- }
- map.put(JOIN_COLUMNS_LIST, joinColumnsState);
- this.joinColumns.clear();
-
- List<Map<String, Object>> inverseJoinColumnsState = this.buildStateList(this.inverseJoinColumns.size());
- for (NestableJoinColumnAnnotation joinColumn : this.getNestableInverseJoinColumns()) {
- Map<String, Object> joinColumnState = new HashMap<String, Object>();
- joinColumn.storeOn(joinColumnState);
- inverseJoinColumnsState.add(joinColumnState);
- }
- map.put(INVERSE_JOIN_COLUMNS_LIST, inverseJoinColumnsState);
- this.inverseJoinColumns.clear();
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> joinColumnsState = (List<Map<String, Object>>) map.get(JOIN_COLUMNS_LIST);
- for (Map<String, Object> joinColumnState : joinColumnsState) {
- this.addJoinColumn().restoreFrom(joinColumnState);
- }
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> inverseJoinColumnsState = (List<Map<String, Object>>) map.get(INVERSE_JOIN_COLUMNS_LIST);
- for (Map<String, Object> joinColumnState : inverseJoinColumnsState) {
- this.addInverseJoinColumn().restoreFrom(joinColumnState);
- }
- }
-
-
- // ********** annotation containers **********
-
- abstract class AbstractJoinColumnAnnotationContainer
- implements AnnotationContainer<NestableJoinColumnAnnotation>
- {
- public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
- return SourceJoinTableAnnotation.this.getAstAnnotation(astRoot);
- }
-
- public String getNestedAnnotationName() {
- return JoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
- }
-
-
+
/**
- * adapt the AnnotationContainer interface to the join table's join columns
+ * adapt the AnnotationContainer interface to the collection table's join columns
*/
- class JoinColumnsAnnotationContainer
- extends AbstractJoinColumnAnnotationContainer
+ class InverseJoinColumnsAnnotationContainer
+ extends AnnotationContainer<JoinColumnAnnotation>
{
- public String getElementName() {
- return JPA.JOIN_TABLE__JOIN_COLUMNS;
- }
-
- public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
- return SourceJoinTableAnnotation.this.getNestableJoinColumns();
- }
-
- public int getNestedAnnotationsSize() {
- return SourceJoinTableAnnotation.this.joinColumnsSize();
- }
-
- public NestableJoinColumnAnnotation addNestedAnnotation() {
- return SourceJoinTableAnnotation.this.addJoinColumn_();
- }
-
- public void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
- SourceJoinTableAnnotation.this.syncAddJoinColumn(astAnnotation);
- }
-
- public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceJoinTableAnnotation.this.moveJoinColumn_(targetIndex, sourceIndex);
- }
-
- public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
- return SourceJoinTableAnnotation.this.removeJoinColumn_(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- SourceJoinTableAnnotation.this.syncRemoveJoinColumns(index);
+ @Override
+ protected String getAnnotationsPropertyName() {
+ return INVERSE_JOIN_COLUMNS_LIST;
}
- }
-
-
- /**
- * adapt the AnnotationContainer interface to the join table's inverse join columns
- */
- class InverseJoinColumnsContainerAnnotation
- extends AbstractJoinColumnAnnotationContainer
- {
- public String getElementName() {
+ @Override
+ protected String getElementName() {
return JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS;
}
-
- public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() {
- return SourceJoinTableAnnotation.this.getNestableInverseJoinColumns();
- }
-
- public int getNestedAnnotationsSize() {
- return SourceJoinTableAnnotation.this.inverseJoinColumnsSize();
+ @Override
+ protected String getNestedAnnotationName() {
+ return JPA.JOIN_COLUMN;
}
-
- public NestableJoinColumnAnnotation addNestedAnnotation() {
- return SourceJoinTableAnnotation.this.addInverseJoinColumn_();
+ @Override
+ protected JoinColumnAnnotation buildNestedAnnotation(int index) {
+ return SourceJoinTableAnnotation.this.buildInverseJoinColumn(index);
}
+ }
- public void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
- SourceJoinTableAnnotation.this.syncAddInverseJoinColumn(astAnnotation);
- }
- public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceJoinTableAnnotation.this.moveInverseJoinColumn_(targetIndex, sourceIndex);
- }
-
- public NestableJoinColumnAnnotation removeNestedAnnotation(int index) {
- return SourceJoinTableAnnotation.this.removeInverseJoinColumn_(index);
- }
+ // ********** misc **********
- public void syncRemoveNestedAnnotations(int index) {
- SourceJoinTableAnnotation.this.syncRemoveInverseJoinColumns(index);
- }
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.joinColumnsContainer.isEmpty() &&
+ this.inverseJoinColumnsContainer.isEmpty();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java
index acdef41d86..16d82c2c63 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
/**
* javax.persistence.Lob
*/
public final class SourceLobAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements LobAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceLobAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceLobAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java
index 601d50e757..55aea8843a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,14 +12,14 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToMany2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.ManyToMany
@@ -41,8 +41,8 @@ public final class SourceManyToManyAnnotation
private String mappedBy;
- public SourceManyToManyAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceManyToManyAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java
index 4eb75c9e38..aa5e0e1531 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,14 +13,14 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToOne2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.ManyToOne
@@ -42,8 +42,8 @@ public final class SourceManyToOneAnnotation
private Boolean optional;
- public SourceManyToOneAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceManyToOneAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java
index 590302bd68..d632caf533 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,23 +10,24 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
/**
* javax.persistence.MapKey
*/
public final class SourceMapKeyAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements MapKeyAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -36,9 +37,9 @@ public final class SourceMapKeyAnnotation
private String name;
- public SourceMapKeyAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, NAME_ADAPTER);
+ public SourceMapKeyAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.nameAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, NAME_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
index 0eafc0f2ce..7c16a13fdc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
/**
* javax.persistence.MappedSuperclass
*/
public final class SourceMappedSuperclassAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements MappedSuperclassAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceMappedSuperclassAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceMappedSuperclassAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
index 8f9e2d2f22..fb4bd5769b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,16 +9,16 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
/**
@@ -35,7 +35,7 @@ import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
* </code>
*/
public abstract class SourceNamedColumnAnnotation
- extends SourceAnnotation<Member>
+ extends SourceAnnotation
implements NamedColumnAnnotation
{
private DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
@@ -47,12 +47,12 @@ public abstract class SourceNamedColumnAnnotation
private String columnDefinition;
- protected SourceNamedColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ protected SourceNamedColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
}
- protected SourceNamedColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+ protected SourceNamedColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
this.nameAdapter = this.buildNameAdapter();
this.columnDefinitionDeclarationAdapter = this.buildColumnDefinitionDeclarationAdapter();
@@ -163,31 +163,6 @@ public abstract class SourceNamedColumnAnnotation
}
@Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
- this.nameAdapter = this.buildNameAdapter();
- this.columnDefinitionDeclarationAdapter = this.buildColumnDefinitionDeclarationAdapter();
- this.columnDefinitionAdapter = this.buildColumnDefinitionAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(NAME_PROPERTY, this.name);
- this.name = null;
- map.put(COLUMN_DEFINITION_PROPERTY, this.columnDefinition);
- this.columnDefinition = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setName((String) map.get(NAME_PROPERTY));
- this.setColumnDefinition((String) map.get(COLUMN_DEFINITION_PROPERTY));
- }
-
- @Override
public void toString(StringBuilder sb) {
sb.append(this.name);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java
deleted file mode 100644
index f1eaa10446..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
-
-/**
- * <code>javax.persistence.NamedNativeQueries</code>
- */
-public final class SourceNamedNativeQueriesAnnotation
- extends SourceAnnotation<Type>
- implements NamedNativeQueriesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableNamedNativeQueryAnnotation> namedNativeQueries = new Vector<NestableNamedNativeQueryAnnotation>();
-
-
- public SourceNamedNativeQueriesAnnotation(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- AnnotationContainerTools.synchronize(this, astRoot);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.namedNativeQueries.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.namedNativeQueries);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getElementName() {
- return JPA.NAMED_NATIVE_QUERIES__VALUE;
- }
-
- public String getNestedAnnotationName() {
- return NamedNativeQueryAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableNamedNativeQueryAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableNamedNativeQueryAnnotation>(this.namedNativeQueries);
- }
-
- public int getNestedAnnotationsSize() {
- return this.namedNativeQueries.size();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.nestStandAloneAnnotation(standAloneAnnotation, this.namedNativeQueries.size());
- }
-
- private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
- standAloneAnnotation.convertToNested(this, this.daa, index);
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- this.namedNativeQueries.add(index, (NestableNamedNativeQueryAnnotation) annotation);
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- this.namedNativeQueries.remove(0).convertToStandAlone();
- }
-
- public NestableNamedNativeQueryAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.namedNativeQueries.size());
- }
-
- private NestableNamedNativeQueryAnnotation addNestedAnnotation(int index) {
- NestableNamedNativeQueryAnnotation namedNativeQuery = this.buildNamedNativeQuery(index);
- this.namedNativeQueries.add(index, namedNativeQuery);
- return namedNativeQuery;
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- int index = this.namedNativeQueries.size();
- NestableNamedNativeQueryAnnotation namedNativeQuery = this.addNestedAnnotation(index);
- namedNativeQuery.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(NAMED_NATIVE_QUERIES_LIST, index, namedNativeQuery);
- }
-
- private NestableNamedNativeQueryAnnotation buildNamedNativeQuery(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceNamedNativeQueryAnnotation.createNestedNamedNativeQuery(this.parent, this.annotatedElement, index, this.daa);
- }
-
- public NestableNamedNativeQueryAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public NestableNamedNativeQueryAnnotation removeNestedAnnotation(int index) {
- return this.namedNativeQueries.remove(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
index 8ad2d4055c..ac06f765c6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,35 +9,34 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
/**
* <code>javax.persistence.NamedNativeQuery</code>
*/
public final class SourceNamedNativeQueryAnnotation
extends SourceQueryAnnotation
- implements NestableNamedNativeQueryAnnotation
+ implements NamedNativeQueryAnnotation
{
- public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.NAMED_NATIVE_QUERIES);
private DeclarationAnnotationElementAdapter<String> resultClassDeclarationAdapter;
private AnnotationElementAdapter<String> resultClassAdapter;
@@ -54,9 +53,22 @@ public final class SourceNamedNativeQueryAnnotation
private AnnotationElementAdapter<String> resultSetMappingAdapter;
private String resultSetMapping;
-
- public SourceNamedNativeQueryAnnotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
+ public static SourceNamedNativeQueryAnnotation buildSourceNamedNativeQueryAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNamedNativeQueryDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildNamedNativeQueryAnnotationAdapter(element, idaa);
+ return new SourceNamedNativeQueryAnnotation(
+ parent,
+ element,
+ idaa,
+ iaa);
+ }
+
+ private SourceNamedNativeQueryAnnotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter daa,
+ IndexedAnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.resultClassDeclarationAdapter = this.buildResultClassDeclarationAdapter();
this.resultClassAdapter = this.buildResultClassAdapter();
this.resultSetMappingDeclarationAdapter = this.buildResultSetMappingAdapter(daa);
@@ -100,8 +112,8 @@ public final class SourceNamedNativeQueryAnnotation
}
@Override
- NestableQueryHintAnnotation buildHint(int index) {
- return SourceQueryHintAnnotation.createNamedNativeQueryQueryHint(this, this.annotatedElement, this.daa, index);
+ QueryHintAnnotation buildHint(int index) {
+ return SourceQueryHintAnnotation.buildNamedNativeQueryQueryHint(this, this.annotatedElement, this.daa, index);
}
@@ -210,41 +222,19 @@ public final class SourceNamedNativeQueryAnnotation
(this.resultSetMapping == null);
}
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.resultClassDeclarationAdapter = this.buildResultClassDeclarationAdapter();
- this.resultClassAdapter = this.buildResultClassAdapter();
- this.resultSetMappingDeclarationAdapter = this.buildResultSetMappingAdapter(daa);
- this.resultSetMappingAdapter = this.buildResultSetMappingAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(RESULT_CLASS_PROPERTY, this.resultClass);
- this.resultClass = null;
- map.put(RESULT_SET_MAPPING_PROPERTY, this.resultSetMapping);
- this.resultSetMapping = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setResultClass((String) map.get(RESULT_CLASS_PROPERTY));
- this.setResultSetMapping((String) map.get(RESULT_SET_MAPPING_PROPERTY));
- }
-
-
// ********** static methods **********
- public static SourceNamedNativeQueryAnnotation createNamedNativeQuery(JavaResourceNode parent, Type type) {
- return new SourceNamedNativeQueryAnnotation(parent, type, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
+ private static IndexedAnnotationAdapter buildNamedNativeQueryAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
+ return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
}
- static SourceNamedNativeQueryAnnotation createNestedNamedNativeQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(type, idaa);
- return new SourceNamedNativeQueryAnnotation(parent, type, idaa, annotationAdapter);
+ private static IndexedDeclarationAnnotationAdapter buildNamedNativeQueryDeclarationAnnotationAdapter(int index) {
+ IndexedDeclarationAnnotationAdapter idaa =
+ new CombinationIndexedDeclarationAnnotationAdapter(
+ DECLARATION_ANNOTATION_ADAPTER,
+ CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
+ index,
+ ANNOTATION_NAME);
+ return idaa;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java
deleted file mode 100644
index b6b8b328d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
-
-/**
- * <code>javax.persistence.NamedQueries</code>
- */
-public final class SourceNamedQueries1_0Annotation
- extends SourceNamedQueriesAnnotation
-{
- public SourceNamedQueries1_0Annotation(JavaResourceNode parent, Type type) {
- super(parent, type);
- }
-
- @Override
- protected NestableNamedQueryAnnotation buildNamedQuery(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceNamedQueryAnnotation.createNestedNamedQuery(this.parent, this.annotatedElement, index, this.daa);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java
deleted file mode 100644
index 17665feda2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
-
-/**
- * <code>javax.persistence.NamedQueries</code>
- */
-public abstract class SourceNamedQueriesAnnotation
- extends SourceAnnotation<Type>
- implements NamedQueriesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableNamedQueryAnnotation> namedQueries = new Vector<NestableNamedQueryAnnotation>();
-
-
- public SourceNamedQueriesAnnotation(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- AnnotationContainerTools.synchronize(this, astRoot);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.namedQueries.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.namedQueries);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getElementName() {
- return JPA.NAMED_QUERIES__VALUE;
- }
-
- public String getNestedAnnotationName() {
- return NamedQueryAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableNamedQueryAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableNamedQueryAnnotation>(this.namedQueries);
- }
-
- public int getNestedAnnotationsSize() {
- return this.namedQueries.size();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.nestStandAloneAnnotation(standAloneAnnotation, this.namedQueries.size());
- }
-
- private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
- standAloneAnnotation.convertToNested(this, this.daa, index);
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- this.namedQueries.add(index, (NestableNamedQueryAnnotation) annotation);
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- this.namedQueries.remove(0).convertToStandAlone();
- }
-
- public NestableNamedQueryAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.namedQueries.size());
- }
-
- private NestableNamedQueryAnnotation addNestedAnnotation(int index) {
- NestableNamedQueryAnnotation namedQuery = this.buildNamedQuery(index);
- this.namedQueries.add(index, namedQuery);
- return namedQuery;
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- int index = this.namedQueries.size();
- NestableNamedQueryAnnotation namedQuery = this.addNestedAnnotation(index);
- namedQuery.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(NAMED_QUERIES_LIST, index, namedQuery);
- }
-
- protected abstract NestableNamedQueryAnnotation buildNamedQuery(int index);
-
- public NestableNamedQueryAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.namedQueries, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public NestableNamedQueryAnnotation removeNestedAnnotation(int index) {
- return this.namedQueries.remove(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.namedQueries, NAMED_QUERIES_LIST);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
index 3389852b42..6dc5549eda 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,37 +9,34 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
/**
* <code>javax.persistence.NamedQuery</code>
*/
public abstract class SourceNamedQueryAnnotation
extends SourceQueryAnnotation
- implements NestableNamedQueryAnnotation
+ implements NamedQueryAnnotation
{
- public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.NAMED_QUERIES);
-
- public SourceNamedQueryAnnotation(JavaResourceNode parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
+
+ protected SourceNamedQueryAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
}
- public SourceNamedQueryAnnotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
- }
public String getAnnotationName() {
return ANNOTATION_NAME;
@@ -64,17 +61,21 @@ public abstract class SourceNamedQueryAnnotation
}
@Override
- NestableQueryHintAnnotation buildHint(int index) {
- return SourceQueryHintAnnotation.createNamedQueryQueryHint(this, this.annotatedElement, this.daa, index);
+ QueryHintAnnotation buildHint(int index) {
+ return SourceQueryHintAnnotation.buildNamedQueryQueryHint(this, this.annotatedElement, this.daa, index);
}
+ protected static IndexedAnnotationAdapter buildNamedQueryAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
+ return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
+ }
- // ********** static methods **********
-
- static SourceNamedQueryAnnotation createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(type, idaa);
-
- return new SourceNamedQuery1_0Annotation(parent, type, idaa, annotationAdapter);
+ protected static IndexedDeclarationAnnotationAdapter buildNamedQueryDeclarationAnnotationAdapter(int index) {
+ IndexedDeclarationAnnotationAdapter idaa =
+ new CombinationIndexedDeclarationAnnotationAdapter(
+ DECLARATION_ANNOTATION_ADAPTER,
+ CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
+ index,
+ ANNOTATION_NAME);
+ return idaa;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java
deleted file mode 100644
index 59f548213e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-
-/**
- * Source convenience methods
- */
-public abstract class SourceNode
- extends AbstractJavaResourceNode
-{
-
- public SourceNode(JavaResourceNode parent) {
- super(parent);
- }
-
- public JavaResourceCompilationUnit getJavaResourceCompilationUnit() {
- return (JavaResourceCompilationUnit) this.getRoot();
- }
-
- protected CompilationUnit buildASTRoot() {
- return this.getJavaResourceCompilationUnit().buildASTRoot();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java
index c32094c53b..c2cacdba8c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,15 +13,15 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToMany2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.OneToMany
@@ -47,8 +47,8 @@ public final class SourceOneToManyAnnotation
private final AnnotationElementAdapter<Boolean> orphanRemovalAdapter;
private Boolean orphanRemoval;
- public SourceOneToManyAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceOneToManyAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
this.orphanRemovalAdapter = this.buildBooleanAnnotationElementAdapter(ORPHAN_REMOVAL_ADAPTER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java
index 1867a43f80..1f5a040a23 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,15 +13,15 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToOne2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.OneToOne
@@ -51,8 +51,8 @@ public final class SourceOneToOneAnnotation
private final AnnotationElementAdapter<Boolean> orphanRemovalAdapter;
private Boolean orphanRemoval;
- public SourceOneToOneAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceOneToOneAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
this.orphanRemovalAdapter = this.buildBooleanAnnotationElementAdapter(ORPHAN_REMOVAL_ADAPTER);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java
index 78a7ccc939..84d5d31dbb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,23 +10,24 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
/**
* javax.persistence.OrderBy
*/
public final class SourceOrderByAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements OrderByAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
@@ -36,9 +37,9 @@ public final class SourceOrderByAnnotation
private String value;
- public SourceOrderByAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ public SourceOrderByAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java
index af86e3b55c..e48badcd00 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,15 +9,15 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
/**
@@ -27,7 +27,7 @@ import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
* </ul>
*/
abstract class SourceOverrideAnnotation
- extends SourceAnnotation<Member>
+ extends SourceAnnotation
implements OverrideAnnotation
{
DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
@@ -35,8 +35,8 @@ abstract class SourceOverrideAnnotation
String name;
- SourceOverrideAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+ SourceOverrideAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
this.nameAdapter = this.buildNameAdapter();
}
@@ -91,18 +91,6 @@ abstract class SourceOverrideAnnotation
}
protected abstract String getNameElementName();
-
-
- // ********** NestableAnnotation implementation **********
-
- /**
- * Convenience implementation of
- * {@link org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation#moveAnnotation(int)}
- * used by subclasses.
- */
- public void moveAnnotation(int index) {
- this.getIndexedAnnotationAdapter().moveAnnotation(index);
- }
// ********** misc **********
@@ -114,26 +102,6 @@ abstract class SourceOverrideAnnotation
}
@Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
- this.nameAdapter = this.buildNameAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(NAME_PROPERTY, this.name);
- this.name = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setName((String) map.get(NAME_PROPERTY));
- }
-
- @Override
public void toString(StringBuilder sb) {
sb.append(this.name);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java
deleted file mode 100644
index 604045d275..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.IPackageBinding;
-import org.eclipse.jdt.core.dom.PackageDeclaration;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JDTPackage;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
-
-/**
- * @author Dmitry Geraskov
- * Source package-info.java
- *
- */
-public final class SourcePackage
- extends SourceAnnotatedElement<AnnotatedPackage>
- implements JavaResourcePackage {
-
- private String name;
-
- /**
- * construct package info
- */
- public static JavaResourcePackage newInstance(
- JavaResourceCompilationUnit parent,
- PackageDeclaration declaringPackage,
- CompilationUnit astRoot) {
- AnnotatedPackage pack = new JDTPackage(
- declaringPackage,
- parent.getCompilationUnit(),
- parent.getModifySharedDocumentCommandExecutor(),
- parent.getAnnotationEditFormatter());
- JavaResourcePackage jrpp = new SourcePackage(parent, pack);
- jrpp.initialize(astRoot);
- return jrpp;
- }
-
- private SourcePackage(
- JavaResourceCompilationUnit parent,
- AnnotatedPackage pack){
- super(parent, pack);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.name = this.buildName(astRoot);
- }
-
-
- // ********** JavaResourcePackageInfo implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- private void syncName(String astName) {
- if (valuesAreDifferent(astName, this.name)){
- String old = this.name;
- this.name = astName;
- this.firePropertyChanged(NAME_PROPERTY, old, astName);
- }
- }
-
- private String buildName(CompilationUnit astRoot) {
- IPackageBinding binding = this.annotatedElement.getBinding(astRoot);
- return (binding == null) ? null : binding.getName();
- }
-
-
- // ********** Java changes **********
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.syncName(this.buildName(astRoot));
- }
-
- // ********** SourceAnnotatedElement implementation **********
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().packageAnnotationNames();
- }
-
-
- @Override
- Annotation buildAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildPackageAnnotation(this, this.annotatedElement, annotationName);
- }
-
- @Override
- Annotation buildNullAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildNullPackageAnnotation(this, annotationName);
- }
-
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
deleted file mode 100644
index f6979b9ea2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.PackageDeclaration;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.common.utility.CommandExecutor;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageInfoCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * @author Dmitry Geraskov
- * Source package-info.java
- *
- */
-public final class SourcePackageInfoCompilationUnit
- extends SourceCompilationUnit
- implements JavaResourcePackageInfoCompilationUnit {
-
- private JavaResourcePackage package_;
-
- public SourcePackageInfoCompilationUnit(
- ICompilationUnit compilationUnit,
- JpaAnnotationProvider annotationProvider,
- AnnotationEditFormatter annotationEditFormatter,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- super(compilationUnit, annotationProvider, annotationEditFormatter, modifySharedDocumentCommandExecutor); // the JPA compilation unit is the root of its sub-tree
- this.package_ = this.buildPackage();
- }
-
-
- private JavaResourcePackage buildPackage() {
- this.openCompilationUnit();
- CompilationUnit astRoot = this.buildASTRoot();
- this.closeCompilationUnit();
- return this.buildPackage(astRoot);
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- public Iterator<JavaResourcePersistentType> persistentTypes() {
- return EmptyIterator.instance();
- }
-
-
- // ********** JptResourceModel implementation **********
-
- public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE;
- }
-
-
- // ********** Java changes **********
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncPackage(astRoot);
- }
-
-
- // ********** JavaResourceCompilationUnit implementation **********
-
- public void resolveTypes() {
- //no-op
- }
-
- // ********** package-info **********
-
- public JavaResourcePackage getPackage() {
- return this.package_;
- }
-
- private JavaResourcePackage buildPackage(CompilationUnit astRoot) {
- return this.buildPackage(astRoot, this.getPackageDeclaration(astRoot));
- }
-
- private void syncPackage(CompilationUnit astRoot) {
- PackageDeclaration pd = this.getPackageDeclaration(astRoot);
- if (pd == null) {
- this.syncPackage_(null);
- } else {
- if (this.package_ == null) {
- this.syncPackage_(this.buildPackage(astRoot, pd));
- } else {
- this.package_.synchronizeWith(astRoot);
- }
- }
- }
-
- private PackageDeclaration getPackageDeclaration(CompilationUnit astRoot) {
- return astRoot.getPackage();
- }
-
- private void syncPackage_(JavaResourcePackage astPackage) {
- JavaResourcePackage old = this.package_;
- this.package_ = astPackage;
- this.firePropertyChanged(PACKAGE, old, astPackage);
- }
-
- private JavaResourcePackage buildPackage(CompilationUnit astRoot, PackageDeclaration packageDeclaration) {
- return SourcePackage.newInstance(this, packageDeclaration, astRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java
deleted file mode 100644
index f12f70444b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.IBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JDTFieldAttribute;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JDTMethodAttribute;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.common.core.utility.jdt.MethodAttribute;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.common.utility.MethodSignature;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * Java source persistent attribute (field or property)
- */
-final class SourcePersistentAttribute
- extends SourcePersistentMember<Attribute>
- implements JavaResourcePersistentAttribute
-{
- private int modifiers;
-
- private String typeName;
-
- private boolean typeIsInterface;
-
- private boolean typeIsEnum;
-
- private final Vector<String> typeSuperclassNames = new Vector<String>();
-
- private final Vector<String> typeInterfaceNames = new Vector<String>();
-
- private final Vector<String> typeTypeArgumentNames = new Vector<String>();
-
-
- /**
- * construct field attribute
- */
- static JavaResourcePersistentAttribute newInstance(
- JavaResourcePersistentType parent,
- Type declaringType,
- String name,
- int occurrence,
- JavaResourceCompilationUnit javaResourceCompilationUnit,
- CompilationUnit astRoot) {
- Attribute attribute = new JDTFieldAttribute(
- declaringType,
- name,
- occurrence,
- javaResourceCompilationUnit.getCompilationUnit(),
- javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
- javaResourceCompilationUnit.getAnnotationEditFormatter());
- JavaResourcePersistentAttribute jrpa = new SourcePersistentAttribute(parent, attribute);
- jrpa.initialize(astRoot);
- return jrpa;
- }
-
- /**
- * construct property attribute
- */
- static JavaResourcePersistentAttribute newInstance(
- JavaResourcePersistentType parent,
- Type declaringType,
- MethodSignature signature,
- int occurrence,
- JavaResourceCompilationUnit javaResourceCompilationUnit,
- CompilationUnit astRoot) {
- Attribute attribute = JDTMethodAttribute.newInstance(
- declaringType,
- signature,
- occurrence,
- javaResourceCompilationUnit.getCompilationUnit(),
- javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
- javaResourceCompilationUnit.getAnnotationEditFormatter());
- JavaResourcePersistentAttribute jrpa = new SourcePersistentAttribute(parent, attribute);
- jrpa.initialize(astRoot);
- return jrpa;
- }
-
- private SourcePersistentAttribute(JavaResourcePersistentType parent, Attribute attribute){
- super(parent, attribute);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- ITypeBinding typeBinding = this.getTypeBinding(astRoot); //build once, minor performance tweak for major benefit
- this.modifiers = this.buildModifiers(astRoot);
- this.typeName = this.buildTypeName(typeBinding);
- this.typeIsInterface = this.buildTypeIsInterface(typeBinding);
- this.typeIsEnum = this.buildTypeIsEnum(typeBinding);
- this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(typeBinding));
- this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(typeBinding));
- this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames(typeBinding));
- }
-
-
- // ******** overrides ********
-
- @Override
- public void resolveTypes(CompilationUnit astRoot) {
- super.resolveTypes(astRoot);
- ITypeBinding typeBinding = this.getTypeBinding(astRoot);//build once, minor performance tweak for major benefit
- this.syncTypeName(this.buildTypeName(typeBinding));
- this.syncTypeSuperclassNames(this.buildTypeSuperclassNames(typeBinding));
- this.syncTypeInterfaceNames(this.buildTypeInterfaceNames(typeBinding));
- this.syncTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(typeBinding));
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- ITypeBinding typeBinding = this.getTypeBinding(astRoot);//build once, minor performance tweak for major benefit
- this.syncModifiers(this.buildModifiers(astRoot));
- this.syncTypeName(this.buildTypeName(typeBinding));
- this.syncTypeIsInterface(this.buildTypeIsInterface(typeBinding));
- this.syncTypeIsEnum(this.buildTypeIsEnum(typeBinding));
- this.syncTypeSuperclassNames(this.buildTypeSuperclassNames(typeBinding));
- this.syncTypeInterfaceNames(this.buildTypeInterfaceNames(typeBinding));
- this.syncTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(typeBinding));
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ******** SourcePersistentMember implementation ********
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().attributeAnnotationNames();
- }
-
- @Override
- Annotation buildAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildAttributeAnnotation(this, this.annotatedElement, annotationName);
- }
-
- private Annotation buildNullAnnotation_(String annotationName) {
- return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
- }
-
-
- // ******** JavaResourcePersistentAttribute implementation ********
-
- @Override
- public JavaResourcePersistentType getParent() {
- return (JavaResourcePersistentType) super.getParent();
- }
-
- public JavaResourcePersistentType getResourcePersistentType() {
- return this.getParent();
- }
-
- public String getName() {
- return this.annotatedElement.getAttributeName();
- }
-
- public boolean isFor(MethodSignature signature, int occurrence) {
- return ((MethodAttribute) this.annotatedElement).matches(signature, occurrence);
- }
-
- @Override
- public Annotation buildNullAnnotation(String annotationName) {
- return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName);
- }
-
- public boolean isField() {
- return this.annotatedElement.isField();
- }
-
- public boolean isProperty() {
- return ! this.isField();
- }
-
- public AccessType getSpecifiedAccess() {
- Access2_0Annotation accessAnnotation = this.getAccessAnnotation();
- return (accessAnnotation == null) ? null : accessAnnotation.getValue();
- }
-
- private Access2_0Annotation getAccessAnnotation() {
- return (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
- }
-
- public boolean typeIsSubTypeOf(String tn) {
- if (this.typeName == null) {
- return false;
- }
- return this.typeName.equals(tn)
- || this.typeInterfaceNames.contains(tn)
- || this.typeSuperclassNames.contains(tn);
- }
-
- public boolean typeIsVariablePrimitive() {
- return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName);
- }
-
- private ITypeBinding getTypeBinding(CompilationUnit astRoot) {
- return this.annotatedElement.getTypeBinding(astRoot);
- }
-
-
- // ***** modifiers
- public int getModifiers() {
- return this.modifiers;
- }
-
- private void syncModifiers(int astModifiers) {
- int old = this.modifiers;
- this.modifiers = astModifiers;
- this.firePropertyChanged(MODIFIERS_PROPERTY, old, astModifiers);
- }
-
- /**
- * zero seems like a reasonable default...
- */
- private int buildModifiers(CompilationUnit astRoot) {
- IBinding binding = this.annotatedElement.getBinding(astRoot);
- return (binding == null) ? 0 : binding.getModifiers();
- }
-
- // ***** type name
- public String getTypeName() {
- return this.typeName;
- }
-
- private void syncTypeName(String astTypeName) {
- String old = this.typeName;
- this.typeName = astTypeName;
- this.firePropertyChanged(TYPE_NAME_PROPERTY, old, astTypeName);
- }
-
- /**
- * this can be an array (e.g. "java.lang.String[]");
- * but no generic type arguments
- */
- private String buildTypeName(ITypeBinding typeBinding) {
- if (typeBinding == null) {
- return null;
- }
- // a type variable is what is declared by a generic type;
- // e.g. "E" is a type variable declared by the generic type "Collection" in
- // public interface Collection<E>
- if (typeBinding.isTypeVariable()) {
- // e.g. "E extends Number" has an erasure of "Number"
- typeBinding = typeBinding.getErasure();
- }
- String tbName = typeBinding.getTypeDeclaration().getQualifiedName();
- return (tbName.length() == 0) ? null : tbName;
- }
-
- // ***** type is interface
- public boolean typeIsInterface() {
- return this.typeIsInterface;
- }
-
- private void syncTypeIsInterface(boolean astTypeIsInterface) {
- boolean old = this.typeIsInterface;
- this.typeIsInterface = astTypeIsInterface;
- this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, astTypeIsInterface);
- }
-
- private boolean buildTypeIsInterface(ITypeBinding typeBinding) {
- return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isInterface();
- }
-
- // ***** type is enum
- public boolean typeIsEnum() {
- return this.typeIsEnum;
- }
-
- private void syncTypeIsEnum(boolean astTypeIsEnum) {
- boolean old = this.typeIsEnum;
- this.typeIsEnum = astTypeIsEnum;
- this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, astTypeIsEnum);
- }
-
- private boolean buildTypeIsEnum(ITypeBinding typeBinding) {
- return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isEnum();
- }
-
- // ***** type superclass hierarchy
- public ListIterator<String> typeSuperclassNames() {
- return new CloneListIterator<String>(this.typeSuperclassNames);
- }
-
- private void syncTypeSuperclassNames(List<String> astTypeSuperclassNames) {
- this.synchronizeList(astTypeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST);
- }
-
- private List<String> buildTypeSuperclassNames(ITypeBinding typeBinding) {
- if (typeBinding == null) {
- return Collections.emptyList();
- }
- ArrayList<String> names = new ArrayList<String>();
- typeBinding = typeBinding.getSuperclass();
- while (typeBinding != null) {
- names.add(typeBinding.getQualifiedName());
- typeBinding = typeBinding.getSuperclass();
- }
- return names;
- }
-
- // ***** type interface hierarchy
- public Iterator<String> typeInterfaceNames() {
- return new CloneIterator<String>(this.typeInterfaceNames);
- }
-
-// private boolean typeInterfaceNamesContains(String interfaceName) {
-// return this.typeInterfaceNames.contains(interfaceName);
-// }
-//
- private void syncTypeInterfaceNames(Collection<String> astTypeInterfaceNames) {
- this.synchronizeCollection(astTypeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION);
- }
-
- private Collection<String> buildTypeInterfaceNames(ITypeBinding typeBinding) {
- if (typeBinding == null) {
- return Collections.emptySet();
- }
- HashSet<String> names = new HashSet<String>();
- while (typeBinding != null) {
- this.addInterfaceNamesTo(typeBinding, names);
- typeBinding = typeBinding.getSuperclass();
- }
- return names;
- }
-
- private void addInterfaceNamesTo(ITypeBinding typeBinding, HashSet<String> names) {
- for (ITypeBinding interfaceBinding : typeBinding.getInterfaces()) {
- names.add(interfaceBinding.getTypeDeclaration().getQualifiedName());
- this.addInterfaceNamesTo(interfaceBinding, names); // recurse
- }
- }
-
- // ***** type type argument names
- public ListIterator<String> typeTypeArgumentNames() {
- return new CloneListIterator<String>(this.typeTypeArgumentNames);
- }
-
- public int typeTypeArgumentNamesSize() {
- return this.typeTypeArgumentNames.size();
- }
-
- public String getTypeTypeArgumentName(int index) {
- return this.typeTypeArgumentNames.get(index);
- }
-
- private void syncTypeTypeArgumentNames(List<String> astTypeTypeArgumentNames) {
- this.synchronizeList(astTypeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST);
- }
-
- /**
- * these types can be arrays (e.g. "java.lang.String[]");
- * but they won't have any further nested generic type arguments
- * (e.g. "java.util.Collection<java.lang.String>")
- */
- private List<String> buildTypeTypeArgumentNames(ITypeBinding typeBinding) {
- if (typeBinding == null) {
- return Collections.emptyList();
- }
-
- ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
- if (typeArguments.length == 0) {
- return Collections.emptyList();
- }
-
- ArrayList<String> names = new ArrayList<String>(typeArguments.length);
- for (ITypeBinding typeArgument : typeArguments) {
- if (typeArgument == null) {
- names.add(null);
- } else {
- // e.g. "? extends Number" has an erasure of "Number"
- ITypeBinding erasure = typeArgument.getErasure();
- names.add(erasure.getTypeDeclaration().getQualifiedName());
- }
- }
- return names;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java
deleted file mode 100644
index d4af024013..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.IBinding;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
-
-/**
- * Java source persistent member (annotations, "persistable")
- */
-abstract class SourcePersistentMember<M extends Member>
- extends SourceAnnotatedElement<M>
- implements JavaResourcePersistentMember
-{
- /**
- * We can cache this setting because its value is not affected by any API
- * calls - it can only be affected by changes to the Java source.
- * @see org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools.TypeAdapter)
- */
- boolean persistable;
-
- boolean final_; // 'final' is a reserved word
-
-
- // ********** construction/initialization **********
-
- SourcePersistentMember(JavaResourceNode parent, M member) {
- super(parent, member);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.persistable = this.buildPersistable(astRoot);
- IBinding binding = this.annotatedElement.getBinding(astRoot);
- this.final_ = this.buildFinal(binding);
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.syncPersistable(this.buildPersistable(astRoot));
- IBinding binding = this.annotatedElement.getBinding(astRoot);
- this.syncFinal(this.buildFinal(binding));
- }
-
-
- // ********** annotations **********
-
- public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
- HashSet<String> annotationNames = CollectionTools.set(supportingAnnotationNames);
- if (primaryAnnotationName != null) {
- annotationNames.add(primaryAnnotationName);
- }
- for (Annotation annotation : this.getAnnotations()) {
- if ( ! annotationNames.contains(annotation.getAnnotationName())) {
- this.annotations.remove(annotation);
- annotation.removeAnnotation();
- }
- }
- Annotation newPrimaryAnnotation = null;
- if ((primaryAnnotationName != null) && (this.getAnnotation(primaryAnnotationName) == null)) {
- newPrimaryAnnotation = this.buildAnnotation(primaryAnnotationName);
- this.annotations.add(newPrimaryAnnotation);
- newPrimaryAnnotation.newAnnotation();
- }
- return newPrimaryAnnotation;
- }
-
-
- // ********** persistable **********
-
- public boolean isPersistable() {
- return this.persistable;
- }
-
- private void syncPersistable(boolean astPersistable) {
- boolean old = this.persistable;
- this.persistable = astPersistable;
- this.firePropertyChanged(PERSISTABLE_PROPERTY, old, astPersistable);
- }
-
- private boolean buildPersistable(CompilationUnit astRoot) {
- return this.annotatedElement.isPersistable(astRoot);
- }
-
- // ***** final
- public boolean isFinal() {
- return this.final_;
- }
-
- private void syncFinal(boolean astFinal) {
- boolean old = this.final_;
- this.final_ = astFinal;
- this.firePropertyChanged(FINAL_PROPERTY, old, astFinal);
- }
-
- private boolean buildFinal(IBinding binding) {
- return (binding == null) ? false : Modifier.isFinal(binding.getModifiers());
- }
-
-
- // ********** miscellaneous **********
-
- public boolean isFor(String memberName, int occurrence) {
- return this.annotatedElement.matches(memberName, occurrence);
- }
-
- public void resolveTypes(CompilationUnit astRoot) {
- this.syncPersistable(this.buildPersistable(astRoot));
- }
-
- /**
- * convenience method
- */
- <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) {
- @SuppressWarnings("unchecked")
- Filter<T> filter = (Filter<T>) PERSISTABLE_MEMBER_FILTER;
- return new FilteringIterator<T>(members, filter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java
deleted file mode 100644
index d296b00eb4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java
+++ /dev/null
@@ -1,930 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.IAnnotationBinding;
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JDTType;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.common.utility.MethodSignature;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.SimpleIntReference;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TreeIterator;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.GeneratedAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.StaticMetamodelAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * Java source persistent type
- */
-final class SourcePersistentType
- extends SourcePersistentMember<Type>
- implements JavaResourcePersistentType2_0
-{
- private String name;
-
- private String qualifiedName;
-
- private String packageName;
-
- private String superclassQualifiedName;
-
- private String declaringTypeName;
-
- private boolean abstract_; // 'abstract' is a reserved word
-
- private boolean static_; // 'static' is a reserved word
-
- private boolean memberType;
-
- private boolean hasPrivateNoArgConstructor;
-
- private boolean hasNoArgConstructor;
-
- private final Vector<JavaResourcePersistentType> types = new Vector<JavaResourcePersistentType>();
-
- private final Vector<JavaResourcePersistentAttribute> fields = new Vector<JavaResourcePersistentAttribute>();
-
- private final Vector<JavaResourcePersistentAttribute> methods = new Vector<JavaResourcePersistentAttribute>();
-
- private StaticMetamodelAnnotation staticMetamodelAnnotation;
- //TODO move to interface after maintenance
- public static final String STATIC_METAMODEL_ANNOTATION_PROPERTY = "staticMetamodelAnnotation"; //$NON-NLS-1$
-
- private GeneratedAnnotation generatedAnnotation;
- //TODO move to interface after maintenance
- public static final String GENERATED_ANNOTATION_PROPERTY = "generatedAnnotation"; //$NON-NLS-1$
-
-
- private static final StaticMetamodelAnnotationDefinition STATIC_METAMODEL_ANNOTATION_DEFINITION = StaticMetamodelAnnotationDefinition.instance();
- private static final GeneratedAnnotationDefinition GENERATED_ANNOTATION_DEFINITION = GeneratedAnnotationDefinition.instance();
-
-
- // ********** construction/initialization **********
-
- /**
- * build top-level persistent type
- */
- static JavaResourcePersistentType newInstance(
- JavaResourceCompilationUnit javaResourceCompilationUnit,
- TypeDeclaration typeDeclaration,
- CompilationUnit astRoot) {
- Type type = new JDTType(
- typeDeclaration,
- javaResourceCompilationUnit.getCompilationUnit(),
- javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
- javaResourceCompilationUnit.getAnnotationEditFormatter());
- JavaResourcePersistentType jrpt = new SourcePersistentType(javaResourceCompilationUnit, type);
- jrpt.initialize(astRoot);
- return jrpt;
- }
-
- /**
- * build nested persistent type
- */
- private static JavaResourcePersistentType newInstance(
- JavaResourceCompilationUnit javaResourceCompilationUnit,
- Type declaringType,
- TypeDeclaration typeDeclaration,
- int occurrence,
- CompilationUnit astRoot) {
- Type type = new JDTType(
- declaringType,
- typeDeclaration,
- occurrence,
- javaResourceCompilationUnit.getCompilationUnit(),
- javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(),
- javaResourceCompilationUnit.getAnnotationEditFormatter());
- JavaResourcePersistentType jrpt = new SourcePersistentType(javaResourceCompilationUnit, type);
- jrpt.initialize(astRoot);
- return jrpt;
- }
-
- private SourcePersistentType(JavaResourceCompilationUnit javaResourceCompilationUnit, Type type) {
- super(javaResourceCompilationUnit, type);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- ITypeBinding binding = this.annotatedElement.getBinding(astRoot);
- this.name = this.buildName(binding);
- this.qualifiedName = this.buildQualifiedName(binding);
- this.packageName = this.buildPackageName(binding);
- this.superclassQualifiedName = this.buildSuperclassQualifiedName(binding);
- this.declaringTypeName = this.buildDeclaringTypeName(binding);
- this.abstract_ = this.buildAbstract(binding);
- this.static_ = this.buildStatic(binding);
- this.memberType = this.buildMemberType(binding);
- this.hasNoArgConstructor = this.buildHasNoArgConstructor(binding);
- this.hasPrivateNoArgConstructor = this.buildHasPrivateNoArgConstructor(binding);
- this.initializeTypes(astRoot);
- this.initializeFields(astRoot);
- this.initializeMethods(astRoot);
- }
-
- /**
- * Handle the <code>StaticMetamodel</code> and <code>Generated</code>
- * annotations differently, since they are not really JPA "mapping"
- * annotations....
- */
- @Override
- void addInitialAnnotation(String astAnnotationName, CompilationUnit astRoot) {
- if (astAnnotationName.equals(STATIC_METAMODEL_ANNOTATION_DEFINITION.getAnnotationName())) {
- this.addInitialStaticMetamodelAnnotation(astRoot);
- } else if (astAnnotationName.equals(GENERATED_ANNOTATION_DEFINITION.getAnnotationName())) {
- this.addInitialGeneratedAnnotation(astRoot);
- } else {
- super.addInitialAnnotation(astAnnotationName, astRoot);
- }
- }
-
-
- // ********** update **********
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- ITypeBinding binding = this.annotatedElement.getBinding(astRoot);
- this.syncName(this.buildName(binding));
- this.syncQualifiedName(this.buildQualifiedName(binding));
- this.syncPackageName(this.buildPackageName(binding));
- this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(binding));
- this.syncDeclaringTypeName(this.buildDeclaringTypeName(binding));
- this.syncAbstract(this.buildAbstract(binding));
- this.syncStatic(this.buildStatic(binding));
- this.syncMemberType(this.buildMemberType(binding));
- this.syncHasNoArgConstructor(this.buildHasNoArgConstructor(binding));
- this.syncHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor(binding));
- this.syncTypes(astRoot);
- this.syncFields(astRoot);
- this.syncMethods(astRoot);
- this.syncMetamodelAnnotations(astRoot);
- }
-
- /**
- * Handle the <code>StaticMetamodel</code> and <code>Generated</code>
- * annotations differently, since they are not really JPA "mapping"
- * annotations. We aren't overriding {@link #addOrSyncAnnotation(String, CompilationUnit, java.util.Set)}
- * because we also have to handle removing these annotations separately.
- */
- private void syncMetamodelAnnotations(CompilationUnit astRoot) {
- ITypeBinding binding = this.annotatedElement.getBinding(astRoot);
- if (binding != null) {
- this.syncStaticMetamodelAnnotation(astRoot, binding);
- this.syncGeneratedAnnotation(astRoot, binding);
- }
- }
-
-
- // ********** SourcePersistentMember implementation **********
-
- @Override
- Iterator<String> validAnnotationNames() {
- return this.getAnnotationProvider().typeAnnotationNames();
- }
-
- @Override
- Annotation buildAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildTypeAnnotation(this, this.annotatedElement, annotationName);
- }
-
- @Override
- Annotation buildNullAnnotation(String annotationName) {
- return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName);
- }
-
- @Override
- public void resolveTypes(CompilationUnit astRoot) {
- super.resolveTypes(astRoot);
-
- this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(this.annotatedElement.getBinding(astRoot)));
-
- for (JavaResourcePersistentAttribute field : this.getFields()) {
- field.resolveTypes(astRoot);
- }
-
- // a new type can trigger a method parameter type to be a resolved,
- // fully-qualified name, so we need to rebuild our list of methods:
- // "setFoo(Foo)" is not the same as "setFoo(com.bar.Foo)"
- // and, vice-versa, a removed type can "unresolve" a parameter type
- this.syncMethods(astRoot);
-
- for (JavaResourcePersistentAttribute method : this.getMethods()) {
- method.resolveTypes(astRoot);
- }
- for (JavaResourcePersistentType type : this.getTypes()) {
- type.resolveTypes(astRoot);
- }
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ******** JavaResourcePersistentType implementation ********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- private void syncName(String astName) {
- String old = this.name;
- this.name = astName;
- this.firePropertyChanged(NAME_PROPERTY, old, astName);
- }
-
- private String buildName(ITypeBinding binding) {
- return (binding == null) ? null : binding.getName();
- }
-
- // ***** qualified name
- public String getQualifiedName() {
- return this.qualifiedName;
- }
-
- private void syncQualifiedName(String astQualifiedName) {
- String old = this.qualifiedName;
- this.qualifiedName = astQualifiedName;
- this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, astQualifiedName);
- }
-
- private String buildQualifiedName(ITypeBinding binding) {
- return (binding == null) ? null : binding.getQualifiedName();
- }
-
- // ***** package name
- public String getPackageName() {
- return this.packageName;
- }
-
- private void syncPackageName(String astPackageName) {
- String old = this.packageName;
- this.packageName = astPackageName;
- this.firePropertyChanged(PACKAGE_NAME_PROPERTY, old, astPackageName);
- }
-
- private String buildPackageName(ITypeBinding binding) {
- return (binding == null) ? null : binding.getPackage().getName();
- }
-
- // ***** superclass qualified name
- public String getSuperclassQualifiedName() {
- return this.superclassQualifiedName;
- }
-
- private void syncSuperclassQualifiedName(String astSuperclassQualifiedName) {
- String old = this.superclassQualifiedName;
- this.superclassQualifiedName = astSuperclassQualifiedName;
- this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, astSuperclassQualifiedName);
- }
-
- private String buildSuperclassQualifiedName(ITypeBinding binding) {
- if (binding == null) {
- return null;
- }
- ITypeBinding superclass = binding.getSuperclass();
- return (superclass == null) ? null : superclass.getTypeDeclaration().getQualifiedName();
- }
-
- // ***** package
- public boolean isIn(IPackageFragment packageFragment) {
- return StringTools.stringsAreEqual(packageFragment.getElementName(), this.packageName);
- }
-
- // ***** declaring type name
- public String getDeclaringTypeName() {
- return this.declaringTypeName;
- }
-
- private void syncDeclaringTypeName(String astDeclaringTypeName) {
- String old = this.declaringTypeName;
- this.declaringTypeName = astDeclaringTypeName;
- this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, astDeclaringTypeName);
- }
-
- private String buildDeclaringTypeName(ITypeBinding binding) {
- if (binding == null) {
- return null;
- }
- ITypeBinding declaringClass = binding.getDeclaringClass();
- return (declaringClass == null) ? null : declaringClass.getTypeDeclaration().getQualifiedName();
- }
-
- // ***** abstract
- public boolean isAbstract() {
- return this.abstract_;
- }
-
- private void syncAbstract(boolean astAbstract) {
- boolean old = this.abstract_;
- this.abstract_ = astAbstract;
- this.firePropertyChanged(ABSTRACT_PROPERTY, old, astAbstract);
- }
-
- private boolean buildAbstract(ITypeBinding binding) {
- return (binding == null) ? false : Modifier.isAbstract(binding.getModifiers());
- }
-
- // ***** static
- public boolean isStatic() {
- return this.static_;
- }
-
- private void syncStatic(boolean astStatic_) {
- boolean old = this.static_;
- this.static_ = astStatic_;
- this.firePropertyChanged(STATIC_PROPERTY, old, astStatic_);
- }
-
- private boolean buildStatic(ITypeBinding binding) {
- return (binding == null) ? false : Modifier.isStatic(binding.getModifiers());
- }
-
- // ***** member type
- public boolean isMemberType() {
- return this.memberType;
- }
-
- private void syncMemberType(boolean astMemberType) {
- boolean old = this.memberType;
- this.memberType = astMemberType;
- this.firePropertyChanged(MEMBER_TYPE_PROPERTY, old, astMemberType);
- }
-
- private boolean buildMemberType(ITypeBinding binding) {
- return (binding == null) ? false : binding.isMember();
- }
-
- // ***** no-arg constructor
- public boolean hasNoArgConstructor() {
- return this.hasNoArgConstructor;
- }
-
- private void syncHasNoArgConstructor(boolean astHasNoArgConstructor) {
- boolean old = this.hasNoArgConstructor;
- this.hasNoArgConstructor = astHasNoArgConstructor;
- this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, astHasNoArgConstructor);
- }
-
- private boolean buildHasNoArgConstructor(ITypeBinding binding) {
- return (binding == null) ? false : typeHasNoArgConstructor(binding);
- }
-
- protected static boolean typeHasNoArgConstructor(ITypeBinding binding) {
- return findNoArgConstructor(binding) != null;
- }
-
- protected static IMethodBinding findNoArgConstructor(ITypeBinding binding) {
- for (IMethodBinding method : binding.getDeclaredMethods()) {
- if (method.isConstructor()) {
- if (method.getParameterTypes().length == 0) {
- return method;
- }
- }
- }
- return null;
- }
-
- // ***** private no-arg constructor
- public boolean hasPrivateNoArgConstructor() {
- return this.hasPrivateNoArgConstructor;
- }
-
- private void syncHasPrivateNoArgConstructor(boolean astHasPrivateNoArgConstructor) {
- boolean old = this.hasPrivateNoArgConstructor;
- this.hasPrivateNoArgConstructor = astHasPrivateNoArgConstructor;
- this.firePropertyChanged(PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY, old, astHasPrivateNoArgConstructor);
- }
-
- private boolean buildHasPrivateNoArgConstructor(ITypeBinding binding) {
- return (binding == null) ? false : typeHasPrivateNoArgConstructor(binding);
- }
-
- protected static boolean typeHasPrivateNoArgConstructor(ITypeBinding binding) {
- IMethodBinding method = findNoArgConstructor(binding);
- return (method != null) && Modifier.isPrivate(method.getModifiers());
- }
-
-
- // ********** misc **********
-
- public boolean isMapped() {
- for (Annotation annotation : this.getAnnotations()) {
- if (this.annotationIsMappingAnnotation(annotation)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean annotationIsMappingAnnotation(Annotation annotation) {
- return CollectionTools.contains(this.mappingAnnotationNames(), annotation.getAnnotationName());
- }
-
- private Iterator<String> mappingAnnotationNames() {
- return this.getAnnotationProvider().typeMappingAnnotationNames();
- }
-
- /**
- * check only persistable attributes
- */
- public boolean hasAnyAnnotatedAttributes() {
- for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) {
- if (stream.next().isAnnotated()) {
- return true;
- }
- }
- return false;
- }
-
-
- // ********** types **********
-
- public Iterator<JavaResourcePersistentType> types() {
- return this.getTypes().iterator();
- }
-
- private Iterable<JavaResourcePersistentType> getTypes() {
- return new LiveCloneIterable<JavaResourcePersistentType>(this.types); // read-only
- }
-
- public Iterator<JavaResourcePersistentType> allTypes() {
- return new TreeIterator<JavaResourcePersistentType>(this) {
- @Override
- protected Iterator<? extends JavaResourcePersistentType> children(JavaResourcePersistentType type) {
- return type.types();
- }
- };
- }
-
- public Iterator<JavaResourcePersistentType> persistableTypes() {
- return this.persistableMembers(this.types());
- }
-
- private JavaResourcePersistentType getType(String typeName, int occurrence) {
- for (JavaResourcePersistentType type : this.getTypes()) {
- if (type.isFor(typeName, occurrence)) {
- return type;
- }
- }
- return null;
- }
-
- private void addType(JavaResourcePersistentType type) {
- this.addItemToCollection(type, this.types, TYPES_COLLECTION);
- }
-
- private void removeTypes(Collection<JavaResourcePersistentType> remove) {
- this.removeItemsFromCollection(remove, this.types, TYPES_COLLECTION);
- }
-
- private void initializeTypes(CompilationUnit astRoot) {
- TypeDeclaration[] typeDeclarations = this.annotatedElement.getTypes(astRoot);
- CounterMap counters = new CounterMap(typeDeclarations.length);
- for (TypeDeclaration td : typeDeclarations) {
- String tdName = td.getName().getFullyQualifiedName();
- int occurrence = counters.increment(tdName);
- this.types.add(this.buildType(td, occurrence, astRoot));
- }
- }
-
- private void syncTypes(CompilationUnit astRoot) {
- TypeDeclaration[] typeDeclarations = this.annotatedElement.getTypes(astRoot);
- CounterMap counters = new CounterMap(typeDeclarations.length);
- HashSet<JavaResourcePersistentType> typesToRemove = new HashSet<JavaResourcePersistentType>(this.types);
- for (TypeDeclaration typeDeclaration : typeDeclarations) {
- String tdName = typeDeclaration.getName().getFullyQualifiedName();
- int occurrence = counters.increment(tdName);
-
- JavaResourcePersistentType type = this.getType(tdName, occurrence);
- if (type == null) {
- this.addType(this.buildType(typeDeclaration, occurrence, astRoot));
- } else {
- typesToRemove.remove(type);
- type.synchronizeWith(astRoot);
- }
- }
- this.removeTypes(typesToRemove);
- }
-
- private JavaResourcePersistentType buildType(TypeDeclaration nestedTypeDeclaration, int occurrence, CompilationUnit astRoot) {
- return newInstance(this.getJavaResourceCompilationUnit(), this.annotatedElement, nestedTypeDeclaration, occurrence, astRoot);
- }
-
-
- // ********** fields **********
-
- public Iterator<JavaResourcePersistentAttribute> fields() {
- return this.getFields().iterator();
- }
-
- private Iterable<JavaResourcePersistentAttribute> getFields() {
- return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.fields);
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableFields() {
- return this.persistableMembers(this.fields());
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() {
- return new FilteringIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- FIELD_ACCESS_TYPE_FILTER
- );
- }
-
- private void addField(JavaResourcePersistentAttribute field) {
- this.addItemToCollection(field, this.fields, FIELDS_COLLECTION);
- }
-
- private JavaResourcePersistentAttribute getField(String fieldName, int occurrence) {
- for (JavaResourcePersistentAttribute field : this.getFields()) {
- if (field.isFor(fieldName, occurrence)) {
- return field;
- }
- }
- return null;
- }
-
- private void removeFields(Collection<JavaResourcePersistentAttribute> remove) {
- this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION);
- }
-
- private void initializeFields(CompilationUnit astRoot) {
- FieldDeclaration[] fieldDeclarations = this.annotatedElement.getFields(astRoot);
- CounterMap counters = new CounterMap(fieldDeclarations.length);
- for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
- for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
- String fieldName = fragment.getName().getFullyQualifiedName();
- int occurrence = counters.increment(fieldName);
- this.fields.add(this.buildField(fieldName, occurrence, astRoot));
- }
- }
- }
-
- private void syncFields(CompilationUnit astRoot) {
- FieldDeclaration[] fieldDeclarations = this.annotatedElement.getFields(astRoot);
- CounterMap counters = new CounterMap(fieldDeclarations.length);
- HashSet<JavaResourcePersistentAttribute> fieldsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.fields);
- for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
- for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
- String fieldName = fragment.getName().getFullyQualifiedName();
- int occurrence = counters.increment(fieldName);
-
- JavaResourcePersistentAttribute field = this.getField(fieldName, occurrence);
- if (field == null) {
- this.addField(this.buildField(fieldName, occurrence, astRoot));
- } else {
- fieldsToRemove.remove(field);
- field.synchronizeWith(astRoot);
- }
- }
- }
- this.removeFields(fieldsToRemove);
- }
-
- private JavaResourcePersistentAttribute buildField(String fieldName, int occurrence, CompilationUnit astRoot) {
- return SourcePersistentAttribute.newInstance(this, this.annotatedElement, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private static List<VariableDeclarationFragment> fragments(FieldDeclaration fd) {
- return fd.fragments();
- }
-
-
- // ********** methods **********
-
- public Iterator<JavaResourcePersistentAttribute> methods() {
- return this.getMethods().iterator();
- }
-
- private Iterable<JavaResourcePersistentAttribute> getMethods() {
- return new LiveCloneIterable<JavaResourcePersistentAttribute>(this.methods);
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableProperties() {
- return this.persistableMembers(this.methods());
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() {
- return new FilteringIterator<JavaResourcePersistentAttribute>(
- this.persistableProperties(),
- PROPERTY_ACCESS_TYPE_FILTER
- );
- }
-
- private JavaResourcePersistentAttribute getMethod(MethodSignature signature, int occurrence) {
- for (JavaResourcePersistentAttribute method : this.getMethods()) {
- if (method.isFor(signature, occurrence)) {
- return method;
- }
- }
- return null;
- }
-
- private void addMethod(JavaResourcePersistentAttribute method) {
- this.addItemToCollection(method, this.methods, METHODS_COLLECTION);
- }
-
- private void removeMethods(Collection<JavaResourcePersistentAttribute> remove) {
- this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION);
- }
-
- private void initializeMethods(CompilationUnit astRoot) {
- MethodDeclaration[] methodDeclarations = this.annotatedElement.getMethods(astRoot);
- CounterMap counters = new CounterMap(methodDeclarations.length);
- for (MethodDeclaration methodDeclaration : methodDeclarations) {
- MethodSignature signature = ASTTools.buildMethodSignature(methodDeclaration);
- int occurrence = counters.increment(signature);
- this.methods.add(this.buildMethod(signature, occurrence, astRoot));
- }
- }
-
- private void syncMethods(CompilationUnit astRoot) {
- MethodDeclaration[] methodDeclarations = this.annotatedElement.getMethods(astRoot);
- CounterMap counters = new CounterMap(methodDeclarations.length);
- HashSet<JavaResourcePersistentAttribute> methodsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.methods);
- for (MethodDeclaration methodDeclaration : methodDeclarations) {
- MethodSignature signature = ASTTools.buildMethodSignature(methodDeclaration);
- int occurrence = counters.increment(signature);
-
- JavaResourcePersistentAttribute method = this.getMethod(signature, occurrence);
- if (method == null) {
- this.addMethod(this.buildMethod(signature, occurrence, astRoot));
- } else {
- methodsToRemove.remove(method);
- method.synchronizeWith(astRoot);
- }
- }
- this.removeMethods(methodsToRemove);
- }
-
- private JavaResourcePersistentAttribute buildMethod(MethodSignature signature, int occurrence, CompilationUnit astRoot) {
- return SourcePersistentAttribute.newInstance(this, this.annotatedElement, signature, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
- }
-
-
- // ********** attributes **********
-
- @SuppressWarnings("unchecked")
- public Iterator<JavaResourcePersistentAttribute> persistableAttributes() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- this.persistableProperties()
- );
- }
-
- public Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess) {
- switch (specifiedAccess) {
- case FIELD :
- return this.persistableAttributesForFieldAccessType();
- case PROPERTY :
- return this.persistableAttributesForPropertyAccessType();
- default :
- throw new IllegalArgumentException("unknown access: " + specifiedAccess); //$NON-NLS-1$
- }
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<JavaResourcePersistentAttribute> persistableAttributesForFieldAccessType() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableFields(),
- this.persistablePropertiesWithSpecifiedPropertyAccess()
- );
- }
-
- @SuppressWarnings("unchecked")
- private Iterator<JavaResourcePersistentAttribute> persistableAttributesForPropertyAccessType() {
- return new CompositeIterator<JavaResourcePersistentAttribute>(
- this.persistableProperties(),
- this.persistableFieldsWithSpecifiedFieldAccess()
- );
- }
-
-
- // ********** metamodel **********
-
- // ***** StaticMetamodel
- private void setStaticMetamodelAnnotation(StaticMetamodelAnnotation staticMetamodelAnnotation) {
- StaticMetamodelAnnotation old = this.staticMetamodelAnnotation;
- this.staticMetamodelAnnotation = staticMetamodelAnnotation;
- this.firePropertyChanged(STATIC_METAMODEL_ANNOTATION_PROPERTY, old, this.staticMetamodelAnnotation);
- }
-
- private void addInitialStaticMetamodelAnnotation(CompilationUnit astRoot) {
- if (this.staticMetamodelAnnotation == null) { // ignore duplicates
- this.staticMetamodelAnnotation = this.buildStaticMetamodelAnnotation(astRoot);
- }
- }
-
- private StaticMetamodelAnnotation buildStaticMetamodelAnnotation(CompilationUnit astRoot) {
- StaticMetamodelAnnotation annotation = STATIC_METAMODEL_ANNOTATION_DEFINITION.buildAnnotation(this, this.annotatedElement);
- annotation.initialize(astRoot);
- return annotation;
- }
-
- private void syncStaticMetamodelAnnotation(CompilationUnit astRoot, ITypeBinding binding) {
- if (this.bindingContainsStaticMetamodelAnnotation(binding)) {
- if (this.staticMetamodelAnnotation != null) {
- this.staticMetamodelAnnotation.synchronizeWith(astRoot);
- } else {
- this.setStaticMetamodelAnnotation(this.buildStaticMetamodelAnnotation(astRoot));
- }
- } else {
- this.setStaticMetamodelAnnotation(null);
- }
- }
-
- private boolean bindingContainsStaticMetamodelAnnotation(ITypeBinding binding) {
- return this.bindingContainsAnnotation(binding, STATIC_METAMODEL_ANNOTATION_DEFINITION.getAnnotationName());
- }
-
- // ***** Generated
- public GeneratedAnnotation getGeneratedAnnotation() {
- return this.generatedAnnotation;
- }
-
- private void setGeneratedAnnotation(GeneratedAnnotation generatedAnnotation) {
- GeneratedAnnotation old = this.generatedAnnotation;
- this.generatedAnnotation = generatedAnnotation;
- this.firePropertyChanged(GENERATED_ANNOTATION_PROPERTY, old, this.generatedAnnotation);
- }
-
- private void addInitialGeneratedAnnotation(CompilationUnit astRoot) {
- if (this.generatedAnnotation == null) { // ignore duplicates
- this.generatedAnnotation = this.buildGeneratedAnnotation(astRoot);
- }
- }
-
- private GeneratedAnnotation buildGeneratedAnnotation(CompilationUnit astRoot) {
- GeneratedAnnotation annotation = GENERATED_ANNOTATION_DEFINITION.buildAnnotation(this, this.annotatedElement);
- annotation.initialize(astRoot);
- return annotation;
- }
-
- private void syncGeneratedAnnotation(CompilationUnit astRoot, ITypeBinding binding) {
- if (this.bindingContainsGeneratedAnnotation(binding)) {
- if (this.generatedAnnotation != null) {
- this.generatedAnnotation.synchronizeWith(astRoot);
- } else {
- this.setGeneratedAnnotation(this.buildGeneratedAnnotation(astRoot));
- }
- } else {
- this.setGeneratedAnnotation(null);
- }
- }
-
- private boolean bindingContainsGeneratedAnnotation(ITypeBinding binding) {
- return this.bindingContainsAnnotation(binding, GENERATED_ANNOTATION_DEFINITION.getAnnotationName());
- }
-
- private boolean bindingContainsAnnotation(ITypeBinding binding, String annotationName) {
- for (IAnnotationBinding annotationBinding : binding.getAnnotations()) {
- ITypeBinding annotationTypeBinding = annotationBinding.getAnnotationType();
- if ((annotationTypeBinding != null) && annotationTypeBinding.getQualifiedName().equals(annotationName)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * The type must be:<ul>
- * <li>in the specified source folder
- * <li>a top-level type
- * <li>annotated with <code>&#64;javax.annotation.Generated</code> with
- * the appropriate <code>value</code> and <code>date</code>
- * <li>either itself or one of its nested types annotated with
- * <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
- * </ul>
- */
- public boolean isGeneratedMetamodelTopLevelType(IPackageFragmentRoot sourceFolder) {
- if ( ! this.getSourceFolder().equals(sourceFolder)) {
- return false;
- }
- return this.isGeneratedMetamodelTopLevelType();
- }
-
- /**
- * The type must be:<ul>
- * <li>a top-level type
- * <li>annotated with <code>&#64;javax.annotation.Generated</code> with
- * the appropriate <code>value</code> and <code>date</code>
- * <li>either itself or one of its nested types annotated with
- * <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
- * </ul>
- */
- public boolean isGeneratedMetamodelTopLevelType() {
- if ( ! this.isGenerated()) {
- return false;
- }
- // if we get here we know we have a top-level type, since only top-level
- // types are annotated @Generated; now see if anything is a metamodel
- for (Iterator<JavaResourcePersistentType> stream = this.allTypes(); stream.hasNext(); ) {
- JavaResourcePersistentType2_0 type = (JavaResourcePersistentType2_0) stream.next();
- if (type.isMetamodel()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * The type must be annotated with
- * <code>&#64;javax.annotation.Generated</code> with the appropriate
- * <code>value</code> and <code>date</code>.
- */
- private boolean isGenerated() {
- if (this.generatedAnnotation == null) {
- return false;
- }
- if (this.generatedAnnotation.valuesSize() != 1) {
- return false;
- }
- if ( ! this.generatedAnnotation.getValue(0).equals(METAMODEL_GENERATED_ANNOTATION_VALUE)) {
- return false;
- }
- if (StringTools.stringIsEmpty(this.generatedAnnotation.getDate())) {
- return false;
- }
- return true;
- }
-
- /**
- * The type must be annotated with
- * <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>.
- */
- public boolean isMetamodel() {
- return this.staticMetamodelAnnotation != null;
- }
-
- private IPackageFragmentRoot getSourceFolder() {
- return (IPackageFragmentRoot) this.getJavaResourceCompilationUnit().getCompilationUnit().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
- }
-
-
- // ********** CounterMap **********
-
- private static class CounterMap {
- private final HashMap<Object, SimpleIntReference> counters;
-
- protected CounterMap(int initialCapacity) {
- super();
- this.counters = new HashMap<Object, SimpleIntReference>(initialCapacity);
- }
-
- /**
- * Return the incremented count for the specified object.
- */
- int increment(Object o) {
- SimpleIntReference counter = this.counters.get(o);
- if (counter == null) {
- counter = new SimpleIntReference();
- this.counters.put(o, counter);
- }
- counter.increment();
- return counter.getValue();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
index d1b38ac243..dab305c66b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,50 +9,78 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
/**
* <code>javax.persistence.PrimaryKeyJoinColumn</code>
*/
public final class SourcePrimaryKeyJoinColumnAnnotation
extends SourceNamedColumnAnnotation
- implements NestablePrimaryKeyJoinColumnAnnotation
+ implements PrimaryKeyJoinColumnAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.PRIMARY_KEY_JOIN_COLUMNS);
private DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
private AnnotationElementAdapter<String> referencedColumnNameAdapter;
private String referencedColumnName;
+ public static SourcePrimaryKeyJoinColumnAnnotation buildSourcePrimaryKeyJoinColumnAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element) {
+
+ return new SourcePrimaryKeyJoinColumnAnnotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
+ }
- public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
- this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
- this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
+ public static SourcePrimaryKeyJoinColumnAnnotation buildSourcePrimaryKeyJoinColumnAnnotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement element,
+ int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildPrimaryKeyJoinColumnDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildPrimaryKeyJoinColumnAnnotationAdapter(element, idaa);
+ return new SourcePrimaryKeyJoinColumnAnnotation(
+ parent,
+ element,
+ idaa,
+ iaa);
+ }
+
+ public static SourcePrimaryKeyJoinColumnAnnotation buildNestedSourcePrimaryKeyJoinColumnAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ return new SourcePrimaryKeyJoinColumnAnnotation(parent, element, idaa);
}
- public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa) {
- this(parent, member, daa, new ElementAnnotationAdapter(member, daa));
+ private SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
}
- public SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, idaa));
+ private SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
+ }
+
+ private SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
+ this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
+ this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
}
public String getAnnotationName() {
@@ -126,13 +154,6 @@ public final class SourcePrimaryKeyJoinColumnAnnotation
}
- // ********** NestableAnnotation implementation **********
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
-
// ********** misc **********
@Override
@@ -141,45 +162,19 @@ public final class SourcePrimaryKeyJoinColumnAnnotation
(this.referencedColumnName == null);
}
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
- this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(REFERENCED_COLUMN_NAME_PROPERTY, this.referencedColumnName);
- this.referencedColumnName = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setReferencedColumnName((String) map.get(REFERENCED_COLUMN_NAME_PROPERTY));
- }
-
-
// ********** static methods **********
- public static SourcePrimaryKeyJoinColumnAnnotation createPrimaryKeyJoinColumn(JavaResourceNode parent, Member member) {
- return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- static SourcePrimaryKeyJoinColumnAnnotation createNestedPrimaryKeyJoinColumn(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter pkJoinColumnsAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, pkJoinColumnsAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
- return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, idaa, annotationAdapter);
+ private static IndexedAnnotationAdapter buildPrimaryKeyJoinColumnAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
+ return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
}
- static NestablePrimaryKeyJoinColumnAnnotation createSecondaryTablePrimaryKeyJoinColumn(DeclarationAnnotationAdapter secondaryTableAdapter, JavaResourceNode parent, Member member, int index) {
- return new SourcePrimaryKeyJoinColumnAnnotation(parent, member, buildSecondaryTableAnnotationAdapter(secondaryTableAdapter, index));
+ private static IndexedDeclarationAnnotationAdapter buildPrimaryKeyJoinColumnDeclarationAnnotationAdapter(int index) {
+ IndexedDeclarationAnnotationAdapter idaa =
+ new CombinationIndexedDeclarationAnnotationAdapter(
+ DECLARATION_ANNOTATION_ADAPTER,
+ CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
+ index,
+ ANNOTATION_NAME);
+ return idaa;
}
-
- private static IndexedDeclarationAnnotationAdapter buildSecondaryTableAnnotationAdapter(DeclarationAnnotationAdapter secondaryTableAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(secondaryTableAdapter, JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS, index, ANNOTATION_NAME);
- }
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java
deleted file mode 100644
index fcc5e7f99a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-
-/**
- * <code>javax.persistence.PrimaryKeyJoinColumns</code>
- */
-public final class SourcePrimaryKeyJoinColumnsAnnotation
- extends SourceAnnotation<Member>
- implements PrimaryKeyJoinColumnsAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns = new Vector<NestablePrimaryKeyJoinColumnAnnotation>();
-
-
- public SourcePrimaryKeyJoinColumnsAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- AnnotationContainerTools.synchronize(this, astRoot);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.pkJoinColumns.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.pkJoinColumns);
- }
-
-
- // ********** AnnotationContainer Implementation **********
-
- public String getElementName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE;
- }
-
- public String getNestedAnnotationName() {
- return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- public int getNestedAnnotationsSize() {
- return this.pkJoinColumns.size();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.nestStandAloneAnnotation(standAloneAnnotation, this.pkJoinColumns.size());
- }
-
- private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
- standAloneAnnotation.convertToNested(this, this.daa, index);
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- this.pkJoinColumns.add(index, (NestablePrimaryKeyJoinColumnAnnotation) annotation);
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- this.pkJoinColumns.remove(0).convertToStandAlone();
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.pkJoinColumns.size());
- }
-
- private NestablePrimaryKeyJoinColumnAnnotation addNestedAnnotation(int index) {
- NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.buildPrimaryKeyJoinColumn(index);
- this.pkJoinColumns.add(index, pkJoinColumn);
- return pkJoinColumn;
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- int index = this.pkJoinColumns.size();
- NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.addNestedAnnotation(index);
- pkJoinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(PK_JOIN_COLUMNS_LIST, index, pkJoinColumn);
- }
-
- private NestablePrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumn(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourcePrimaryKeyJoinColumnAnnotation.createNestedPrimaryKeyJoinColumn(this.parent, this.annotatedElement, index, this.daa);
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.pkJoinColumns, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public NestablePrimaryKeyJoinColumnAnnotation removeNestedAnnotation(int index) {
- return this.pkJoinColumns.remove(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java
index a2c371ba93..ef31971e16 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java
@@ -9,27 +9,17 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
@@ -40,7 +30,7 @@ import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
* </ul>
*/
abstract class SourceQueryAnnotation
- extends SourceAnnotation<Type>
+ extends SourceAnnotation
implements QueryAnnotation
{
DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
@@ -53,12 +43,11 @@ abstract class SourceQueryAnnotation
String query;
TextRange queryTextRange;
- final Vector<NestableQueryHintAnnotation> hints = new Vector<NestableQueryHintAnnotation>();
- final HintsAnnotationContainer hintsContainer = new HintsAnnotationContainer();
+ final QueryHintsAnnotationContainer hintsContainer = new QueryHintsAnnotationContainer();
- SourceQueryAnnotation(JavaResourceNode parent, Type type,DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, type, daa, annotationAdapter);
+ SourceQueryAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
this.nameAdapter = this.buildNameAdapter();
this.queryDeclarationAdapter = this.buildQueryDeclarationAdapter();
@@ -70,7 +59,7 @@ abstract class SourceQueryAnnotation
this.nameTextRange = this.buildNameTextRange(astRoot);
this.query = this.buildQuery(astRoot);
this.queryTextRange = this.buildQueryTextRange(astRoot);
- AnnotationContainerTools.initialize(this.hintsContainer, astRoot);
+ this.hintsContainer.initialize(this.getAstAnnotation(astRoot));
}
public void synchronizeWith(CompilationUnit astRoot) {
@@ -78,7 +67,7 @@ abstract class SourceQueryAnnotation
this.nameTextRange = this.buildNameTextRange(astRoot);
this.syncQuery(this.buildQuery(astRoot));
this.queryTextRange = this.buildQueryTextRange(astRoot);
- AnnotationContainerTools.synchronize(this.hintsContainer, astRoot);
+ this.hintsContainer.synchronize(this.getAstAnnotation(astRoot));
}
@@ -165,91 +154,36 @@ abstract class SourceQueryAnnotation
abstract String getQueryElementName();
// ***** hints
- public ListIterator<QueryHintAnnotation> hints() {
- return new CloneListIterator<QueryHintAnnotation>(this.hints);
- }
-
- Iterable<NestableQueryHintAnnotation> getNestableHints() {
- return new LiveCloneIterable<NestableQueryHintAnnotation>(this.hints);
- }
-
- public int hintsSize() {
- return this.hints.size();
- }
-
- public NestableQueryHintAnnotation hintAt(int index) {
- return this.hints.get(index);
- }
-
- public int indexOfHint(QueryHintAnnotation hint) {
- return this.hints.indexOf(hint);
- }
-
- private NestableQueryHintAnnotation addHint() {
- return this.addHint(this.hints.size());
- }
-
- public NestableQueryHintAnnotation addHint(int index) {
- return (NestableQueryHintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.hintsContainer);
- }
- NestableQueryHintAnnotation addHint_() {
- return this.addHint_(this.hints.size());
+ public ListIterable<QueryHintAnnotation> getHints() {
+ return this.hintsContainer.getNestedAnnotations();
}
- private NestableQueryHintAnnotation addHint_(int index) {
- NestableQueryHintAnnotation hint = this.buildHint(index);
- this.hints.add(index, hint);
- return hint;
+ public int getHintsSize() {
+ return this.hintsContainer.getNestedAnnotationsSize();
}
- void syncAddHint(Annotation astAnnotation) {
- int index = this.hints.size();
- NestableQueryHintAnnotation hint = this.addHint_(index);
- hint.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(HINTS_LIST, index, hint);
+ public QueryHintAnnotation hintAt(int index) {
+ return this.hintsContainer.nestedAnnotationAt(index);
}
- abstract NestableQueryHintAnnotation buildHint(int index);
-
- void hintAdded(int index, NestableQueryHintAnnotation hint) {
- this.fireItemAdded(HINTS_LIST, index, hint);
+ public QueryHintAnnotation addHint(int index) {
+ return this.hintsContainer.addNestedAnnotation(index);
}
public void moveHint(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.hintsContainer);
- }
-
- NestableQueryHintAnnotation moveHint_(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.hints, targetIndex, sourceIndex).get(targetIndex);
+ this.hintsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
}
public void removeHint(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.hintsContainer);
+ this.hintsContainer.removeNestedAnnotation(index);
}
- NestableQueryHintAnnotation removeHint_(int index) {
- return this.hints.remove(index);
- }
-
- void syncRemoveHints(int index) {
- this.removeItemsFromList(index, this.hints, HINTS_LIST);
- }
+ abstract QueryHintAnnotation buildHint(int index);
abstract String getHintsElementName();
- // ********** NestableAnnotation implementation **********
-
- /**
- * convenience implementation of method from NestableAnnotation interface
- * for subclasses
- */
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
-
// ********** misc **********
@Override
@@ -257,49 +191,7 @@ abstract class SourceQueryAnnotation
return super.isUnset() &&
(this.name == null) &&
(this.query == null) &&
- this.hints.isEmpty();
- }
-
- @Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
- this.nameAdapter = this.buildNameAdapter();
- this.queryDeclarationAdapter = this.buildQueryDeclarationAdapter();
- this.queryAdapter = this.buildQueryAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
-
- map.put(NAME_PROPERTY, this.name);
- this.name = null;
- map.put(QUERY_PROPERTY, this.query);
- this.query = null;
-
- List<Map<String, Object>> hintsState = this.buildStateList(this.hints.size());
- for (NestableQueryHintAnnotation hint : this.getNestableHints()) {
- Map<String, Object> hintState = new HashMap<String, Object>();
- hint.storeOn(hintState);
- hintsState.add(hintState);
- }
- map.put(HINTS_LIST, hintsState);
- this.hints.clear();
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
-
- this.setName((String) map.get(NAME_PROPERTY));
- this.setQuery((String) map.get(QUERY_PROPERTY));
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> hintsState = (List<Map<String, Object>>) map.get(HINTS_LIST);
- for (Map<String, Object> hintState : hintsState) {
- this.addHint().restoreFrom(hintState);
- }
+ this.hintsContainer.isEmpty();
}
@Override
@@ -309,56 +201,27 @@ abstract class SourceQueryAnnotation
// ********** hint container **********
-
/**
- * adapt the AnnotationContainer interface to the override's join columns
+ * adapt the AnnotationContainer interface to the xml schema's xmlns
*/
- class HintsAnnotationContainer
- implements AnnotationContainer<NestableQueryHintAnnotation>
+ class QueryHintsAnnotationContainer
+ extends AnnotationContainer<QueryHintAnnotation>
{
- public Annotation getAstAnnotation(CompilationUnit astRoot) {
- return SourceQueryAnnotation.this.getAstAnnotation(astRoot);
+ @Override
+ protected String getAnnotationsPropertyName() {
+ return HINTS_LIST;
}
-
- public String getElementName() {
+ @Override
+ protected String getElementName() {
return SourceQueryAnnotation.this.getHintsElementName();
}
-
- public String getNestedAnnotationName() {
+ @Override
+ protected String getNestedAnnotationName() {
return QueryHintAnnotation.ANNOTATION_NAME;
}
-
- public Iterable<NestableQueryHintAnnotation> getNestedAnnotations() {
- return SourceQueryAnnotation.this.getNestableHints();
- }
-
- public int getNestedAnnotationsSize() {
- return SourceQueryAnnotation.this.hintsSize();
- }
-
- public NestableQueryHintAnnotation addNestedAnnotation() {
- return SourceQueryAnnotation.this.addHint_();
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- SourceQueryAnnotation.this.syncAddHint(astAnnotation);
- }
-
- public NestableQueryHintAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceQueryAnnotation.this.moveHint_(targetIndex, sourceIndex);
- }
-
- public NestableQueryHintAnnotation removeNestedAnnotation(int index) {
- return SourceQueryAnnotation.this.removeHint_(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- SourceQueryAnnotation.this.syncRemoveHints(index);
- }
-
@Override
- public String toString() {
- return StringTools.buildToStringFor(this);
+ protected QueryHintAnnotation buildNestedAnnotation(int index) {
+ return SourceQueryAnnotation.this.buildHint(index);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java
index 889dc7e230..c50228d409 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,27 +9,27 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.Map;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
/**
* <code>javax.persistence.QueryHint</code>
*/
public final class SourceQueryHintAnnotation
- extends SourceAnnotation<Type>
- implements NestableQueryHintAnnotation
+ extends SourceAnnotation
+ implements QueryHintAnnotation
{
private DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
private AnnotationElementAdapter<String> nameAdapter;
@@ -40,8 +40,24 @@ public final class SourceQueryHintAnnotation
private String value;
- public SourceQueryHintAnnotation(JavaResourceNode parent, Type type, IndexedDeclarationAnnotationAdapter idaa) {
- super(parent, type, idaa, new ElementIndexedAnnotationAdapter(type, idaa));
+ static SourceQueryHintAnnotation buildNamedQueryQueryHint(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter namedQueryAdapter, int index) {
+ return buildNestedSourceQueryHintAnnotation(parent, element, buildNamedQueryQueryHintAnnotationAdapter(namedQueryAdapter, index));
+ }
+
+ static SourceQueryHintAnnotation buildNamedNativeQueryQueryHint(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
+ return buildNestedSourceQueryHintAnnotation(parent, element, buildNamedNativeQueryQueryHintAnnotationAdapter(namedNativeQueryAdapter, index));
+ }
+
+ public static SourceQueryHintAnnotation buildNestedSourceQueryHintAnnotation(
+ JavaResourceNode parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter idaa) {
+
+ return new SourceQueryHintAnnotation(parent, element, idaa);
+ }
+
+ private SourceQueryHintAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
+ super(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
this.nameAdapter = this.buildNameAdapter();
this.valueDeclarationAdapter = this.buildValueDeclarationAdapter();
@@ -134,13 +150,6 @@ public final class SourceQueryHintAnnotation
}
- // ********** NestableAnnotation implementation **********
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
-
// ********** misc **********
@Override
@@ -151,50 +160,16 @@ public final class SourceQueryHintAnnotation
}
@Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.nameDeclarationAdapter = this.buildNameDeclarationAdapter();
- this.nameAdapter = this.buildNameAdapter();
- this.valueDeclarationAdapter = this.buildValueDeclarationAdapter();
- this.valueAdapter = this.buildValueAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
- map.put(NAME_PROPERTY, this.name);
- this.name = null;
- map.put(VALUE_PROPERTY, this.value);
- this.value = null;
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
- this.setName((String) map.get(NAME_PROPERTY));
- this.setValue((String) map.get(VALUE_PROPERTY));
- }
-
- @Override
public void toString(StringBuilder sb) {
sb.append(this.name);
}
// ********** static methods **********
-
- static SourceQueryHintAnnotation createNamedQueryQueryHint(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter namedQueryAdapter, int index) {
- return new SourceQueryHintAnnotation(parent, type, buildNamedQueryQueryHintAnnotationAdapter(namedQueryAdapter, index));
- }
-
private static IndexedDeclarationAnnotationAdapter buildNamedQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedQueryAdapter, int index) {
return new NestedIndexedDeclarationAnnotationAdapter(namedQueryAdapter, JPA.NAMED_QUERY__HINTS, index, ANNOTATION_NAME);
}
- static SourceQueryHintAnnotation createNamedNativeQueryQueryHint(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
- return new SourceQueryHintAnnotation(parent, type, buildNamedNativeQueryQueryHintAnnotationAdapter(namedNativeQueryAdapter, index));
- }
-
private static IndexedDeclarationAnnotationAdapter buildNamedNativeQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
return new NestedIndexedDeclarationAnnotationAdapter(namedNativeQueryAdapter, JPA.NAMED_NATIVE_QUERY__HINTS, index, ANNOTATION_NAME);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
index c782f30499..8f86b02edc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,15 +10,17 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumArrayDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
@@ -26,7 +28,6 @@ import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.CascadeType;
import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.ManyToMany
@@ -35,7 +36,7 @@ import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
* javax.persistence.OneToOne
*/
abstract class SourceRelationshipMappingAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements RelationshipMapping2_0Annotation
{
final DeclarationAnnotationElementAdapter<String> targetEntityDeclarationAdapter;
@@ -59,14 +60,14 @@ abstract class SourceRelationshipMappingAnnotation
private static final CascadeType[] EMPTY_CASCADE_TYPE_ARRAY = new CascadeType[0];
- SourceRelationshipMappingAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
- super(parent, attribute, daa);
+ SourceRelationshipMappingAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
+ super(parent, element, daa);
this.targetEntityDeclarationAdapter = this.getTargetEntityAdapter();
this.targetEntityAdapter = this.buildAnnotationElementAdapter(this.targetEntityDeclarationAdapter);
this.fetchDeclarationAdapter = this.getFetchAdapter();
this.fetchAdapter = this.buildAnnotationElementAdapter(this.fetchDeclarationAdapter);
this.cascadeDeclarationAdapter = this.getCascadeAdapter();
- this.cascadeAdapter = new AnnotatedElementAnnotationElementAdapter<String[]>(attribute, this.cascadeDeclarationAdapter);
+ this.cascadeAdapter = new AnnotatedElementAnnotationElementAdapter<String[]>(element, this.cascadeDeclarationAdapter);
}
protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
index c0652153ea..d6ee3c9b34 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,32 +9,20 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
@@ -43,16 +31,29 @@ import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
*/
public final class SourceSecondaryTableAnnotation
extends SourceBaseTableAnnotation
- implements NestableSecondaryTableAnnotation
+ implements SecondaryTableAnnotation
{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(SecondaryTableAnnotation.ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.SECONDARY_TABLES);
- private final Vector<NestablePrimaryKeyJoinColumnAnnotation> pkJoinColumns = new Vector<NestablePrimaryKeyJoinColumnAnnotation>();
private final PkJoinColumnsAnnotationContainer pkJoinColumnsContainer = new PkJoinColumnsAnnotationContainer();
+ public static SourceSecondaryTableAnnotation buildSourceSecondaryTableAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, int index) {
+ IndexedDeclarationAnnotationAdapter idaa = buildSecondaryTableDeclarationAnnotationAdapter(index);
+ IndexedAnnotationAdapter iaa = buildSecondaryTableAnnotationAdapter(element, idaa);
+ return new SourceSecondaryTableAnnotation(
+ parent,
+ element,
+ idaa,
+ iaa);
+ }
- public SourceSecondaryTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, member, daa, annotationAdapter);
+ private SourceSecondaryTableAnnotation(
+ JavaResourceAnnotatedElement parent,
+ AnnotatedElement element,
+ IndexedDeclarationAnnotationAdapter daa,
+ IndexedAnnotationAdapter annotationAdapter) {
+ super(parent, element, daa, annotationAdapter);
}
public String getAnnotationName() {
@@ -62,13 +63,13 @@ public final class SourceSecondaryTableAnnotation
@Override
public void initialize(CompilationUnit astRoot) {
super.initialize(astRoot);
- AnnotationContainerTools.initialize(this.pkJoinColumnsContainer, astRoot);
+ this.pkJoinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
}
@Override
public void synchronizeWith(CompilationUnit astRoot) {
super.synchronizeWith(astRoot);
- AnnotationContainerTools.synchronize(this.pkJoinColumnsContainer, astRoot);
+ this.pkJoinColumnsContainer.synchronize(this.getAstAnnotation(astRoot));
}
@@ -98,186 +99,87 @@ public final class SourceSecondaryTableAnnotation
// ************* SecondaryTableAnnotation implementation *******************
// ***** pk join columns
- public ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns() {
- return new CloneListIterator<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestablePkJoinColumns() {
- return new LiveCloneIterable<NestablePrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- public int pkJoinColumnsSize() {
- return this.pkJoinColumns.size();
- }
- public NestablePrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) {
- return this.pkJoinColumns.get(index);
+ public ListIterable<PrimaryKeyJoinColumnAnnotation> getPkJoinColumns() {
+ return this.pkJoinColumnsContainer.getNestedAnnotations();
}
- public int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation joinColumn) {
- return this.pkJoinColumns.indexOf(joinColumn);
+ public int getPkJoinColumnsSize() {
+ return this.pkJoinColumnsContainer.getNestedAnnotationsSize();
}
- private NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn() {
- return this.addPkJoinColumn(this.pkJoinColumns.size());
+ public PrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) {
+ return this.pkJoinColumnsContainer.nestedAnnotationAt(index);
}
- public NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
- return (NestablePrimaryKeyJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.pkJoinColumnsContainer);
+ public PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
+ return this.pkJoinColumnsContainer.addNestedAnnotation(index);
}
-
- NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn_() {
- return this.addPkJoinColumn_(this.pkJoinColumns.size());
+
+ private PrimaryKeyJoinColumnAnnotation buildPkJoinColumn(int index) {
+ return SourcePrimaryKeyJoinColumnAnnotation.buildNestedSourcePrimaryKeyJoinColumnAnnotation(
+ this, this.annotatedElement, this.buildPkJoinColumnIndexedDeclarationAnnotationAdapter(index));
}
-
- private NestablePrimaryKeyJoinColumnAnnotation addPkJoinColumn_(int index) {
- NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.buildPrimaryKeyJoinColumn(index);
- this.pkJoinColumns.add(index, pkJoinColumn);
- return pkJoinColumn;
- }
-
- void syncAddPkJoinColumn(Annotation astAnnotation) {
- int index = this.pkJoinColumns.size();
- NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn = this.addPkJoinColumn_(index);
- pkJoinColumn.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(PK_JOIN_COLUMNS_LIST, index, pkJoinColumn);
- }
-
- private NestablePrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumn(int index) {
- return SourcePrimaryKeyJoinColumnAnnotation.createSecondaryTablePrimaryKeyJoinColumn(this.daa, this, this.annotatedElement, index);
- }
-
- void pkJoinColumnAdded(int index, NestablePrimaryKeyJoinColumnAnnotation joinColumn) {
- this.fireItemAdded(PK_JOIN_COLUMNS_LIST, index, joinColumn);
+
+ private IndexedDeclarationAnnotationAdapter buildPkJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(
+ this.daa, JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS, index, JPA.PRIMARY_KEY_JOIN_COLUMN);
}
public void movePkJoinColumn(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.pkJoinColumnsContainer);
- }
-
- NestablePrimaryKeyJoinColumnAnnotation movePkJoinColumn_(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.pkJoinColumns, targetIndex, sourceIndex).get(targetIndex);
+ this.pkJoinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
}
public void removePkJoinColumn(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.pkJoinColumnsContainer);
- }
-
- NestablePrimaryKeyJoinColumnAnnotation removePkJoinColumn_(int index) {
- return this.pkJoinColumns.remove(index);
- }
-
- void syncRemovePkJoinColumns(int index) {
- this.removeItemsFromList(index, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
- }
-
-
- // ********** NestableAnnotation implementation **********
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.pkJoinColumns.isEmpty();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
-
- List<Map<String, Object>> pkJoinColumnsState = this.buildStateList(this.pkJoinColumns.size());
- for (NestablePrimaryKeyJoinColumnAnnotation pkJoinColumn : this.getNestablePkJoinColumns()) {
- Map<String, Object> pkJoinColumnState = new HashMap<String, Object>();
- pkJoinColumn.storeOn(pkJoinColumnState);
- pkJoinColumnsState.add(pkJoinColumnState);
- }
- map.put(PK_JOIN_COLUMNS_LIST, pkJoinColumnsState);
- this.pkJoinColumns.clear();
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> pkJoinColumnsState = (List<Map<String, Object>>) map.get(PK_JOIN_COLUMNS_LIST);
- for (Map<String, Object> pkJoinColumnState : pkJoinColumnsState) {
- this.addPkJoinColumn().restoreFrom(pkJoinColumnState);
- }
- }
-
-
- // ********** static methods **********
-
- public static SourceSecondaryTableAnnotation createSecondaryTable(JavaResourceNode parent, Member member) {
- return new SourceSecondaryTableAnnotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ this.pkJoinColumnsContainer.removeNestedAnnotation(index);
}
-
- static SourceSecondaryTableAnnotation createNestedSecondaryTable(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter secondaryTablesAdapter) {
- IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, secondaryTablesAdapter, ANNOTATION_NAME);
- IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa);
- return new SourceSecondaryTableAnnotation(parent, member, idaa, annotationAdapter);
- }
-
-
- // ********** pk join column container **********
-
+
/**
- * adapt the AnnotationContainer interface to the secondary table's
- * primary key join columns
+ * adapt the AnnotationContainer interface to the collection table's join columns
*/
- class PkJoinColumnsAnnotationContainer
- implements AnnotationContainer<NestablePrimaryKeyJoinColumnAnnotation>
+ class PkJoinColumnsAnnotationContainer
+ extends AnnotationContainer<PrimaryKeyJoinColumnAnnotation>
{
- public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
- return SourceSecondaryTableAnnotation.this.getAstAnnotation(astRoot);
+ @Override
+ protected String getAnnotationsPropertyName() {
+ return PK_JOIN_COLUMNS_LIST;
}
-
- public String getElementName() {
+ @Override
+ protected String getElementName() {
return JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS;
}
-
- public String getNestedAnnotationName() {
- return PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestablePrimaryKeyJoinColumnAnnotation> getNestedAnnotations() {
- return SourceSecondaryTableAnnotation.this.getNestablePkJoinColumns();
+ @Override
+ protected String getNestedAnnotationName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN;
}
-
- public int getNestedAnnotationsSize() {
- return SourceSecondaryTableAnnotation.this.pkJoinColumnsSize();
+ @Override
+ protected PrimaryKeyJoinColumnAnnotation buildNestedAnnotation(int index) {
+ return SourceSecondaryTableAnnotation.this.buildPkJoinColumn(index);
}
+ }
- public NestablePrimaryKeyJoinColumnAnnotation addNestedAnnotation() {
- return SourceSecondaryTableAnnotation.this.addPkJoinColumn_();
- }
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- SourceSecondaryTableAnnotation.this.syncAddPkJoinColumn(astAnnotation);
- }
+ // ********** misc **********
- public NestablePrimaryKeyJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceSecondaryTableAnnotation.this.movePkJoinColumn_(targetIndex, sourceIndex);
- }
+ @Override
+ public boolean isUnset() {
+ return super.isUnset() &&
+ this.pkJoinColumnsContainer.isEmpty();
+ }
- public NestablePrimaryKeyJoinColumnAnnotation removeNestedAnnotation(int index) {
- return SourceSecondaryTableAnnotation.this.removePkJoinColumn_(index);
- }
+ // ********** static methods **********
- public void syncRemoveNestedAnnotations(int index) {
- SourceSecondaryTableAnnotation.this.syncRemovePkJoinColumns(index);
- }
+ private static IndexedAnnotationAdapter buildSecondaryTableAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
+ return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
+ }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
+ private static IndexedDeclarationAnnotationAdapter buildSecondaryTableDeclarationAnnotationAdapter(int index) {
+ IndexedDeclarationAnnotationAdapter idaa =
+ new CombinationIndexedDeclarationAnnotationAdapter(
+ DECLARATION_ANNOTATION_ADAPTER,
+ CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
+ index,
+ ANNOTATION_NAME);
+ return idaa;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java
deleted file mode 100644
index 151f2df51f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
-
-/**
- * <code>javax.persistence.SecondaryTables</code>
- */
-public final class SourceSecondaryTablesAnnotation
- extends SourceAnnotation<Member>
- implements SecondaryTablesAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private final Vector<NestableSecondaryTableAnnotation> secondaryTables = new Vector<NestableSecondaryTableAnnotation>();
-
-
- public SourceSecondaryTablesAnnotation(JavaResourcePersistentType parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- AnnotationContainerTools.initialize(this, astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- AnnotationContainerTools.synchronize(this, astRoot);
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.secondaryTables.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.secondaryTables);
- }
-
-
- // ********** AnnotationContainer implementation **********
-
- public String getElementName() {
- return JPA.SECONDARY_TABLES__VALUE;
- }
-
- public String getNestedAnnotationName() {
- return SecondaryTableAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<NestableSecondaryTableAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableSecondaryTableAnnotation>(this.secondaryTables);
- }
-
- public int getNestedAnnotationsSize() {
- return this.secondaryTables.size();
- }
-
- public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) {
- this.nestStandAloneAnnotation(standAloneAnnotation, this.secondaryTables.size());
- }
-
- private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) {
- standAloneAnnotation.convertToNested(this, this.daa, index);
- }
-
- public void addNestedAnnotation(int index, NestableAnnotation annotation) {
- this.secondaryTables.add(index, (NestableSecondaryTableAnnotation) annotation);
- }
-
- public void convertLastNestedAnnotationToStandAlone() {
- this.secondaryTables.remove(0).convertToStandAlone();
- }
-
- public NestableSecondaryTableAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.secondaryTables.size());
- }
-
- private NestableSecondaryTableAnnotation addNestedAnnotation(int index) {
- NestableSecondaryTableAnnotation secondaryTable = this.buildSecondaryTable(index);
- this.secondaryTables.add(index, secondaryTable);
- return secondaryTable;
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- int index = this.secondaryTables.size();
- NestableSecondaryTableAnnotation secondaryTable = this.addNestedAnnotation(index);
- secondaryTable.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(SECONDARY_TABLES_LIST, index, secondaryTable);
- }
-
- private NestableSecondaryTableAnnotation buildSecondaryTable(int index) {
- // pass the Java resource persistent member as the nested annotation's parent
- // since the nested annotation can be converted to stand-alone
- return SourceSecondaryTableAnnotation.createNestedSecondaryTable(this.parent, this.annotatedElement, index, this.daa);
- }
-
- public NestableSecondaryTableAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.secondaryTables, targetIndex, sourceIndex).get(targetIndex);
- }
-
- public NestableSecondaryTableAnnotation removeNestedAnnotation(int index) {
- return this.secondaryTables.remove(index);
- }
-
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.secondaryTables, SECONDARY_TABLES_LIST);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
index 12d42800fb..b8027374fc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,13 +11,13 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
/**
@@ -40,8 +40,8 @@ public abstract class SourceSequenceGeneratorAnnotation
private String sequenceName;
- protected SourceSequenceGeneratorAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ protected SourceSequenceGeneratorAnnotation(JavaResourceNode parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.sequenceNameAdapter = this.buildAdapter(SEQUENCE_NAME_ADAPTER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java
index 6edc847a72..152305ae11 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,11 +11,11 @@ package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
/**
@@ -34,8 +34,8 @@ public final class SourceTableAnnotation
private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__CATALOG);
- public SourceTableAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceTableAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
index 9b5d0ade9b..2646ca81c0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,27 +9,18 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableUniqueConstraintAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
@@ -72,12 +63,11 @@ public final class SourceTableGeneratorAnnotation
private final AnnotationElementAdapter<String> pkColumnValueAdapter;
private String pkColumnValue;
- private final Vector<NestableUniqueConstraintAnnotation> uniqueConstraints = new Vector<NestableUniqueConstraintAnnotation>();
private final UniqueConstraintsAnnotationContainer uniqueConstraintsContainer = new UniqueConstraintsAnnotationContainer();
- public SourceTableGeneratorAnnotation(JavaResourceNode parent, Member member) {
- super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceTableGeneratorAnnotation(JavaResourceNode parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
this.tableAdapter = this.buildAdapter(TABLE_ADAPTER);
this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER);
this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER);
@@ -99,7 +89,7 @@ public final class SourceTableGeneratorAnnotation
this.pkColumnName = this.buildPkColumnName(astRoot);
this.valueColumnName = this.buildValueColumnName(astRoot);
this.pkColumnValue = this.buildPkColumnValue(astRoot);
- AnnotationContainerTools.initialize(this.uniqueConstraintsContainer, astRoot);
+ this.uniqueConstraintsContainer.initialize(this.getAstAnnotation(astRoot));
}
@Override
@@ -111,7 +101,7 @@ public final class SourceTableGeneratorAnnotation
this.syncPkColumnName(this.buildPkColumnName(astRoot));
this.syncValueColumnName(this.buildValueColumnName(astRoot));
this.syncPkColumnValue(this.buildPkColumnValue(astRoot));
- AnnotationContainerTools.synchronize(this.uniqueConstraintsContainer, astRoot);
+ this.uniqueConstraintsContainer.synchronize(this.getAstAnnotation(astRoot));
}
@Override
@@ -327,144 +317,76 @@ public final class SourceTableGeneratorAnnotation
}
// ***** unique constraints
- public ListIterator<UniqueConstraintAnnotation> uniqueConstraints() {
- return new CloneListIterator<UniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- Iterable<NestableUniqueConstraintAnnotation> getNestableUniqueConstraints() {
- return new LiveCloneIterable<NestableUniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- public int uniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public NestableUniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraints.get(index);
- }
-
- public int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint) {
- return this.uniqueConstraints.indexOf(uniqueConstraint);
- }
- public NestableUniqueConstraintAnnotation addUniqueConstraint(int index) {
- return (NestableUniqueConstraintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.uniqueConstraintsContainer);
+ public ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
+ return this.uniqueConstraintsContainer.getNestedAnnotations();
}
- NestableUniqueConstraintAnnotation addUniqueConstraint_() {
- return this.addUniqueConstraint_(this.uniqueConstraints.size());
+ public int getUniqueConstraintsSize() {
+ return this.uniqueConstraintsContainer.getNestedAnnotationsSize();
}
- private NestableUniqueConstraintAnnotation addUniqueConstraint_(int index) {
- NestableUniqueConstraintAnnotation uniqueConstraint = this.buildUniqueConstraint(index);
- this.uniqueConstraints.add(index, uniqueConstraint);
- return uniqueConstraint;
+ public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
+ return this.uniqueConstraintsContainer.nestedAnnotationAt(index);
}
- void syncAddUniqueConstraint(Annotation astAnnotation) {
- int index = this.uniqueConstraints.size();
- NestableUniqueConstraintAnnotation uniqueConstraint = this.addUniqueConstraint_(index);
- uniqueConstraint.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
+ public UniqueConstraintAnnotation addUniqueConstraint(int index) {
+ return this.uniqueConstraintsContainer.addNestedAnnotation(index);
}
- NestableUniqueConstraintAnnotation buildUniqueConstraint(int index) {
- return new SourceUniqueConstraintAnnotation(this, this.annotatedElement, buildUniqueConstraintAnnotationAdapter(index));
+ private UniqueConstraintAnnotation buildUniqueConstraint(int index) {
+ return new SourceUniqueConstraintAnnotation(
+ this, this.annotatedElement, buildUniqueConstraintIndexedDeclarationAnnotationAdapter(index));
}
- IndexedDeclarationAnnotationAdapter buildUniqueConstraintAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
- }
-
- void uniqueConstraintAdded(int index, NestableUniqueConstraintAnnotation constraint) {
- this.fireItemAdded(UNIQUE_CONSTRAINTS_LIST, index, constraint);
+ private IndexedDeclarationAnnotationAdapter buildUniqueConstraintIndexedDeclarationAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(
+ this.daa, JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
}
public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation moveUniqueConstraint_(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex).get(targetIndex);
+ this.uniqueConstraintsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
}
public void removeUniqueConstraint(int index) {
- AnnotationContainerTools.removeNestedAnnotation(index, this.uniqueConstraintsContainer);
- }
-
- NestableUniqueConstraintAnnotation removeUniqueConstraint_(int index) {
- return this.uniqueConstraints.remove(index);
- }
-
- void syncRemoveUniqueConstraints(int index) {
- this.removeItemsFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
- return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
- private static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(String elementName) {
- return buildIntegerAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ this.uniqueConstraintsContainer.removeNestedAnnotation(index);
}
-
-
- // ********** unique constraint container **********
+
/**
- * adapt the AnnotationContainer interface to the table generator's unique constraints
+ * adapt the AnnotationContainer interface to the table's unique constraints
*/
- class UniqueConstraintsAnnotationContainer
- implements AnnotationContainer<NestableUniqueConstraintAnnotation>
+ class UniqueConstraintsAnnotationContainer
+ extends AnnotationContainer<UniqueConstraintAnnotation>
{
- public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
- return SourceTableGeneratorAnnotation.this.getAstAnnotation(astRoot);
+ @Override
+ protected String getAnnotationsPropertyName() {
+ return UNIQUE_CONSTRAINTS_LIST;
}
-
- public String getElementName() {
+ @Override
+ protected String getElementName() {
return JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS;
}
-
- public String getNestedAnnotationName() {
+ @Override
+ protected String getNestedAnnotationName() {
return UniqueConstraintAnnotation.ANNOTATION_NAME;
}
-
- public Iterable<NestableUniqueConstraintAnnotation> getNestedAnnotations() {
- return SourceTableGeneratorAnnotation.this.getNestableUniqueConstraints();
- }
-
- public int getNestedAnnotationsSize() {
- return SourceTableGeneratorAnnotation.this.uniqueConstraintsSize();
- }
-
- public NestableUniqueConstraintAnnotation addNestedAnnotation() {
- return SourceTableGeneratorAnnotation.this.addUniqueConstraint_();
- }
-
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- SourceTableGeneratorAnnotation.this.syncAddUniqueConstraint(astAnnotation);
+ @Override
+ protected UniqueConstraintAnnotation buildNestedAnnotation(int index) {
+ return SourceTableGeneratorAnnotation.this.buildUniqueConstraint(index);
}
+ }
- public NestableUniqueConstraintAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceTableGeneratorAnnotation.this.moveUniqueConstraint_(targetIndex, sourceIndex);
- }
- public NestableUniqueConstraintAnnotation removeNestedAnnotation(int index) {
- return SourceTableGeneratorAnnotation.this.removeUniqueConstraint_(index);
- }
- public void syncRemoveNestedAnnotations(int index) {
- SourceTableGeneratorAnnotation.this.syncRemoveUniqueConstraints(index);
- }
+ // ********** static methods **********
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
+ private static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
+ return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+ private static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(String elementName) {
+ return buildIntegerAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java
index 61d6c20b08..46f411695f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,10 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* javax.persistence.Temporal
@@ -24,8 +24,8 @@ public final class SourceTemporalAnnotation
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceTemporalAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceTemporalAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java
index eace57de22..e74b9b1373 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
/**
* javax.persistence.Transient
*/
public final class SourceTransientAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements TransientAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceTransientAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceTransientAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java
deleted file mode 100644
index 7a4ab83de4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.common.utility.CommandExecutor;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * Java compilation unit (source file)
- * non package-info.java file
- */
-public final class SourceTypeCompilationUnit
- extends SourceCompilationUnit
-{
-
- /**
- * The primary type of the AST compilation unit. We are not going to handle
- * multiple types defined in a single compilation unit. Entities must have
- * a public/protected no-arg constructor, and there is no way to access
- * the constructor in a package class (which is what all top-level,
- * non-primary classes must be).
- */
- private JavaResourcePersistentType persistentType;
-
-
- // ********** construction **********
-
- public SourceTypeCompilationUnit(
- ICompilationUnit compilationUnit,
- JpaAnnotationProvider annotationProvider,
- AnnotationEditFormatter annotationEditFormatter,
- CommandExecutor modifySharedDocumentCommandExecutor) {
- super(compilationUnit, annotationProvider, annotationEditFormatter, modifySharedDocumentCommandExecutor); // the JPA compilation unit is the root of its sub-tree
- this.persistentType = this.buildPersistentType();
- }
-
- private JavaResourcePersistentType buildPersistentType() {
- this.openCompilationUnit();
- CompilationUnit astRoot = this.buildASTRoot();
- this.closeCompilationUnit();
- return this.buildPersistentType(astRoot);
- }
-
-
- // ********** JavaResourceNode implementation **********
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncPersistentType(astRoot);
- }
-
-
- // ********** JavaResourceNode.Root implementation **********
-
- /**
- * NB: return *all* the persistent types since we build them all
- */
- public Iterator<JavaResourcePersistentType> persistentTypes() {
- return (this.persistentType == null) ?
- EmptyIterator.<JavaResourcePersistentType>instance() :
- this.persistentType.allTypes();
- }
-
-
- // ********** JptResourceModel implementation **********
-
- public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
-
-
- // ********** JavaResourceCompilationUnit implementation **********
-
- public void resolveTypes() {
- if (this.persistentType != null) {
- this.persistentType.resolveTypes(this.buildASTRoot());
- }
- }
-
-
- // ********** persistent type **********
-
- private JavaResourcePersistentType buildPersistentType(CompilationUnit astRoot) {
- TypeDeclaration td = this.getPrimaryTypeDeclaration(astRoot);
- return (td == null) ? null : this.buildPersistentType(astRoot, td);
- }
-
-
- private void syncPersistentType(CompilationUnit astRoot) {
- TypeDeclaration td = this.getPrimaryTypeDeclaration(astRoot);
- if (td == null) {
- this.syncPersistentType_(null);
- } else {
- if (this.persistentType == null) {
- this.syncPersistentType_(this.buildPersistentType(astRoot, td));
- } else {
- this.persistentType.synchronizeWith(astRoot);
- }
- }
- }
-
- private void syncPersistentType_(JavaResourcePersistentType astPersistentType) {
- JavaResourcePersistentType old = this.persistentType;
- this.persistentType = astPersistentType;
- this.firePropertyChanged(PERSISTENT_TYPES_COLLECTION, old, astPersistentType);
- }
-
-
- // ********** internal **********
-
- private JavaResourcePersistentType buildPersistentType(CompilationUnit astRoot, TypeDeclaration typeDeclaration) {
- return SourcePersistentType.newInstance(this, typeDeclaration, astRoot);
- }
-
- /**
- * i.e. the type with the same name as the compilation unit;
- * return the first class or interface (ignore annotations and enums) with
- * the same name as the compilation unit (file);
- * NB: this type could be in error if there is an annotation or enum
- * with the same name preceding it in the compilation unit
- *
- * Return null if the parser did not resolve the type declaration's binding.
- * This can occur if the project JRE is removed (bug 225332).
- */
- private TypeDeclaration getPrimaryTypeDeclaration(CompilationUnit astRoot) {
- String primaryTypeName = this.getPrimaryTypeName();
- for (AbstractTypeDeclaration atd : this.types(astRoot)) {
- if (this.nodeIsPrimaryTypeDeclaration(atd, primaryTypeName)) {
- return (atd.resolveBinding() == null) ? null : (TypeDeclaration) atd;
- }
- }
- return null;
- }
-
- private boolean nodeIsPrimaryTypeDeclaration(AbstractTypeDeclaration atd, String primaryTypeName) {
- return (atd.getNodeType() == ASTNode.TYPE_DECLARATION) &&
- atd.getName().getFullyQualifiedName().equals(primaryTypeName);
- }
-
- private String getPrimaryTypeName() {
- return this.getCompilationUnitName();
- }
-
- // minimize scope of suppressed warnings
- @SuppressWarnings("unchecked")
- private List<AbstractTypeDeclaration> types(CompilationUnit astRoot) {
- return astRoot.types();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
index ba3ff98598..9a61393c55 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,44 +9,41 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.NestableUniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
/**
* <code>javax.persistence.UniqueConstraint</code>
*/
public final class SourceUniqueConstraintAnnotation
- extends SourceAnnotation<Member>
- implements NestableUniqueConstraintAnnotation
+ extends SourceAnnotation
+ implements UniqueConstraintAnnotation
{
private DeclarationAnnotationElementAdapter<String[]> columnNamesDeclarationAdapter;
private AnnotationElementAdapter<String[]> columnNamesAdapter;
private final Vector<String> columnNames = new Vector<String>();
- public SourceUniqueConstraintAnnotation(JavaResourceNode parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super(parent, member, idaa, new ElementIndexedAnnotationAdapter(member, idaa));
+ public SourceUniqueConstraintAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
+ super(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
this.columnNamesDeclarationAdapter = buildColumnNamesDeclarationAdapter();
this.columnNamesAdapter = buildColumnNamesAdapter();
}
@@ -67,16 +64,16 @@ public final class SourceUniqueConstraintAnnotation
// ********** UniqueConstraintAnnotation implementation **********
// ***** column names
- public ListIterator<String> columnNames() {
- return new CloneListIterator<String>(this.columnNames);
+ public ListIterable<String> getColumnNames() {
+ return new LiveCloneListIterable<String>(this.columnNames);
}
- private Iterable<String> getColumnNames() {
- return new LiveCloneIterable<String>(this.columnNames);
+ public int getColumnNamesSize() {
+ return this.columnNames.size();
}
- public int columnNamesSize() {
- return this.columnNames.size();
+ public String columnNameAt(int index) {
+ return this.columnNames.elementAt(index);
}
public void addColumnName(String columnName) {
@@ -144,13 +141,6 @@ public final class SourceUniqueConstraintAnnotation
}
- // ********** NestableAnnotation implementation **********
-
- public void moveAnnotation(int newIndex) {
- this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
- }
-
-
// ********** misc **********
@Override
@@ -160,36 +150,6 @@ public final class SourceUniqueConstraintAnnotation
}
@Override
- protected void rebuildAdapters() {
- super.rebuildAdapters();
- this.columnNamesDeclarationAdapter = buildColumnNamesDeclarationAdapter();
- this.columnNamesAdapter = buildColumnNamesAdapter();
- }
-
- @Override
- public void storeOn(Map<String, Object> map) {
- super.storeOn(map);
-
- List<String> columnNamesState = new ArrayList<String>(this.columnNames.size());
- for (String columnName : this.getColumnNames()) {
- columnNamesState.add(columnName);
- }
- map.put(COLUMN_NAMES_LIST, columnNamesState);
- this.columnNames.clear();
- }
-
- @Override
- public void restoreFrom(Map<String, Object> map) {
- super.restoreFrom(map);
-
- @SuppressWarnings("unchecked")
- List<String> columnNamesState = (List<String>) map.get(COLUMN_NAMES_LIST);
- for (String columnName : columnNamesState) {
- this.addColumnName(columnName);
- }
- }
-
- @Override
public void toString(StringBuilder sb) {
sb.append(this.columnNames);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java
index b62fbd15a3..39a538dab9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,24 +10,25 @@
package org.eclipse.jpt.jpa.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
/**
* javax.persistence.Version
*/
public final class SourceVersionAnnotation
- extends SourceAnnotation<Attribute>
+ extends SourceAnnotation
implements VersionAnnotation
{
private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public SourceVersionAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute) {
- super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ public SourceVersionAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
+ super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
}
public String getAnnotationName() {
@@ -41,5 +42,4 @@ public final class SourceVersionAnnotation
public void synchronizeWith(CompilationUnit astRoot) {
// nothing to update
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java
index a15741ea02..cbc3693446 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -132,11 +132,11 @@ public class SynchronizeClassesJob extends WorkspaceJob
if (persistence == null) {
return false;
}
- if (persistence.persistenceUnitsSize() == 0) {
+ if (persistence.getPersistenceUnitsSize() == 0) {
return false;
}
- PersistenceUnit persistenceUnit = persistence.persistenceUnits().next();
- for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) {
+ PersistenceUnit persistenceUnit = persistence.getPersistenceUnits().iterator().next();
+ for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFileRefs()) {
if (mappingFileRef.getPersistentType(fullyQualifiedTypeName) != null) {
return true;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java
index e71255c5ca..3ae7907e20 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java
@@ -99,6 +99,7 @@ public interface JpaValidationMessages {
public static final String PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE = "PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE";
public static final String PERSISTENT_ATTRIBUTE_FINAL_FIELD = "PERSISTENT_ATTRIBUTE_FINAL_FIELD";
public static final String PERSISTENT_ATTRIBUTE_FINAL_GETTER = "PERSISTENT_ATTRIBUTE_FINAL_GETTER";
+ public static final String PERSISTENT_ATTRIBUTE_FINAL_SETTER = "PERSISTENT_ATTRIBUTE_FINAL_SETTER";
public static final String PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED = "PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED";
public static final String PERSISTENT_ATTRIBUTE_INVALID_MAPPING = "PERSISTENT_ATTRIBUTE_INVALID_MAPPING";
public static final String PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE = "PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE";
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java
index 60d4e079db..f219e437ec 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,8 +11,8 @@ package org.eclipse.jpt.jpa.core.jpa2;
import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0;
/**
* JPA 2.0 project.
@@ -63,11 +63,11 @@ public interface JpaProject2_0
Iterable<String> getJavaSourceFolderNames();
/**
- * Return the JPA project's generated metamodel Java resource persistent
+ * Return the JPA project's generated metamodel Java resource
* top-level types.
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePersistentType#isGeneratedMetamodel(IPackageFragmentRoot)
+ * @see org.eclipse.jpt.jpa.core.jpa2.MetamodelSychronizer.Tools.isGeneratedMetamodelTopLevelType(JavaResourceAbstractType, IPackageFragmentRoot)
*/
- Iterable<JavaResourcePersistentType2_0> getGeneratedMetamodelTopLevelTypes();
+ Iterable<JavaResourceAbstractType> getGeneratedMetamodelTopLevelTypes();
/**
* Return the top-level generated metamodel Java resource persistent type
@@ -80,7 +80,7 @@ public interface JpaProject2_0
* <code>javax.persistence.metamodel.StaticMetamodel</code> annotation
* <ul>
*/
- JavaResourcePersistentType2_0 getGeneratedMetamodelTopLevelType(IFile file);
+ JavaResourceAbstractType getGeneratedMetamodelTopLevelType(IFile file);
// ********** construction config **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java
index 984d548f6d..fb2518f03f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,11 @@
package org.eclipse.jpt.jpa.core.jpa2;
import java.io.Serializable;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
/**
* JPA 2.0 Canonical Metamodel synchronizer.
@@ -25,7 +30,7 @@ import java.io.Serializable;
* <code>javax.persistence.metamodel.StaticMetamodel</code>
* and <code>javax.annotation.Generated</code>
* will be added to the Canonical Metamodel
- * (see {@link org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePersistentType#isGeneratedMetamodel()}).
+ * (see {@link MetamodelTools#isGeneratedMetamodelTopLevelType(JavaResourceAbstractType, IPackageFragmentRoot)}).
* Once the JPA project's context model is constructed, a new Canonical
* Metamodel is generated and merged with the classes already present in the
* metamodel source folder.
@@ -50,6 +55,14 @@ import java.io.Serializable;
*/
public interface MetamodelSynchronizer {
+ /**
+ * The value used to tag a generated type:
+ * <pre>
+ * &#64;javax.annotation.Generated(value="Dali", date="2009-11-23T13:56:06.171-0500")
+ * </pre>
+ */
+ String METAMODEL_GENERATED_ANNOTATION_VALUE = "Dali"; //$NON-NLS-1$
+
void initializeMetamodel();
void synchronizeMetamodel();
@@ -90,4 +103,75 @@ public interface MetamodelSynchronizer {
}
}
+ final class MetamodelTools {
+
+ /**
+ * The type must be:<ul>
+ * <li>in the specified source folder
+ * <li>a top-level type
+ * <li>annotated with <code>&#64;javax.annotation.Generated</code> with
+ * the appropriate <code>value</code> and <code>date</code>
+ * <li>either itself or one of its nested types annotated with
+ * <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
+ * </ul>
+ */
+ public static boolean isGeneratedMetamodelTopLevelType(JavaResourceAbstractType jrat, IPackageFragmentRoot sourceFolder) {
+ if ( ! jrat.isIn(sourceFolder)) {
+ return false;
+ }
+ return isGeneratedMetamodelTopLevelType(jrat);
+ }
+
+ /**
+ * The type must be:<ul>
+ * <li>a top-level type
+ * <li>annotated with <code>&#64;javax.annotation.Generated</code> with
+ * the appropriate <code>value</code> and <code>date</code>
+ * <li>either itself or one of its nested types annotated with
+ * <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
+ * </ul>
+ */
+ public static boolean isGeneratedMetamodelTopLevelType(JavaResourceAbstractType jrat) {
+ if ( ! isGenerated(jrat)) {
+ return false;
+ }
+ // if we get here we know we have a top-level type, since only top-level
+ // types are annotated @Generated; now see if anything is a metamodel
+ return isMetamodel(jrat);
+ }
+
+ /**
+ * The type must be annotated with
+ * <code>&#64;javax.annotation.Generated</code> with the appropriate
+ * <code>value</code> and <code>date</code>.
+ */
+ public static boolean isGenerated(JavaResourceAbstractType jrat) {
+ GeneratedAnnotation generatedAnnotation = (GeneratedAnnotation) jrat.getAnnotation(GeneratedAnnotation.ANNOTATION_NAME);
+ if (generatedAnnotation == null) {
+ return false;
+ }
+ if (generatedAnnotation.getValuesSize() != 1) {
+ return false;
+ }
+ if ( ! generatedAnnotation.getValue(0).equals(METAMODEL_GENERATED_ANNOTATION_VALUE)) {
+ return false;
+ }
+ if (StringTools.stringIsEmpty(generatedAnnotation.getDate())) {
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean isMetamodel(JavaResourceAbstractType jrat) {
+ // if we get here we know we have a top-level type, since only top-level
+ // types are annotated @Generated; now see if anything is a metamodel
+ for (JavaResourceAbstractType type : jrat.getAllTypes()) {
+ if (type.getAnnotation(StaticMetamodelAnnotation.ANNOTATION_NAME) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java
index f996f902e9..7cb565bc25 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,15 +11,13 @@ package org.eclipse.jpt.jpa.core.jpa2.context;
import java.util.Collection;
import java.util.Comparator;
-import java.util.ListIterator;
import java.util.Map;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.jpt.common.core.utility.BodySourceWriter;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-
import com.ibm.icu.text.Collator;
/**
@@ -54,7 +52,7 @@ public interface MetamodelSourceType {
/**
* Return the source type's attributes.
*/
- <T extends ReadOnlyPersistentAttribute> ListIterator<T> attributes();
+ ListIterable<? extends ReadOnlyPersistentAttribute> getAttributes();
/**
* Return the file generated as a result of the metamodel synchronization.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java
index d6f9225bcc..4f95ea0708 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.jpa2.context.java;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
/**
* Java cacheable holder/parent
@@ -28,6 +28,6 @@ import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
public interface JavaCacheableHolder2_0
extends CacheableHolder2_0, JavaJpaContextNode
{
- JavaResourcePersistentType getResourcePersistentType();
+ JavaResourceType getJavaResourceType();
JavaCacheable2_0 getCacheable();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java
index d417cc26dc..04a1643b2b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.jpa2.context.java;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
/**
* JPA 2.0 Java ordering
@@ -28,7 +28,7 @@ import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
public interface JavaOrderable2_0
extends Orderable2_0, JavaOrderable
{
- JavaResourcePersistentAttribute getResourcePersistentAttribute();
+ JavaResourceAttribute getResourceAttribute();
JavaOrderColumn2_0 getOrderColumn();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java
index 4483641f19..0c87cab4bb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,8 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.jpa2.context.java;
-import java.util.ListIterator;
-
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
@@ -30,6 +29,5 @@ import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
public interface JavaPersistentType2_0
extends JavaPersistentType, PersistentType2_0
{
- @SuppressWarnings("unchecked")
- ListIterator<JavaPersistentAttribute> attributes();
+ ListIterable<JavaPersistentAttribute> getAttributes();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java
index c429661c27..76e63a2096 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.jpa2.context.orm;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
@@ -29,6 +29,5 @@ import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
public interface OrmPersistentType2_0
extends OrmPersistentType, PersistentType2_0
{
- @SuppressWarnings("unchecked")
- ListIterator<OrmReadOnlyPersistentAttribute> attributes();
+ ListIterable<OrmReadOnlyPersistentAttribute> getAttributes();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java
index f45dd33bac..f21fe1bb88 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,9 +10,9 @@
package org.eclipse.jpt.jpa.core.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
/**
* Corresponds to the JPA 2.0 annotation
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java
index 3d4a0815e3..9c2afb9d44 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
/**
* Corresponds to the JPA 2.0 annotation
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java
index 38d3120e65..3d6885fd65 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.FetchType;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java
index cfcf848ae6..897d9aad5d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.jpa2.resource.java;
-import java.util.ListIterator;
-
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Corresponds to the Java 6 annotation
@@ -39,14 +38,14 @@ public interface GeneratedAnnotation
* annotation.
* Return <code>null</code> if the element does not exist in the annotation.
*/
- ListIterator<String> values();
+ ListIterable<String> getValues();
String VALUES_LIST = "values"; //$NON-NLS-1$
/**
* Corresponds to the <code>value<code> element of the <code>Generated</code>
* annotation.
*/
- int valuesSize();
+ int getValuesSize();
/**
* Corresponds to the <code>value<code> element of the <code>Generated</code>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java
deleted file mode 100644
index d8c9d2bc40..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.SimpleFilter;
-import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-
-/**
- * JPA 2.0 Java source code or binary persistent type.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.3
- */
-public interface JavaResourcePersistentType2_0
- extends JavaResourcePersistentType
-{
-
- // ********** metamodel **********
-
- /**
- * Return the <code>javax.annotation.Generated</code> annotation.
- */
- GeneratedAnnotation getGeneratedAnnotation();
-
- /**
- * Return whether the type is a metamodel top-level type generated in the
- * specified source folder.
- */
- boolean isGeneratedMetamodelTopLevelType(IPackageFragmentRoot sourceFolder);
-
- /**
- * Return whether the type is a generated metamodel top-level type.
- * The type is generated and either it or one of its nested types is a
- * metamodel type.
- */
- boolean isGeneratedMetamodelTopLevelType();
-
- /**
- * Return whether the type is a metamodel type.
- */
- boolean isMetamodel();
-
- /**
- * The value used to tag a generated type:
- * <pre>
- * &#64;javax.annotation.Generated(value="Dali", date="2009-11-23T13:56:06.171-0500")
- * </pre>
- */
- String METAMODEL_GENERATED_ANNOTATION_VALUE = "Dali"; //$NON-NLS-1$
-
-
- // ********** access type filters **********
-
- Filter<JavaResourcePersistentAttribute> PROPERTY_ACCESS_TYPE_FILTER = new AccessTypeFilter(AccessType.PROPERTY);
- Filter<JavaResourcePersistentAttribute> FIELD_ACCESS_TYPE_FILTER = new AccessTypeFilter(AccessType.FIELD);
-
- class AccessTypeFilter
- extends SimpleFilter<JavaResourcePersistentAttribute, AccessType>
- {
- AccessTypeFilter(AccessType accessType) {
- super(accessType);
- }
- @Override
- public boolean accept(JavaResourcePersistentAttribute resourceAttribute) {
- return resourceAttribute.getSpecifiedAccess() == this.criterion;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java
index 376897d3be..3ed651969a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
/**
* Corresponds to the JPA 2.0 annotation
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java
deleted file mode 100644
index 42cec5430d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.jpa2.resource.java;
-
-import org.eclipse.jpt.jpa.core.resource.java.ContainerAnnotation;
-
-/**
- * Corresponds to the JPA annotation
- * javax.persistence.MapKeyJoinColumns
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.3
- */
-public interface MapKeyJoinColumns2_0Annotation
- extends ContainerAnnotation<NestableMapKeyJoinColumnAnnotation>
-{
- String ANNOTATION_NAME = JPA2_0.MAP_KEY_JOIN_COLUMNS;
-
- String MAP_KEY_JOIN_COLUMNS_LIST = "mapKeyJoinColumns"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java
index 07696027f9..44be2912ee 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.jpa.core.jpa2.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
/**
* Corresponds to the JPA 2.0 annotation
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java
deleted file mode 100644
index d3686f864a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.jpa2.resource.java;
-
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.MapKeyJoinColumn</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.3
- */
-public interface NestableMapKeyJoinColumnAnnotation
- extends MapKeyJoinColumn2_0Annotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java
index 97aecfd168..ef7ff55a29 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.jpa2.resource.java;
-import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
/**
* Corresponds to the JPA 2.0 annotation
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java
deleted file mode 100644
index dd56903ef3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import java.util.Map;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-
-/**
- * Common Java resource annotation behavior
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.0
- */
-public interface Annotation
- extends JavaResourceNode
-{
- /**
- * Return the annotation's fully qualified name, as opposed to the value of
- * the annotation's <code>name</code> element. For example:<pre>
- * &#64;com.foo.Bar(name="Thomas")
- * </pre>
- * <code>#getAnnotationName()</code> will return <code>"com.foo.Bar"</code>.
- * In typical subclasses, <code>#getName()</code> would return
- * <code>"Thomas"</code>.
- *
- * @see JPA
- */
- String getAnnotationName();
-
- /**
- * Return the corresponding JDT DOM annotation from the specified
- * AST compilation unit.
- */
- org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot);
-
- /**
- * Create and add the corresponding Java annotation to the JDT DOM.
- */
- void newAnnotation();
-
- /**
- * Remove the corresponding Java annotation from the JDT DOM.
- */
- void removeAnnotation();
-
- /**
- * Return whether all the annotation's member values are <code>null</code>;
- * implying the annotation can be removed if it has no semantic value as a
- * marker annotation.
- */
- boolean isUnset();
-
- /**
- * Store the annotation's state in the specified map, recursing into nested
- * annotations. Once the state is stored, clear it.
- * <p>
- * This is used to save an annotation's state when it is converted from
- * stand-alone to nested (and vice versa).
- * During tests, and possibly at other times (albeit
- * asynchronously), the annotation's state is cleared out when the new
- * annotation is written to the Java source file; since this will trigger
- * a Java change event and the annotation will be sync'ed with the, now
- * empty, Java source code annotation.
- *
- * @see #restoreFrom(Map)
- */
- // TODO this can probably be removed if we move to "combination" annotation adapters...
- void storeOn(Map<String, Object> map);
-
- /**
- * Restore the annotation's state from the specified map, recursing into nested
- * annotations.
- *
- * @see #storeOn(Map)
- */
- // TODO this can probably be removed if we move to "combination" annotation adapters...
- void restoreFrom(Map<String, Object> map);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java
deleted file mode 100644
index 20f9997aae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-
-/**
- * Common behavior for all annotation "containers".
- * This interface is used mainly in
- * {@link org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools}.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.2
- */
-public interface AnnotationContainer<T extends NestableAnnotation>
-{
- /**
- * Return the corresponding JDT DOM annotation from the specified
- * AST compilation unit. Used as a starting point when traversing the AST.
- */
- org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot);
-
- /**
- * Return the name of the container annotation's element that is used
- * to indicate the nested annotations (typically <code>"value"</code>).
- * Used when traversing the AST.
- */
- String getElementName();
-
- /**
- * Return the name of the nested annotations held by the container.
- * Used when traversing the AST.
- */
- String getNestedAnnotationName();
-
- /**
- * Return the nested annotations held by the container.
- */
- Iterable<T> getNestedAnnotations();
-
- /**
- * Return the number of nested annotations held by the container.
- */
- int getNestedAnnotationsSize();
-
- /**
- * Add a nested annotation to the container
- * without firing change notification.
- */
- T addNestedAnnotation();
-
- /**
- * The specified JDT DOM annotation was added to the JDT DOM annotation
- * corresponding to the container. Add a corresponding nested annotation
- * to the container and notify interested parties.
- */
- void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation);
-
- /**
- * Move the nested annotation at the specified source index in the
- * container to the specified target index without firing change notification.
- * Return the moved nested annotation.
- */
- T moveNestedAnnotation(int targetIndex, int sourceIndex);
-
- /**
- * Remove the nested annotation at the specified index from the
- * container without firing change notification.
- */
- T removeNestedAnnotation(int index);
-
- /**
- * The JDT DOM annotations starting at the specified index were removed
- * from the JDT DOM annotations corresponding to the container.
- * Remove the corresponding nested annotations from the
- * container and notify interested parties.
- */
- void syncRemoveNestedAnnotations(int index);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java
deleted file mode 100644
index d0f537bd47..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-
-/**
- * Used to build annotations discovered in the Java source code.
- * To provide new <code>AnnotationDefinition</code>s, create a new
- * {@link org.eclipse.jpt.jpa.core.JpaPlatform}
- * by implementing {@link org.eclipse.jpt.jpa.core.JpaPlatform JpaPlatform}
- * and/or extending
- * {@link org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform GenericJpaPlatform}.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @see Annotation
- * @see org.eclipse.jpt.jpa.core.JpaPlatform
- * @see org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform
- *
- * @version 3.0
- * @since 2.0
- */
-public interface AnnotationDefinition
-{
- /**
- * Return the name of the annotation the definition will build in the
- * various #build...(...) methods.
- */
- String getAnnotationName();
-
- /**
- * Build and return an annotation for the specified annotated element.
- */
- Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement);
-
- /**
- * Build and return an annotation for the specified JDT annotation
- * on the specified annotated element.
- */
- Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation);
-
- /**
- * Build and return a <em>null</em> annotation for the specified element.
- * Only certain annotations are required to have <em>null</em> implementations;
- * typically the annotations with reasonably complex default behavior.
- * The <em>null</em> annotation is used by the corresponding default context model.
- * The <em>null</em> annotation simplifies the context model code, allowing the
- * context model to simply set various bits of state (e.g. <code>name</code>) and the
- * <em>null</em> annotation will create a new <em>real</em> annotation and forward the
- * new state to it. This reduces the number of <code>null</code> checks in the context
- * model (hopefully).
- */
- Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java
index 450dba4f8d..abc8031976 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Corresponds to the JPA annotation
@@ -34,13 +34,13 @@ public interface AssociationOverrideAnnotation
* Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
* Return an empty iterator if the element does not exist in Java.
*/
- ListIterator<JoinColumnAnnotation> joinColumns();
+ ListIterable<JoinColumnAnnotation> getJoinColumns();
String JOIN_COLUMNS_LIST = "joinColumns"; //$NON-NLS-1$
/**
* Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
*/
- int joinColumnsSize();
+ int getJoinColumnsSize();
/**
* Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
@@ -50,11 +50,6 @@ public interface AssociationOverrideAnnotation
/**
* Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
*/
- int indexOfJoinColumn(JoinColumnAnnotation joinColumn);
-
- /**
- * Corresponds to the 'joinColumns' element of the AssociationOverride annotation.
- */
JoinColumnAnnotation addJoinColumn(int index);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java
deleted file mode 100644
index b110097462..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * javax.persistence.AssociationOverrides
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.0
- */
-public interface AssociationOverridesAnnotation
- extends ContainerAnnotation<NestableAssociationOverrideAnnotation>
-{
- String ANNOTATION_NAME = JPA.ASSOCIATION_OVERRIDES;
-
- String ASSOCIATION_OVERRIDES_LIST = "associationOverides"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java
deleted file mode 100644
index 1fca1c4f46..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * javax.persistence.AttributeOverrides
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.0
- */
-public interface AttributeOverridesAnnotation
- extends ContainerAnnotation<NestableAttributeOverrideAnnotation>
-{
- String ANNOTATION_NAME = JPA.ATTRIBUTE_OVERRIDES;
-
- String ATTRIBUTE_OVERRIDES_LIST = "attributeOverrides"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java
index ead44d01b9..6ff8065d4c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
@@ -27,10 +28,9 @@ import org.eclipse.jpt.common.core.utility.TextRange;
* @since 2.3
*/
public interface BaseJoinColumnAnnotation
- extends BaseColumnAnnotation
+ extends BaseColumnAnnotation, NestableAnnotation
{
// ********** referenced column name **********
-
/**
* Corresponds to the 'referencedColumnName' element of the JoinColumn annotation.
* Return null if the element does not exist in Java.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java
index f6e31583e4..96e6f3b794 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
-import java.util.ListIterator;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Corresponds to the JPA annotations:<ul>
@@ -129,13 +129,13 @@ public interface BaseTableAnnotation
* Corresponds to the 'uniqueConstraints' element of the *Table annotation.
* Return an empty iterator if the element does not exist in Java.
*/
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints();
+ ListIterable<UniqueConstraintAnnotation> getUniqueConstraints();
String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$
/**
* Corresponds to the 'uniqueConstraints' element of the *Table annotation.
*/
- int uniqueConstraintsSize();
+ int getUniqueConstraintsSize();
/**
* Corresponds to the 'uniqueConstraints' element of the *Table annotation.
@@ -145,11 +145,6 @@ public interface BaseTableAnnotation
/**
* Corresponds to the 'uniqueConstraints' element of the *Table annotation.
*/
- int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint);
-
- /**
- * Corresponds to the 'uniqueConstraints' element of the *Table annotation.
- */
UniqueConstraintAnnotation addUniqueConstraint(int index);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java
index aa060986e5..253cabdbdc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java
deleted file mode 100644
index f74f802290..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Common behavior for all "container" annotations.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.0
- */
-public interface ContainerAnnotation<T extends NestableAnnotation>
- extends Annotation, AnnotationContainer<T>
-{
- /**
- * Convert the specified stand-alone annotation to an annotation nested
- * within the container without firing change notification.
- */
- void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation);
-
- /**
- * In preparation for a just-nested annotation being written to the source
- * file, add the just-nested annotation to the container annotation at the
- * specified index without firing change notification.
- *
- * @see #nestStandAloneAnnotation(NestableAnnotation)
- */
- void addNestedAnnotation(int index, NestableAnnotation annotation);
-
- /**
- * Convert the container's last nested annotation to a stand-alone
- * annotation without firing change notification.
- */
- void convertLastNestedAnnotationToStandAlone();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java
index bdba78284f..cb2bd2e13a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java
index 05c131b9d6..c1946cd595 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+
/**
* Corresponds to the JPA annotation
* javax.persistence.Embeddable
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java
index dcf5b2a165..6e8a9e2e93 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+
/**
* Corresponds to the JPA annotation
* javax.persistence.Embedded
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java
index 9244f3e79c..a61efbda6c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+
/**
* Corresponds to the JPA annotation
* javax.persistence.EmbeddedId
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java
index 7b59692e40..202e92478d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java
index 3485e76bc3..150f4db008 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java
index ff3ff6e3b2..26cd48fe53 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java
index 793fbb5d07..814b1ed34c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java
index 219293cc58..472736ed9f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+
/**
* Corresponds to the JPA annotation
* javax.persistence.Id
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java
index 330dd7d2f5..705e138a27 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java
index 25ddb14146..cb0f5da5d1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java
deleted file mode 100644
index ee86728e7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Java source code or binary annotated element.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 3.0
- * @since 3.0
- */
-public interface JavaResourceAnnotatedElement
- extends JavaResourceNode
-{
- // ********** annotations **********
-
- /**
- * String associated with changes to the "annotations" collection
- */
- String ANNOTATIONS_COLLECTION = "annotations"; //$NON-NLS-1$
-
- /**
- * Return the member's annotations in the order they appear.
- * Do not return duplicate annotations as this error is handled by the Java
- * compiler.
- */
- Iterator<Annotation> annotations();
-
- /**
- * Return the number of annotations.
- */
- int annotationsSize();
-
- /**
- * Return the annotation with the specified name.
- * Return the first if there are duplicates in the source code.
- * Return <code>null</code> if the member does not have an annotation
- * with the specified name.
- */
- Annotation getAnnotation(String annotationName);
-
- /**
- * Return the annotation with the specified name.
- * Return the first if there are duplicates in the source code.
- * Do not return <code>null</code>; instead, return but a <em>null</em>
- * annotation (i.e. an implementation that provides only default behavior)
- * if the member does not have an annotation with the specified name.
- */
- Annotation getNonNullAnnotation(String annotationName);
-
- /**
- * Return the nestable annotations with the specified name in the order
- * they appear.
- * If nestable and container annotations are both specified on the
- * member directly, return only the nestable annotations specified within
- * the container annotation.
- */
- // TODO tie the singular and plural annotations together so we can generate
- // a validation error when both are specified
- Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName);
-
- /**
- * Add an annotation with the specified name.
- * Return the newly-created annotation.
- */
- Annotation addAnnotation(String annotationName);
-
- /**
- * Add a new nestable annotation with the specified name.
- * Create a new container annotation if necessary and add the nestable
- * annotation to it.
- * If both the nestable annotation and the container annotation already
- * exist, then add to the container annotation, leaving the existing
- * nestable annotation alone.
- * If only the nestable annotation exists, then create the new container
- * annotation and move the existing nestable annotation to it along with
- * the new one. If neither annotation exists, then create a new nestable
- * annotation.
- */
- NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName);
-
- /**
- * Move the nestable annotation found in the specified container
- * annotation at the specified source index to the specified target index.
- */
- void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName);
-
- /**
- * Remove the specified annotation.
- */
- void removeAnnotation(String annotationName);
-
- /**
- * Remove the specified nestable annotation from the container annotation at the specified
- * index.
- * If there is no container, assume the index is zero and this does the same as
- * {@link #removeAnnotation(String)}
- */
- void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName);
-
- /**
- * In preparation for a just-unnested annotation being written to the source
- * file, add the just-unnested annotation to the member without firing
- * change notification.
- */
- void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation);
-
-
- // ********** queries **********
-
- /**
- * Return whether the underlying JDT member is currently annotated with any recognized
- * annotations.
- */
- boolean isAnnotated();
-
- /**
- * Return the text range for the member's name.
- */
- TextRange getNameTextRange(CompilationUnit astRoot);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java
deleted file mode 100644
index b5d051e51a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-
-/**
- * Java class file
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface JavaResourceClassFile
- extends JavaResourceNode
-{
- /**
- * Return the class file's persistent type.
- */
- JavaResourcePersistentType getPersistentType();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java
deleted file mode 100644
index 278ee38b5a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.common.utility.CommandExecutor;
-
-/**
- * Dali resource for JDT compilation unit.
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.2
- */
-public interface JavaResourceCompilationUnit
- extends JavaResourceNode.Root
-{
- /**
- * Return the corresponding JDT compilation unit.
- */
- ICompilationUnit getCompilationUnit();
-
- /**
- * Return the JPA project's annotation formatter. This is used to make any
- * manipulated annotations reasonably readable after being written to the
- * Java source file.
- */
- AnnotationEditFormatter getAnnotationEditFormatter();
-
- /**
- * This allows the resource model to modify the Java source code on the
- * UI thread when it is executing on another thread.
- */
- CommandExecutor getModifySharedDocumentCommandExecutor();
-
- /**
- * Resolve type information that could be dependent on other files being
- * added/removed.
- */
- void resolveTypes();
-
- /**
- * Something in Java has changed (typically either the compilation unit's
- * source code or the Java classpath); synchronize the compilation unit's
- * state with the Java source code etc.
- */
- void synchronizeWithJavaSource();
-
- /**
- * Build an AST for the compilation unit with its bindings resolved.
- */
- CompilationUnit buildASTRoot();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java
deleted file mode 100644
index eb54e73762..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptResourceModel;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.model.Model;
-import org.eclipse.jpt.jpa.core.JpaAnnotationProvider;
-
-/**
- * Common interface for Java resource nodes (source code or binary).
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.0
- */
-public interface JavaResourceNode
- extends Model
-{
- /**
- * Return the node's parent node.
- */
- JavaResourceNode getParent();
-
- /**
- * Return the Eclipse file that contains the Java resource node
- * (typically either a Java source code file or a JAR).
- */
- IFile getFile();
-
- /**
- * Return the root of the Java resource containment hierarchy
- * (typically either a compilation unit or a package fragment root).
- */
- Root getRoot();
-
- /**
- * Return the [source] node's root (the compilation unit).
- */
- // TODO get rid of this method...?
- JavaResourceCompilationUnit getJavaResourceCompilationUnit();
-
- /**
- * Return the [source] node's text range in the compilation unit's file.
- */
- TextRange getTextRange(CompilationUnit astRoot);
-
- /**
- * Initialize the [source] node from the specified AST.
- */
- void initialize(CompilationUnit astRoot);
-
- /**
- * Synchronize the [source] node with the specified AST.
- */
- void synchronizeWith(CompilationUnit astRoot);
-
-
- /**
- * Root of Java resource model containment hierarchy.
- */
- interface Root extends JavaResourceNode, JptResourceModel {
-
- /**
- * Return the root's Java resource persistent types.
- */
- Iterator<JavaResourcePersistentType> persistentTypes();
- String PERSISTENT_TYPES_COLLECTION = "persistentTypes"; //$NON-NLS-1$
-
- /**
- * Called (via a hook in change notification) whenever anything in the
- * Java resource model changes. Forwarded to listeners.
- */
- void resourceModelChanged();
-
- /**
- * Return the annotation provider that supplies the annotations found
- * in the Java resource model.
- */
- JpaAnnotationProvider getAnnotationProvider();
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java
deleted file mode 100644
index a7946d5070..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * @author Dmitry Geraskov
- *
- * Java source code of package-info
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public interface JavaResourcePackage
- extends
- JavaResourceAnnotatedElement
-{
-
- /**
- * The Java resource persistent package's name.
- */
- String getName();
- String NAME_PROPERTY = "name"; //$NON-NLS-1$
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java
deleted file mode 100644
index 36caa9f0cf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import java.util.Iterator;
-
-/**
- * Java package fragment
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface JavaResourcePackageFragment
- extends JavaResourceNode
-{
- /**
- * Return the package fragment's class files that contain "persistable" types.
- */
- Iterator<JavaResourceClassFile> classFiles();
- String CLASS_FILES_COLLECTION = "classFiles"; //$NON-NLS-1$
-
- /**
- * Return the size of the package fragment's class files.
- */
- int classFilesSize();
-
- /**
- * Return the package fragment's Java persistent types.
- * Return only the files that are annotated with JPA annotations.
- */
- Iterator<JavaResourcePersistentType> persistedTypes();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java
deleted file mode 100644
index efb95c0fd0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import java.util.Iterator;
-
-/**
- * Java package fragement root
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface JavaResourcePackageFragmentRoot
- extends JavaResourceNode.Root
-{
- /**
- * Return the package fragment root's package fragments.
- */
- Iterator<JavaResourcePackageFragment> packageFragments();
- String PACKAGE_FRAGMENTS_COLLECTION = "packageFragments"; //$NON-NLS-1$
-
- /**
- * Return the size of the package fragment root's package fragments.
- */
- int packageFragmentsSize();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java
deleted file mode 100644
index 678b31759c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Dali resource for JDT compilation unit named package-info.java.
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 3.0
- * @since 3.0
- */
-public interface JavaResourcePackageInfoCompilationUnit
- extends JavaResourceCompilationUnit
-{
- JavaResourcePackage getPackage();
- String PACKAGE = "package"; //$NON-NLS-1$
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java
deleted file mode 100644
index 653d7df204..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jpt.common.utility.MethodSignature;
-
-/**
- * Java source code or binary persistent attribute (field or property)
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.0
- */
-//TODO handle:
-// @Basic
-// private String foo, bar;
-public interface JavaResourcePersistentAttribute
- extends JavaResourcePersistentMember
-{
-
- JavaResourcePersistentType getParent();
-
- JavaResourcePersistentType getResourcePersistentType();
-
- /**
- * The Java resource persistent attribute's name does not change.
- */
- String getName();
-
- /**
- * Return a <em>null</em> annotation for the specified annotation name.
- * Return <code>null</code> if the specified annotation name is
- * <code>null</code>.
- * The corresponding annotation definition must implement
- * {@link AnnotationDefinition#buildNullAnnotation(JavaResourcePersistentMember)
- * buildNullAnnotation()}.
- */
- Annotation buildNullAnnotation(String annotationName);
-
- /**
- * Whether the Java resource persistent attribute is a field does not change.
- */
- boolean isField();
-
- /**
- * Whether the Java resource persistent attribute is a property does not change.
- */
- boolean isProperty();
-
- /**
- * Return the access type explicitly specified by the javax.persistence.Access annotation.
- * Return null if the Access annotation is not present.
- * For JPA 1.0 this is always going to return null; Access annotation is not supported in 1.0.
- */
- AccessType getSpecifiedAccess();
-
- /**
- * Return whether the attribute's type implements or extends the specified
- * type.
- */
- boolean typeIsSubTypeOf(String typeName);
-
- /**
- * Return whether the attribute's type is a "variable" primitive type
- * (i.e. any primitive type except 'void').
- */
- boolean typeIsVariablePrimitive();
-
- /**
- * Return whether the Java resource persistent attribute is for the specified
- * method.
- */
- boolean isFor(MethodSignature methodSignature, int occurrence);
-
- /**
- * @see java.lang.reflect.Modifier
- */
- int getModifiers();
- String MODIFIERS_PROPERTY = "modifiers"; //$NON-NLS-1$
-
- /**
- * Return the resolved, qualified name of the attribute's type
- * (e.g. "java.util.Collection" or "byte[]").
- * If the type is an array, this name will include the appropriate number
- * of bracket pairs.
- * This name will not include the type's generic type arguments
- * (e.g. "java.util.Collection<java.lang.String>" will only return
- * "java.util.Collection").
- * @see #typeTypeArgumentNames()
- */
- String getTypeName();
- String TYPE_NAME_PROPERTY = "typeName"; //$NON-NLS-1$
-
- /**
- * Return whether the attribute type is an interface.
- */
- boolean typeIsInterface();
- String TYPE_IS_INTERFACE_PROPERTY = "typeIsInterface"; //$NON-NLS-1$
-
- /**
- * Return whether the attribute type is an enum.
- */
- boolean typeIsEnum();
- String TYPE_IS_ENUM_PROPERTY = "typeIsEnum"; //$NON-NLS-1$
-
- /**
- * Return the names of the attribute type's superclasses.
- */
- ListIterator<String> typeSuperclassNames();
- String TYPE_SUPERCLASS_NAMES_LIST = "typeSuperclassNames"; //$NON-NLS-1$
-
- /**
- * Return the names of the attribute type's interfaces.
- */
- Iterator<String> typeInterfaceNames();
- String TYPE_INTERFACE_NAMES_COLLECTION = "typeInterfaceNames"; //$NON-NLS-1$
-
- /**
- * Return the names of the attribute type's type arguments.
- * The name for any argument that is an array will contain the appropriate
- * number of bracket pairs.
- * The names will not include any further generic type arguments.
- */
- ListIterator<String> typeTypeArgumentNames();
- String TYPE_TYPE_ARGUMENT_NAMES_LIST = "typeTypeArgumentNames"; //$NON-NLS-1$
-
- int typeTypeArgumentNamesSize();
-
- String getTypeTypeArgumentName(int index);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java
deleted file mode 100644
index 81cd09bcee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-
-/**
- * Java source code or binary persistent member.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 3.0
- * @since 2.0
- */
-public interface JavaResourcePersistentMember
- extends JavaResourceAnnotatedElement
-{
-
- // ********** annotations **********
-
- /**
- * Set the specified primary annotation as the first annotation and remove
- * all known persistence annotations (i.e. do not remove non-persistence
- * annotations) not included in the specified list of supporting annotations.
- * The specified primary annotation name can be <code>null</code> and, if
- * the list of supporting annotations is empty, <em>all</em> the persistence
- * annotations will be removed.
- */
- Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames);
-
-
- // ********** queries **********
-
- /**
- * Return whether the underlying JDT member is persistable according to
- * the JPA spec.
- */
- boolean isPersistable();
- String PERSISTABLE_PROPERTY = "persistable"; //$NON-NLS-1$
-
- /**
- * Return whether the type is final.
- */
- boolean isFinal();
- String FINAL_PROPERTY = "final"; //$NON-NLS-1$
-
- /**
- * Return whether the Java resource persistent member is for the specified
- * member.
- */
- boolean isFor(String memberName, int occurrence);
-
-
- // ********** behavior **********
-
- /**
- * Resolve type information that could be dependent on changes elsewhere
- * in the workspace.
- */
- void resolveTypes(CompilationUnit astRoot);
-
-
- // ********** persistable member filter **********
-
- Filter<JavaResourcePersistentMember> PERSISTABLE_MEMBER_FILTER =
- new Filter<JavaResourcePersistentMember>() {
- public boolean accept(JavaResourcePersistentMember member) {
- return member.isPersistable();
- }
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java
deleted file mode 100644
index c1b91a4a90..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.IPackageFragment;
-
-/**
- * Java source code or binary persistent type.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 3.0
- * @since 2.0
- */
-public interface JavaResourcePersistentType
- extends JavaResourcePersistentMember
-{
- /**
- * Return the unqualified (short) type name.
- */
- String getName();
- String NAME_PROPERTY = "name"; //$NON-NLS-1$
-
- /**
- * Return the fully qualified type name.
- */
- String getQualifiedName();
- String QUALIFIED_NAME_PROPERTY = "qualifiedName"; //$NON-NLS-1$
-
- /**
- * Return the package name.
- */
- String getPackageName();
- String PACKAGE_NAME_PROPERTY = "packageName"; //$NON-NLS-1$
-
- /**
- * Return the fully qualified name of the type's superclass.
- */
- String getSuperclassQualifiedName();
- String SUPERCLASS_QUALIFIED_NAME_PROPERTY = "superclassQualifiedName"; //$NON-NLS-1$
-
- /**
- * Return the name of the type's "declaring type".
- * Return <code>null</code> if the type is a top-level type.
- */
- String getDeclaringTypeName();
- String DECLARING_TYPE_NAME_PROPERTY = "declaringTypeName"; //$NON-NLS-1$
-
- /**
- * Return whether the type is abstract.
- */
- boolean isAbstract();
- String ABSTRACT_PROPERTY = "abstract"; //$NON-NLS-1$
-
- /**
- * Return whether the type is a member type.
- */
- boolean isMemberType();
- String MEMBER_TYPE_PROPERTY = "memberType"; //$NON-NLS-1$
-
- /**
- * Return whether the type is static.
- */
- boolean isStatic();
- String STATIC_PROPERTY = "static"; //$NON-NLS-1$
-
- /**
- * Return whether the type has a no-arg constructor (private, protected, or public)
- */
- boolean hasNoArgConstructor();
- String NO_ARG_CONSTRUCTOR_PROPERTY = "noArgConstructor"; //$NON-NLS-1$
-
- /**
- * Return whether the type has a private no-arg constructor
- */
- boolean hasPrivateNoArgConstructor();
- String PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY = "privateNoArgConstructor"; //$NON-NLS-1$
-
- /**
- * Return whether the type is annotated with any annotations that determine whether and
- * how the type is persisted
- */
- boolean isMapped();
-
- /**
- * Return whether the type has any attributes that have JPA annotations
- * on them (which can be used to infer the type's access type).
- */
- boolean hasAnyAnnotatedAttributes();
-
- boolean isIn(IPackageFragment packageFragment);
-
-
- // ********** types **********
-
- /**
- * Return the immediately nested types (children).
- */
- Iterator<JavaResourcePersistentType> types();
- String TYPES_COLLECTION = "types"; //$NON-NLS-1$
-
- /**
- * Return all the types; the type itself, its children, its grandchildren,
- * etc.
- */
- Iterator<JavaResourcePersistentType> allTypes();
-
- /**
- * Return the immediately nested persistable types.
- */
- Iterator<JavaResourcePersistentType> persistableTypes();
-
-
- // ********** fields **********
-
- /**
- * Return the type's fields.
- */
- Iterator<JavaResourcePersistentAttribute> fields();
- String FIELDS_COLLECTION = "fields"; //$NON-NLS-1$
-
- /**
- * Return the type's persistable fields.
- */
- Iterator<JavaResourcePersistentAttribute> persistableFields();
-
- /**
- * A convenience method that returns the persistableFields that also
- * have the Access annotation with a value of FIELD
- */
- Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess();
-
-
- // ********** methods **********
-
- /**
- * Return the type's methods. This returns *all* methods from the JDT Type
- */
- Iterator<JavaResourcePersistentAttribute> methods();
- String METHODS_COLLECTION = "methods"; //$NON-NLS-1$
-
- /**
- * Return the type's persistable properties. This returns only the getter methods
- * that match the JavaBeans criteria for JPA, hence the name properties instead of methods
- */
- Iterator<JavaResourcePersistentAttribute> persistableProperties();
-
- /**
- * A convenience method that returns the persistableProperties that also
- * have the Access annotation with a value of PROPERTY
- */
- Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess();
-
-
- // ********** attributes **********
-
- /**
- * Return the type's persistable fields and properties.
- */
- Iterator<JavaResourcePersistentAttribute> persistableAttributes();
-
- /**
- * Return the persistable properties and/or fields given the non-null specified access type
- */
- Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess);
-
- class Tools {
- // ********** Access type **********
-
- /**
- * Return the access type currently implied by the specified Java source
- * code or class file:<ul>
- * <li>if any fields are annotated =>
- * {@link AccessType#FIELD FIELD}
- * <li>if only properties are annotated =>
- * {@link AccessType#PROPERTY PROPERTY}
- * <li>if neither are annotated =>
- * <code>null</code>
- *
- * </ul>
- */
- public static AccessType buildAccess(JavaResourcePersistentType jrpType) {
- for (Iterator<JavaResourcePersistentAttribute> stream = jrpType.persistableFields(); stream.hasNext(); ) {
- if (stream.next().isAnnotated()) {
- // any field is annotated => FIELD
- return AccessType.FIELD;
- }
- }
-
- for (Iterator<JavaResourcePersistentAttribute> stream = jrpType.persistableProperties(); stream.hasNext(); ) {
- if (stream.next().isAnnotated()) {
- // none of the fields are annotated and a getter is annotated => PROPERTY
- return AccessType.PROPERTY;
- }
- }
-
- // nothing is annotated
- return null;
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java
deleted file mode 100644
index 59a36848df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.IType;
-
-/**
- * Java persistent type cache - used to hold "external" types
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.2
- */
-public interface JavaResourcePersistentTypeCache
- extends JavaResourceNode.Root
-{
-
- /**
- * Return the size of the cache's persistent types.
- */
- int persistentTypesSize();
-
- /**
- * Add a Java resource persistent type for the specified JDT type to the
- * cache. Return the new type.
- */
- JavaResourcePersistentType addPersistentType(IType jdtType);
-
- /**
- * Remove all the persistent types associated with the specified JAR file.
- * Return whether any persistent types were removed.
- */
- boolean removePersistentTypes(IFile jarFile);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java
deleted file mode 100644
index ae98014d95..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * javax.persistence.JoinColumns
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.0
- */
-public interface JoinColumnsAnnotation
- extends ContainerAnnotation<NestableJoinColumnAnnotation>
-{
- String ANNOTATION_NAME = JPA.JOIN_COLUMNS;
-
- String JOIN_COLUMNS_LIST = "joinColumns"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java
index f977fb2fb7..de6583e7e8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Corresponds to the JPA annotation
@@ -36,13 +36,13 @@ public interface JoinTableAnnotation
* Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
* Return an empty iterator if the element does not exist in Java.
*/
- ListIterator<JoinColumnAnnotation> inverseJoinColumns();
+ ListIterable<JoinColumnAnnotation> getInverseJoinColumns();
String INVERSE_JOIN_COLUMNS_LIST = "inverseJoinColumns"; //$NON-NLS-1$
/**
* Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
*/
- int inverseJoinColumnsSize();
+ int getInverseJoinColumnsSize();
/**
* Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
@@ -52,11 +52,6 @@ public interface JoinTableAnnotation
/**
* Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
*/
- int indexOfInverseJoinColumn(JoinColumnAnnotation joinColumn);
-
- /**
- * Corresponds to the 'inverseJoinColumns' element of the JoinTable annotation.
- */
JoinColumnAnnotation addInverseJoinColumn(int index);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java
index 48ea23da02..a3b4fa9a01 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+
/**
* Corresponds to the JPA annotation
* javax.persistence.Lob
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java
index 66786e77a6..15ad0db259 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java
index 5b291ecf7c..8bdaa11d7a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+
/**
* Corresponds to the JPA annotation
* javax.persistence.MappedSuperclass
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java
index dea6c02323..a73072e5b3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java
deleted file mode 100644
index fb1b298840..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * javax.persistence.NamedNativeQueries
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.0
- */
-public interface NamedNativeQueriesAnnotation
- extends ContainerAnnotation<NestableNamedNativeQueryAnnotation>
-{
- String ANNOTATION_NAME = JPA.NAMED_NATIVE_QUERIES;
-
- String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueries"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java
deleted file mode 100644
index 327077e7d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * javax.persistence.NamedQueries
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.0
- */
-public interface NamedQueriesAnnotation
- extends ContainerAnnotation<NestableNamedQueryAnnotation>
-{
- String ANNOTATION_NAME = JPA.NAMED_QUERIES;
-
- String NAMED_QUERIES_LIST = "namedQueries"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java
deleted file mode 100644
index a0f2c81cdb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-
-/**
- * Interface for dealing with annotations that can be "nested" within arrays.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.0
- * @since 2.0
- */
-public interface NestableAnnotation
- extends Annotation
-{
- /**
- * Move the annotation to the specified index within its container array.
- * This should only be called when the annotation is actually nested
- * (as opposed to stand-alone).
- */
- void moveAnnotation(int index);
-
- /**
- * Convert the annotation from "stand-alone" to "nested" within the "container"
- * annotation adapted by the specified adapter at the specified index.
- * The index may have a value of only <code>0</code> or <code>1</code>.
- * <p>
- * This is used to convert an annotation that is part of the "combination"
- * pattern where a list containing elements of the annotation
- * (e.g. {@link JoinColumnAnnotation}) can be represented by either the
- * annotation itself (when there is only a single element in the collection)
- * or a "container" annotation (e.g. {@link JoinColumnsAnnotation}) that
- * holds only a single <code>value</code> element that is the array of
- * "nested" annnotations.
- *
- * @see #convertToStandAlone()
- */
- void convertToNested(ContainerAnnotation<? extends NestableAnnotation> containerAnnotation, DeclarationAnnotationAdapter containerAnnotationAdapter, int index);
-
- /**
- * Convert the annotation from "nested" within the "container" annotation
- * to "stand-alone".
- *
- * @see #convertToNested(ContainerAnnotation, DeclarationAnnotationAdapter, int)
- */
- void convertToStandAlone();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java
deleted file mode 100644
index 8953f5e497..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.AssociationOverride</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface NestableAssociationOverrideAnnotation
- extends AssociationOverrideAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java
deleted file mode 100644
index 99ab9db7da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.AttributeOverride</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface NestableAttributeOverrideAnnotation
- extends AttributeOverrideAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java
deleted file mode 100644
index b762d90617..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.JoinColumn</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface NestableJoinColumnAnnotation
- extends JoinColumnAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java
deleted file mode 100644
index 24696971f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.NamedNativeQuery</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface NestableNamedNativeQueryAnnotation
- extends NamedNativeQueryAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java
deleted file mode 100644
index c8ae307462..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.NamedQuery</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.3
- * @since 2.2
- */
-public interface NestableNamedQueryAnnotation
- extends NamedQueryAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index 4a10acae05..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.PrimaryKeyJoinColumn</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface NestablePrimaryKeyJoinColumnAnnotation
- extends PrimaryKeyJoinColumnAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java
deleted file mode 100644
index 100876f9bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.QueryHint</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface NestableQueryHintAnnotation
- extends QueryHintAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java
deleted file mode 100644
index f9aeee0cd7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.SecondaryTable</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface NestableSecondaryTableAnnotation
- extends SecondaryTableAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java
deleted file mode 100644
index d0dd044468..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * <code>javax.persistence.UniqueConstraint</code>
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.2
- */
-public interface NestableUniqueConstraintAnnotation
- extends UniqueConstraintAnnotation, NestableAnnotation
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java
index b74f454fb8..4d75a65dc3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java
index 8ca90b80e4..4ea8039bc2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
@@ -27,7 +28,7 @@ import org.eclipse.jpt.common.core.utility.TextRange;
* @since 2.0
*/
public interface OverrideAnnotation
- extends Annotation
+ extends NestableAnnotation
{
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java
index 1400ca6969..1cf35fc5b2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
@@ -26,7 +27,7 @@ import org.eclipse.jpt.common.core.utility.TextRange;
* @since 2.0
*/
public interface PrimaryKeyJoinColumnAnnotation
- extends NamedColumnAnnotation
+ extends NamedColumnAnnotation, NestableAnnotation
{
String ANNOTATION_NAME = JPA.PRIMARY_KEY_JOIN_COLUMN;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java
deleted file mode 100644
index 5cda025f8c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * javax.persistence.PrimaryKeyJoinColumns
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.0
- */
-public interface PrimaryKeyJoinColumnsAnnotation
- extends ContainerAnnotation<NestablePrimaryKeyJoinColumnAnnotation>
-{
- String ANNOTATION_NAME = JPA.PRIMARY_KEY_JOIN_COLUMNS;
-
- String PK_JOIN_COLUMNS_LIST = "pkJoinColumns"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java
index c888f0eeb6..a1bf849a8f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
-import java.util.ListIterator;
-
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Common protocol among:<ul>
@@ -29,7 +29,7 @@ import org.eclipse.jpt.common.core.utility.TextRange;
* @since 2.2
*/
public interface QueryAnnotation
- extends Annotation
+ extends NestableAnnotation
{
// ********** name **********
@@ -81,13 +81,13 @@ public interface QueryAnnotation
* Corresponds to the 'hints' element of the *Query annotation.
* Return an empty iterator if the element does not exist in Java.
*/
- ListIterator<QueryHintAnnotation> hints();
+ ListIterable<QueryHintAnnotation> getHints();
String HINTS_LIST = "hints"; //$NON-NLS-1$
/**
* Corresponds to the 'hints' element of the *Query annotation.
*/
- int hintsSize();
+ int getHintsSize();
/**
* Corresponds to the 'hints' element of the *Query annotation.
@@ -97,11 +97,6 @@ public interface QueryAnnotation
/**
* Corresponds to the 'hints' element of the *Query annotation.
*/
- int indexOfHint(QueryHintAnnotation hint);
-
- /**
- * Corresponds to the 'hints' element of the *Query annotation.
- */
QueryHintAnnotation addHint(int index);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java
index 41c13bee65..efc6f768c8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
@@ -26,7 +27,7 @@ import org.eclipse.jpt.common.core.utility.TextRange;
* @since 2.0
*/
public interface QueryHintAnnotation
- extends Annotation
+ extends NestableAnnotation
{
String ANNOTATION_NAME = JPA.QUERY_HINT;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java
index eef04b7335..40a4721174 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Corresponds to the JPA annotations:<ul>
@@ -34,13 +34,13 @@ public interface ReferenceTableAnnotation
* Corresponds to the 'joinColumns' element of the JoinTable annotation.
* Return an empty iterator if the element does not exist in Java.
*/
- ListIterator<JoinColumnAnnotation> joinColumns();
+ ListIterable<JoinColumnAnnotation> getJoinColumns();
String JOIN_COLUMNS_LIST = "joinColumns"; //$NON-NLS-1$
/**
* Corresponds to the 'joinColumns' element of the JoinTable annotation.
*/
- int joinColumnsSize();
+ int getJoinColumnsSize();
/**
* Corresponds to the 'joinColumns' element of the JoinTable annotation.
@@ -50,11 +50,6 @@ public interface ReferenceTableAnnotation
/**
* Corresponds to the 'joinColumns' element of the JoinTable annotation.
*/
- int indexOfJoinColumn(JoinColumnAnnotation joinColumn);
-
- /**
- * Corresponds to the 'joinColumns' element of the JoinTable annotation.
- */
JoinColumnAnnotation addJoinColumn(int index);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java
index 9e33759d42..c7f3033168 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java
index ffef75571b..5266fff5e2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
-import java.util.ListIterator;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Corresponds to the JPA annotation
@@ -25,7 +26,7 @@ import java.util.ListIterator;
* @since 2.0
*/
public interface SecondaryTableAnnotation
- extends BaseTableAnnotation
+ extends BaseTableAnnotation, NestableAnnotation
{
String ANNOTATION_NAME = JPA.SECONDARY_TABLE;
@@ -36,13 +37,13 @@ public interface SecondaryTableAnnotation
* Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
* Return an empty iterator if the element does not exist in Java.
*/
- ListIterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns();
+ ListIterable<PrimaryKeyJoinColumnAnnotation> getPkJoinColumns();
String PK_JOIN_COLUMNS_LIST = "pkJoinColumns"; //$NON-NLS-1$
/**
* Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
*/
- int pkJoinColumnsSize();
+ int getPkJoinColumnsSize();
/**
* Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
@@ -52,11 +53,6 @@ public interface SecondaryTableAnnotation
/**
* Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
*/
- int indexOfPkJoinColumn(PrimaryKeyJoinColumnAnnotation pkJoinColumn);
-
- /**
- * Corresponds to the 'pkJoinColumns' element of the SecondaryTable annotation.
- */
PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java
deleted file mode 100644
index 841a3b9fe0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource.java;
-
-/**
- * Corresponds to the JPA annotation
- * javax.persistence.SecondaryTables
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.2
- * @since 2.0
- */
-public interface SecondaryTablesAnnotation
- extends ContainerAnnotation<NestableSecondaryTableAnnotation>
-{
- String ANNOTATION_NAME = JPA.SECONDARY_TABLES;
-
- String SECONDARY_TABLES_LIST = "secondaryTables"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java
index 5e77cc046b..93382d9392 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
-import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Corresponds to the JPA annotation
@@ -191,13 +191,13 @@ public interface TableGeneratorAnnotation
* Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
* Return null if the element does not exist in Java.
*/
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints();
+ ListIterable<UniqueConstraintAnnotation> getUniqueConstraints();
String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$
/**
* Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
*/
- int uniqueConstraintsSize();
+ int getUniqueConstraintsSize();
/**
* Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
@@ -207,11 +207,6 @@ public interface TableGeneratorAnnotation
/**
* Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
*/
- int indexOfUniqueConstraint(UniqueConstraintAnnotation uniqueConstraint);
-
- /**
- * Corresponds to the 'uniqueConstraints' element of the TableGenerator annotation.
- */
UniqueConstraintAnnotation addUniqueConstraint(int index);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java
index 102a8933f3..c08e4a1af6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.resource.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.utility.TextRange;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java
index 527b6c8185..64ff33fb84 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+
/**
* Corresponds to the JPA annotation
* javax.persistence.Transient
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java
index 39a4c86cd4..5272543ffb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,8 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
-import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
/**
* Corresponds to the JPA annotation
@@ -26,7 +27,7 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
* @since 2.0
*/
public interface UniqueConstraintAnnotation
- extends Annotation
+ extends NestableAnnotation
{
String ANNOTATION_NAME = JPA.UNIQUE_CONSTRAINT;
@@ -34,17 +35,22 @@ public interface UniqueConstraintAnnotation
* Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
* Return null if the element does not exist in the annotation.
*/
- ListIterator<String> columnNames();
+ ListIterable<String> getColumnNames();
String COLUMN_NAMES_LIST = "columnNames"; //$NON-NLS-1$
/**
* Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
*/
- int columnNamesSize();
+ int getColumnNamesSize();
/**
* Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
*/
+ String columnNameAt(int index);
+
+ /**
+ * Corresponds to the 'columnNames' element of the UniqueConstraint annotation.
+ */
void addColumnName(String columnName);
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java
index d2f470e5b6..4354f5caa6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.resource.java;
+import org.eclipse.jpt.common.core.resource.java.Annotation;
+
/**
* Corresponds to the JPA annotation
* javax.persistence.Version

Back to the top