diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse')
35 files changed, 166 insertions, 157 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaResourceType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaResourceType.java index c31c9443a4..42f7f14268 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaResourceType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaResourceType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * 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. @@ -10,7 +10,6 @@ package org.eclipse.jpt.core; import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.utility.internal.ClassTools; /** * Describes the file content type and version for JPA resources. @@ -85,7 +84,7 @@ public class JpaResourceType @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append(ClassTools.toStringClassNameForObject(this)); + sb.append(this.getClass().getSimpleName()); sb.append("(content = "); //$NON-NLS-1$ sb.append(this.contentType); sb.append(", "); //$NON-NLS-1$ diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java index 6231b45c51..d305d9c4bd 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -76,6 +76,7 @@ import org.eclipse.jpt.utility.internal.iterables.CompositeIterable; import org.eclipse.jpt.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.utility.internal.iterables.FilteringIterable; import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable; +import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper; import org.eclipse.jpt.utility.internal.iterables.TransformationIterable; import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; import org.eclipse.wst.validation.internal.provisional.core.IMessage; @@ -477,7 +478,7 @@ public abstract class AbstractJpaProject } protected Iterable<JpaFile> getJpaFiles(final IContentType contentType) { - return new FilteringIterable<JpaFile, JpaFile>(this.getJpaFiles()) { + return new FilteringIterable<JpaFile>(this.getJpaFiles()) { @Override protected boolean accept(JpaFile jpaFile) { return jpaFile.getContentType().isKindOf(contentType); @@ -740,7 +741,7 @@ public abstract class AbstractJpaProject * @see org.eclipse.jpt.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.core.internal.utility.jdt.JPTTools.TypeAdapter) */ protected Iterable<JavaResourcePersistentType> getInternalAnnotatedSourceJavaResourcePersistentTypes() { - return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) { + return new FilteringIterable<JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) { @Override protected boolean accept(JavaResourcePersistentType jrpType) { return jrpType.isPersistable() && jrpType.isAnnotated(); // i.e. the type is valid and has a valid type annotation @@ -767,7 +768,7 @@ public abstract class AbstractJpaProject * referenced in persistence.xml */ protected Iterable<JavaResourcePersistentType> getInternalMappedSourceJavaResourcePersistentTypes() { - return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) { + return new FilteringIterable<JavaResourcePersistentType>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) { @Override protected boolean accept(JavaResourcePersistentType jrpType) { return jrpType.isMapped(); // i.e. the type is already persistable and annotated @@ -779,6 +780,14 @@ public abstract class AbstractJpaProject * return only those Java resource persistent types that are * part of the JPA project, ignoring those in JARs referenced in persistence.xml */ + protected Iterable<JavaResourcePersistentType2_0> getInternalSourceJavaResourcePersistentTypes2_0() { + return new SubIterableWrapper<JavaResourcePersistentType, JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes()); + } + + /** + * return only those Java resource persistent types that are + * part of the JPA project, ignoring those in JARs referenced in persistence.xml + */ protected Iterable<JavaResourcePersistentType> getInternalSourceJavaResourcePersistentTypes() { return new CompositeIterable<JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypeSets()); } @@ -835,7 +844,7 @@ public abstract class AbstractJpaProject * @see org.eclipse.jpt.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.core.internal.utility.jdt.JPTTools.TypeAdapter) */ protected Iterable<JavaResourcePersistentType> getPersistableJavaResourcePersistentTypes() { - return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getJavaResourcePersistentTypes()) { + return new FilteringIterable<JavaResourcePersistentType>(this.getJavaResourcePersistentTypes()) { @Override protected boolean accept(JavaResourcePersistentType jrpType) { return jrpType.isPersistable(); @@ -920,10 +929,10 @@ public abstract class AbstractJpaProject return EmptyIterable.instance(); } final IPackageFragmentRoot genSourceFolder = this.getMetamodelPackageFragmentRoot(); - return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes()) { + return new FilteringIterable<JavaResourcePersistentType2_0>(this.getInternalSourceJavaResourcePersistentTypes2_0()) { @Override - protected boolean accept(JavaResourcePersistentType jrpt) { - return ((JavaResourcePersistentType2_0) jrpt).isGeneratedMetamodel(genSourceFolder); + protected boolean accept(JavaResourcePersistentType2_0 jrpt) { + return jrpt.isGeneratedMetamodel(genSourceFolder); } }; } @@ -1044,7 +1053,7 @@ public abstract class AbstractJpaProject } protected Iterable<IPackageFragmentRoot> getJavaSourceFolders() throws JavaModelException { - return new FilteringIterable<IPackageFragmentRoot, IPackageFragmentRoot>( + return new FilteringIterable<IPackageFragmentRoot>( this.getPackageFragmentRoots(), SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER ); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java index 381d791dcf..f6d14f5f6b 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -167,8 +167,7 @@ public class JpaPlatformRegistry { return configElementSupportsJpaFacetVersion(configElement, jpaFacetVersion); } - private boolean configElementSupportsJpaFacetVersion( - IConfigurationElement configElement, String jpaFacetVersion) { + boolean configElementSupportsJpaFacetVersion(IConfigurationElement configElement, String jpaFacetVersion) { // config element supports version if it explicitly sets it to that version // or if it specifies no version at all @@ -191,7 +190,7 @@ public class JpaPlatformRegistry { } private Iterable<IConfigurationElement> getConfigurationElementsForJpaFacetVersion(final String jpaFacetVersion) { - return new FilteringIterable<IConfigurationElement, IConfigurationElement>(this.jpaPlatformConfigurationElements.values()) { + return new FilteringIterable<IConfigurationElement>(this.jpaPlatformConfigurationElements.values()) { @Override protected boolean accept(IConfigurationElement configElement) { return configElementSupportsJpaFacetVersion(configElement, jpaFacetVersion); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java index 98d07e6c80..08c0ef2714 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -280,7 +280,7 @@ public abstract class AbstractJavaBaseColumn<T extends BaseColumnAnnotation> ext } private Iterator<String> candidateTableNames(Filter<String> filter) { - return new FilteringIterator<String, String>(this.candidateTableNames(), filter); + return new FilteringIterator<String>(this.candidateTableNames(), filter); } private Iterator<String> javaCandidateTableNames(Filter<String> filter) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java index 58f7c264af..ebaea85e51 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -328,7 +328,7 @@ public abstract class AbstractJavaEntity } protected Iterable<org.eclipse.jpt.db.Table> getAssociatedDbTablesIncludingInherited() { - return new FilteringIterable<org.eclipse.jpt.db.Table, org.eclipse.jpt.db.Table>(this.getAssociatedDbTablesIncludingInherited_()) { + return new FilteringIterable<org.eclipse.jpt.db.Table>(this.getAssociatedDbTablesIncludingInherited_()) { @Override protected boolean accept(org.eclipse.jpt.db.Table t) { return t != null; @@ -962,7 +962,7 @@ public abstract class AbstractJavaEntity } protected Iterator<PersistentAttribute> allIdAttributes() { - return new FilteringIterator<PersistentAttribute, PersistentAttribute>(this.getPersistentType().allAttributes()) { + return new FilteringIterator<PersistentAttribute>(this.getPersistentType().allAttributes()) { @Override protected boolean accept(PersistentAttribute pa) { return pa.isIdAttribute(); @@ -993,7 +993,7 @@ public abstract class AbstractJavaEntity return new CompositeIterable<Table>(new TransformationIterable<TypeMapping, Iterable<Table>>(this.getInheritanceHierarchy()) { @Override protected Iterable<Table> transform(TypeMapping mapping) { - return new FilteringIterable<Table, Table>(CollectionTools.iterable(mapping.associatedTables())) { + return new FilteringIterable<Table>(CollectionTools.iterable(mapping.associatedTables())) { @Override protected boolean accept(Table o) { return true; @@ -1012,7 +1012,7 @@ public abstract class AbstractJavaEntity } protected Iterator<String> nonNullTableNames(Iterator<Table> tables) { - return new FilteringIterator<String, String>(this.tableNames(tables)) { + return new FilteringIterator<String>(this.tableNames(tables)) { @Override protected boolean accept(String o) { return o != null; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java index 21d350ee86..883543ca80 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -308,7 +308,7 @@ public abstract class AbstractJavaIdMapping } private Iterator<String> generatorNames(Filter<String> filter) { - return new FilteringIterator<String, String>(this.persistenceGeneratorNames(), filter); + return new FilteringIterator<String>(this.persistenceGeneratorNames(), filter); } protected Iterator<String> persistenceGeneratorNames(Filter<String> filter) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java index 6072fb7ed3..b63fef8748 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -304,7 +304,7 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi } protected Iterator<String> candidateMapKeyNames(Filter<String> filter) { - return new FilteringIterator<String, String>(this.candidateMapKeyNames(), filter); + return new FilteringIterator<String>(this.candidateMapKeyNames(), filter); } public Iterator<String> candidateMapKeyNames() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java index c5a3ce1779..77665aa639 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -183,7 +183,7 @@ public abstract class AbstractJavaNamedColumn<T extends NamedColumnAnnotation> e } private Iterable<String> getCandidateNames(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateNames(), filter); + return new FilteringIterable<String>(this.getCandidateNames(), filter); } private Iterable<String> getCandidateNames() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java index ca07b093dc..1e3d2bb489 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. + * 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. @@ -89,7 +89,7 @@ public abstract class AbstractJavaOverride extends AbstractJavaJpaContextNode im protected abstract Iterator<String> candidateNames(); private Iterator<String> candidateNames(Filter<String> filter) { - return new FilteringIterator<String, String>(this.candidateNames(), filter); + return new FilteringIterator<String>(this.candidateNames(), filter); } private Iterator<String> javaCandidateNames(Filter<String> filter) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java index dec7feba9a..0f286c5582 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -33,7 +33,8 @@ import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.utility.Filter; import org.eclipse.jpt.utility.internal.ArrayTools; -import org.eclipse.jpt.utility.internal.ClassTools; +import org.eclipse.jpt.utility.internal.ClassName; +import org.eclipse.jpt.utility.internal.ReflectionTools; import org.eclipse.jpt.utility.internal.Tools; import org.eclipse.jpt.utility.internal.iterables.ArrayIterable; import org.eclipse.jpt.utility.internal.iterables.EmptyIterable; @@ -219,21 +220,21 @@ public abstract class AbstractJavaPersistentAttribute return false; } - int arrayDepth = ClassTools.arrayDepthForTypeDeclaration(typeName); + int arrayDepth = ReflectionTools.getArrayDepthForTypeDeclaration(typeName); if (arrayDepth > 1) { return false; // multi-dimensional arrays are not supported } if (arrayDepth == 1) { - String elementTypeName = ClassTools.elementTypeNameForTypeDeclaration(typeName, 1); + String elementTypeName = ReflectionTools.getElementTypeNameForTypeDeclaration(typeName, 1); return this.elementTypeIsValidForBasicArray(elementTypeName); } // arrayDepth == 0 - if (ClassTools.classNamedIsVariablePrimitive(typeName)) { + if (ClassName.isVariablePrimitive(typeName)) { return true; // any primitive but 'void' } - if (ClassTools.classNamedIsVariablePrimitiveWrapperClass(typeName)) { + if (ClassName.isVariablePrimitiveWrapper(typeName)) { return true; // any primitive wrapper but 'java.lang.Void' } if (this.typeIsOtherValidBasicType(typeName)) { @@ -296,7 +297,7 @@ public abstract class AbstractJavaPersistentAttribute if (typeName == null) { return null; } - if (ClassTools.arrayDepthForTypeDeclaration(typeName) != 0) { + if (ReflectionTools.getArrayDepthForTypeDeclaration(typeName) != 0) { return null; // arrays cannot be entities } if (this.typeIsContainer(typeName)) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java index b9b7003fac..616052080c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -402,7 +402,7 @@ public abstract class AbstractJavaPersistentType } protected Iterator<JavaPersistentAttribute> attributesNamed(final String attributeName) { - return new FilteringIterator<JavaPersistentAttribute, JavaPersistentAttribute>(this.attributes()) { + return new FilteringIterator<JavaPersistentAttribute>(this.attributes()) { @Override protected boolean accept(JavaPersistentAttribute o) { return attributeName.equals(o.getName()); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java index a7bc08d56f..02d7926656 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -104,7 +104,7 @@ public abstract class AbstractJavaSequenceGenerator extends AbstractJavaGenerato } protected Iterable<String> getCandidateSequences(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateSequences(), filter); + return new FilteringIterable<String>(this.getCandidateSequences(), filter); } protected Iterable<String> getCandidateSequences() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java index e56fdabafe..db128ba727 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -445,7 +445,7 @@ public abstract class AbstractJavaTable } protected Iterable<String> getCandidateNames(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateNames(), filter); + return new FilteringIterable<String>(this.getCandidateNames(), filter); } protected Iterable<String> getCandidateNames() { @@ -458,7 +458,7 @@ public abstract class AbstractJavaTable } protected Iterable<String> getCandidateSchemata(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateSchemata(), filter); + return new FilteringIterable<String>(this.getCandidateSchemata(), filter); } protected Iterable<String> getCandidateSchemata() { @@ -470,7 +470,7 @@ public abstract class AbstractJavaTable } protected Iterable<String> getCandidateCatalogs(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateCatalogs(), filter); + return new FilteringIterable<String>(this.getCandidateCatalogs(), filter); } protected Iterable<String> getCandidateCatalogs() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByJoiningStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByJoiningStrategy.java index 19527f7484..a5f39d5876 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByJoiningStrategy.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByJoiningStrategy.java @@ -1,13 +1,12 @@ /******************************************************************************* - * 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 - *******************************************************************************/ + * 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.core.internal.context.java; import java.util.Iterator; @@ -131,7 +130,7 @@ public class GenericJavaMappedByJoiningStrategy } public Iterator<String> candidateMappedByAttributeNames(Filter<String> filter) { - return new FilteringIterator<String, String>(this.candidateMappedByAttributeNames(), filter); + return new FilteringIterator<String>(this.candidateMappedByAttributeNames(), filter); } protected Iterator<String> javaCandidateMappedByAttributeNames(Filter<String> filter) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java index eab789c812..08fa64f012 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddedMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -31,6 +31,7 @@ import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.CompositeIterator; import org.eclipse.jpt.utility.internal.iterators.EmptyIterator; import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; +import org.eclipse.jpt.utility.internal.iterators.SubIteratorWrapper; import org.eclipse.jpt.utility.internal.iterators.TransformationIterator; @@ -112,20 +113,20 @@ public abstract class AbstractOrmEmbeddedMapping<T extends XmlEmbedded> } @Override - public AttributeMapping resolveAttributeMapping(String name) { + public AttributeMapping resolveAttributeMapping(String attributeName) { if (getName() == null) { return null; } - AttributeMapping resolvedMapping = super.resolveAttributeMapping(name); + AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName); if (resolvedMapping != null) { return resolvedMapping; } if (this.isJpa2_0Compatible()) { - int dotIndex = name.indexOf('.'); + int dotIndex = attributeName.indexOf('.'); if (dotIndex != -1) { - if (getName().equals(name.substring(0, dotIndex))) { + if (getName().equals(attributeName.substring(0, dotIndex))) { for (AttributeMapping attributeMapping : CollectionTools.iterable(embeddableAttributeMappings())) { - resolvedMapping = attributeMapping.resolveAttributeMapping(name.substring(dotIndex + 1)); + resolvedMapping = attributeMapping.resolveAttributeMapping(attributeName.substring(dotIndex + 1)); if (resolvedMapping != null) { return resolvedMapping; } @@ -184,10 +185,13 @@ public abstract class AbstractOrmEmbeddedMapping<T extends XmlEmbedded> } public Iterator<RelationshipMapping> allOverridableAssociations() { - if (this.getTargetEmbeddable() == null) { - return EmptyIterator.instance(); - } - return new FilteringIterator<AttributeMapping, RelationshipMapping>(this.getTargetEmbeddable().attributeMappings()) { + return (this.getTargetEmbeddable() == null) ? + EmptyIterator.<RelationshipMapping>instance() : + new SubIteratorWrapper<AttributeMapping, RelationshipMapping>(this.allOverridableAssociations_()); + } + + protected Iterator<AttributeMapping> allOverridableAssociations_() { + return new FilteringIterator<AttributeMapping>(this.getTargetEmbeddable().attributeMappings()) { @Override protected boolean accept(AttributeMapping o) { return o.isOverridableAssociationMapping(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java index 1f6bf4ea2b..ac9774ccc7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -67,7 +67,7 @@ import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn; import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable; import org.eclipse.jpt.core.utility.TextRange; import org.eclipse.jpt.db.Schema; -import org.eclipse.jpt.utility.internal.ClassTools; +import org.eclipse.jpt.utility.internal.ClassName; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterables.CompositeIterable; import org.eclipse.jpt.utility.internal.iterables.FilteringIterable; @@ -278,7 +278,7 @@ public abstract class AbstractOrmEntity } private Iterable<org.eclipse.jpt.db.Table> getAssociatedDbTablesIncludingInherited() { - return new FilteringIterable<org.eclipse.jpt.db.Table, org.eclipse.jpt.db.Table>(this.getAssociatedDbTablesIncludingInherited_()) { + return new FilteringIterable<org.eclipse.jpt.db.Table>(this.getAssociatedDbTablesIncludingInherited_()) { @Override protected boolean accept(org.eclipse.jpt.db.Table t) { return t != null; @@ -574,7 +574,7 @@ public abstract class AbstractOrmEntity } protected Iterator<String> nonNullTableNames(Iterator<Table> tables) { - return new FilteringIterator<String, String>(this.tableNames(tables)) { + return new FilteringIterator<String>(this.tableNames(tables)) { @Override protected boolean accept(String o) { return o != null; @@ -594,7 +594,7 @@ public abstract class AbstractOrmEntity return new CompositeIterable<Table>(new TransformationIterable<TypeMapping, Iterable<Table>>(CollectionTools.iterable(this.inheritanceHierarchy())) { @Override protected Iterable<Table> transform(TypeMapping mapping) { - return new FilteringIterable<Table, Table>(CollectionTools.iterable(mapping.associatedTables())) { + return new FilteringIterable<Table>(CollectionTools.iterable(mapping.associatedTables())) { @Override protected boolean accept(Table o) { return true; @@ -1300,7 +1300,7 @@ public abstract class AbstractOrmEntity } String className = getClass_(); if (className != null) { - return ClassTools.shortNameForClassNamed(className); + return ClassName.getSimpleName(className); } return null; } @@ -1564,7 +1564,7 @@ public abstract class AbstractOrmEntity } protected Iterator<PersistentAttribute> allIdAttributes() { - return new FilteringIterator<PersistentAttribute, PersistentAttribute>(this.getPersistentType().allAttributes()) { + return new FilteringIterator<PersistentAttribute>(this.getPersistentType().allAttributes()) { @Override protected boolean accept(PersistentAttribute pa) { return pa.isIdAttribute(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java index a14c5f39f9..0cbfe14257 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -431,7 +431,7 @@ public abstract class AbstractPersistenceUnit } public Iterator<MappingFileRef> mappingFileRefsContaining(final String typeName) { - return new FilteringIterator<MappingFileRef, MappingFileRef> (this.mappingFileRefs()) { + return new FilteringIterator<MappingFileRef> (this.mappingFileRefs()) { @Override protected boolean accept(MappingFileRef mappingFileRef) { return mappingFileRef.getPersistentType(typeName) != null; @@ -695,7 +695,7 @@ public abstract class AbstractPersistenceUnit } protected Iterable<PersistentType> getNonNullClassRefPersistentTypes() { - return new FilteringIterable<PersistentType, PersistentType>(this.getClassRefPersistentTypes(), NotNullFilter.<PersistentType>instance()); + return new FilteringIterable<PersistentType>(this.getClassRefPersistentTypes(), NotNullFilter.<PersistentType>instance()); } protected Iterable<PersistentType> getClassRefPersistentTypes() { @@ -935,7 +935,7 @@ public abstract class AbstractPersistenceUnit if (propertyNamePrefix == null) { throw new NullPointerException(); } - return new FilteringIterator<Property, Property>(this.properties()) { + return new FilteringIterator<Property>(this.properties()) { @Override protected boolean accept(Property property) { String pName = property.getName(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java index 368b210e97..fe66b88e98 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. +* 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. @@ -16,7 +16,7 @@ import java.util.Map; import org.eclipse.jpt.core.JpaProject; import org.eclipse.jpt.core.context.persistence.PersistenceUnit; import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties; -import org.eclipse.jpt.utility.internal.ClassTools; +import org.eclipse.jpt.utility.internal.ReflectionTools; import org.eclipse.jpt.utility.internal.model.AbstractModel; /** @@ -386,7 +386,7 @@ public abstract class AbstractPersistenceUnitProperties extends AbstractModel return null; } if (value.getClass().isEnum()) { - return (String) ClassTools.staticFieldValue(value.getClass(), value.toString().toUpperCase(Locale.ENGLISH)); + return (String) ReflectionTools.getStaticFieldValue(value.getClass(), value.toString().toUpperCase(Locale.ENGLISH)); } return value.toString(); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java index de24ea665f..3039c44158 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -147,7 +147,7 @@ public class GenericJavaGeneratedValue } protected Iterator<String> candidateGeneratorNames(Filter<String> filter) { - return new FilteringIterator<String, String>(this.candidateGeneratorNames(), filter); + return new FilteringIterator<String>(this.candidateGeneratorNames(), filter); } protected Iterator<String> candidateGeneratorNames() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java index a28584175b..fbf0307146 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -134,7 +134,7 @@ public class GenericJavaJoinColumn extends AbstractJavaBaseColumn<JoinColumnAnno } private Iterable<String> getCandidateReferencedColumnNames(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateReferencedColumnNames(), filter); + return new FilteringIterable<String>(this.getCandidateReferencedColumnNames(), filter); } private Iterable<String> getCandidateReferencedColumnNames() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java index 5b384d77e2..eaaff838d2 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -124,7 +124,7 @@ public class GenericJavaPrimaryKeyJoinColumn extends AbstractJavaNamedColumn<Pri } private Iterable<String> getCandidateReferencedColumnNames(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateReferencedColumnNames(), filter); + return new FilteringIterable<String>(this.getCandidateReferencedColumnNames(), filter); } private Iterable<String> getCandidateReferencedColumnNames() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java index fd03d3389a..14d6d12607 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -447,7 +447,7 @@ public class GenericJavaTableGenerator } protected Iterable<String> getCandidateTables(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateTables(), filter); + return new FilteringIterable<String>(this.getCandidateTables(), filter); } protected Iterable<String> getCandidateTables() { @@ -466,7 +466,7 @@ public class GenericJavaTableGenerator } protected Iterable<String> getCandidateSchemata(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateSchemata(), filter); + return new FilteringIterable<String>(this.getCandidateSchemata(), filter); } protected Iterable<String> getCandidateSchemata() { @@ -485,7 +485,7 @@ public class GenericJavaTableGenerator } protected Iterable<String> getCandidateCatalogs(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateCatalogs(), filter); + return new FilteringIterable<String>(this.getCandidateCatalogs(), filter); } protected Iterable<String> getCandidateCatalogs() { @@ -504,7 +504,7 @@ public class GenericJavaTableGenerator } protected Iterable<String> getCandidateColumnNames(Filter<String> filter) { - return new FilteringIterable<String, String>(this.getCandidateColumnNames(), filter); + return new FilteringIterable<String>(this.getCandidateColumnNames(), filter); } protected Iterable<String> getCandidateColumnNames() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java index 64246c7f3d..a24d8e8e73 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. + * Copyright (c) 2008, 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. @@ -158,7 +158,7 @@ public class GenericJavaUniqueConstraint extends AbstractJavaJpaContextNode } private Iterator<String> candidateColumnNames(Filter<String> filter) { - return new FilteringIterator<String, String>(this.candidateColumnNames(), filter); + return new FilteringIterator<String>(this.candidateColumnNames(), filter); } private Iterator<String> candidateColumnNames() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java index 768a1d8082..f962b0e84a 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -49,7 +49,7 @@ import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping; import org.eclipse.jpt.core.resource.orm.XmlTypeMapping; import org.eclipse.jpt.core.resource.xml.EmfTools; import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.utility.internal.ClassTools; +import org.eclipse.jpt.utility.internal.ClassName; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.Tools; import org.eclipse.jpt.utility.internal.iterables.CompositeIterable; @@ -142,7 +142,7 @@ public class GenericOrmPersistentType public String getShortName(){ String className = this.getName(); - return (className == null) ? null : ClassTools.shortNameForClassNamed(className); + return (className == null) ? null : ClassName.getSimpleName(className); } @@ -262,7 +262,7 @@ public class GenericOrmPersistentType } protected Iterator<OrmPersistentAttribute> attributesNamed(final String attributeName) { - return new FilteringIterator<OrmPersistentAttribute, OrmPersistentAttribute>(this.attributes()) { + return new FilteringIterator<OrmPersistentAttribute>(this.attributes()) { @Override protected boolean accept(OrmPersistentAttribute o) { return Tools.valuesAreEqual(attributeName, o.getName()); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java index 1002ef5192..6e6108c88a 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * 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. @@ -36,7 +36,7 @@ import org.eclipse.jpt.core.jpa2.context.PersistentType2_0; import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0; import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0; import org.eclipse.jpt.utility.Filter; -import org.eclipse.jpt.utility.internal.ClassTools; +import org.eclipse.jpt.utility.internal.ClassName; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.IndentingPrintWriter; import org.eclipse.jpt.utility.internal.StringTools; @@ -157,11 +157,11 @@ public class GenericPersistentTypeMetamodelSynchronizer // TODO protected String getPackageName() { // the default is to store the metamodel in the same package as the model - return ClassTools.packageNameForClassNamed(this.getMetamodelClassName()); + return ClassName.getPackageName(this.getMetamodelClassName()); } protected String getFileName() { - return ClassTools.shortNameForClassNamed(this.getMetamodelClassName()) + ".java"; + return ClassName.getSimpleName(this.getMetamodelClassName()) + ".java"; } protected String getMetamodelClassName() { @@ -537,7 +537,7 @@ public class GenericPersistentTypeMetamodelSynchronizer * strip off any non-required imports (e.g. "java.lang.Object') */ protected Iterable<Map.Entry<String, ImportPackage>> getRequiredImportEntries() { - return new FilteringIterable<Map.Entry<String, ImportPackage>, Map.Entry<String, ImportPackage>>(this.imports.entrySet(), this.buildRequiredImportEntriesFilter()); + return new FilteringIterable<Map.Entry<String, ImportPackage>>(this.imports.entrySet(), this.buildRequiredImportEntriesFilter()); } protected Filter<Map.Entry<String, ImportPackage>> buildRequiredImportEntriesFilter() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java index ef0a913e98..aa0866f054 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java @@ -1,14 +1,12 @@ /******************************************************************************* - * 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 - *******************************************************************************/ - + * 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.core.internal.jpa2.context.java; import java.util.List; @@ -74,7 +72,7 @@ public class GenericJavaMapsIdDerivedIdentityStrategy2_0 protected String calculateDefaultValue() { Iterable<AttributeMapping> validAttributeMappings = - new FilteringIterable<AttributeMapping, AttributeMapping>( + new FilteringIterable<AttributeMapping>( CollectionTools.collection(getMapping().getPersistentAttribute().getTypeMapping().allAttributeMappings())) { @Override protected boolean accept(AttributeMapping o) { @@ -85,9 +83,7 @@ public class GenericJavaMapsIdDerivedIdentityStrategy2_0 if (CollectionTools.size(validAttributeMappings) == 1) { return validAttributeMappings.iterator().next().getName(); } - else { - return null; - } + return null; } protected void addAnnotation() { @@ -158,9 +154,7 @@ public class GenericJavaMapsIdDerivedIdentityStrategy2_0 if (StringTools.stringsAreEqual(o.getKey(), MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)) { return getEmbeddedIdMappingChoiceIterable((EmbeddedIdMapping) o); } - else { - return new SingleElementIterable(o); - } + return new SingleElementIterable<AttributeMapping>(o); } }; } @@ -168,13 +162,11 @@ public class GenericJavaMapsIdDerivedIdentityStrategy2_0 protected Iterable<AttributeMapping> getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping mapping) { Embeddable embeddable = mapping.getTargetEmbeddable(); if (embeddable == null) { - return new SingleElementIterable(mapping); + return new SingleElementIterable<AttributeMapping>(mapping); } - else { - return new CompositeIterable<AttributeMapping>( - mapping, - CollectionTools.collection(embeddable.allAttributeMappings())); - } + return new CompositeIterable<AttributeMapping>( + mapping, + CollectionTools.collection(embeddable.allAttributeMappings())); } public boolean isSpecified() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java index b390a08fbc..a24916a3e7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * 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. @@ -17,7 +17,7 @@ import org.eclipse.jpt.core.jpa2.context.MetamodelField; import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0; import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.utility.internal.ClassTools; +import org.eclipse.jpt.utility.internal.ClassName; /** * JPA 2.0 Java persistent attribute @@ -85,8 +85,8 @@ public class GenericJavaPersistentAttribute2_0 if (typeName == null) { return MetamodelField.DEFAULT_TYPE_NAME; } - if (ClassTools.classNamedIsPrimitive(typeName)) { - return ClassTools.wrapperClassName(typeName); // ??? + if (ClassName.isPrimitive(typeName)) { + return ClassName.getWrapperClassName(typeName); // ??? } return typeName; } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java index db52d48cf4..3600851036 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java @@ -1,13 +1,12 @@ /******************************************************************************* - * 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 - *******************************************************************************/ + * 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.core.internal.operations; import java.util.Iterator; @@ -348,7 +347,7 @@ public abstract class AbstractJpaFileCreationDataModelProvider } protected Iterator<IProject> jpaIProjects() { - return new FilteringIterator<IProject, IProject>(this.allIProjects(), this.buildJpaIProjectsFilter()); + return new FilteringIterator<IProject>(this.allIProjects(), this.buildJpaIProjectsFilter()); } protected Iterator<IProject> allIProjects() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java index 392396901d..1b3f027257 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * 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. @@ -17,6 +17,7 @@ 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; @@ -32,7 +33,7 @@ import org.eclipse.jpt.core.resource.java.Annotation; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.MethodSignature; -import org.eclipse.jpt.utility.internal.ClassTools; +import org.eclipse.jpt.utility.internal.ClassName; import org.eclipse.jpt.utility.internal.NameTools; import org.eclipse.jpt.utility.internal.iterators.CloneIterator; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -161,7 +162,7 @@ final class BinaryPersistentAttribute } public boolean typeIsVariablePrimitive() { - return (this.typeName != null) && ClassTools.classNamedIsVariablePrimitive(this.typeName); + return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName); } // ***** modifiers diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java index 41892b9c4f..e5f94a5084 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * 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. @@ -180,7 +180,7 @@ abstract class BinaryPersistentMember * convenience method */ <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) { - return new FilteringIterator<T, T>(members) { + return new FilteringIterator<T>(members) { @Override protected boolean accept(T m) { return m.isPersistable(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java index 4a8778a721..cc21a6e52e 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * 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. @@ -256,7 +256,7 @@ final class BinaryPersistentType } public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() { - return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(this.persistableFields()) { + return new FilteringIterator<JavaResourcePersistentAttribute>(this.persistableFields()) { @Override protected boolean accept(JavaResourcePersistentAttribute resourceAttribute) { return resourceAttribute.getSpecifiedAccess() == AccessType.FIELD; @@ -320,7 +320,7 @@ final class BinaryPersistentType } public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() { - return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(this.persistableProperties()) { + return new FilteringIterator<JavaResourcePersistentAttribute>(this.persistableProperties()) { @Override protected boolean accept(JavaResourcePersistentAttribute resourceAttribute) { return resourceAttribute.getSpecifiedAccess() == AccessType.PROPERTY; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java index fead1ebddb..35b2ce4a73 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -17,6 +17,7 @@ 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; @@ -32,7 +33,7 @@ import org.eclipse.jpt.core.utility.jdt.Attribute; import org.eclipse.jpt.core.utility.jdt.MethodAttribute; import org.eclipse.jpt.core.utility.jdt.Type; import org.eclipse.jpt.utility.MethodSignature; -import org.eclipse.jpt.utility.internal.ClassTools; +import org.eclipse.jpt.utility.internal.ClassName; import org.eclipse.jpt.utility.internal.iterators.CloneIterator; import org.eclipse.jpt.utility.internal.iterators.CloneListIterator; @@ -207,7 +208,7 @@ final class SourcePersistentAttribute } public boolean typeIsVariablePrimitive() { - return (this.typeName != null) && ClassTools.classNamedIsVariablePrimitive(this.typeName); + return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName); } private ITypeBinding getTypeBinding(CompilationUnit astRoot) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java index 6fc6b5b38c..443539d0f2 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -444,7 +444,7 @@ abstract class SourcePersistentMember<E extends Member> * convenience method */ <T extends JavaResourcePersistentMember> Iterator<T> persistableMembers(Iterator<T> members) { - return new FilteringIterator<T, T>(members) { + return new FilteringIterator<T>(members) { @Override protected boolean accept(T m) { return m.isPersistable(); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java index ad8f496833..92c06f41e7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * 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. @@ -466,7 +466,7 @@ final class SourcePersistentType } public Iterator<JavaResourcePersistentAttribute> persistableFieldsWithSpecifiedFieldAccess() { - return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(this.persistableFields()) { + return new FilteringIterator<JavaResourcePersistentAttribute>(this.persistableFields()) { @Override protected boolean accept(JavaResourcePersistentAttribute resourceAttribute) { return resourceAttribute.getSpecifiedAccess() == AccessType.FIELD; @@ -550,7 +550,7 @@ final class SourcePersistentType } public Iterator<JavaResourcePersistentAttribute> persistablePropertiesWithSpecifiedPropertyAccess() { - return new FilteringIterator<JavaResourcePersistentAttribute, JavaResourcePersistentAttribute>(this.persistableProperties()) { + return new FilteringIterator<JavaResourcePersistentAttribute>(this.persistableProperties()) { @Override protected boolean accept(JavaResourcePersistentAttribute resourceAttribute) { return resourceAttribute.getSpecifiedAccess() == AccessType.PROPERTY; diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTModifiedDeclaration.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTModifiedDeclaration.java index 2f6f82dab1..96f2c739e7 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTModifiedDeclaration.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/utility/jdt/JDTModifiedDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. + * Copyright (c) 2006, 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. @@ -30,6 +30,7 @@ import org.eclipse.jdt.core.dom.VariableDeclarationStatement; import org.eclipse.jpt.core.utility.jdt.ModifiedDeclaration; import org.eclipse.jpt.utility.internal.StringTools; import org.eclipse.jpt.utility.internal.iterators.FilteringIterator; +import org.eclipse.jpt.utility.internal.iterators.SubIteratorWrapper; /** * Wrap any of the AST nodes that have modifiers (specifically, annotations); @@ -125,7 +126,11 @@ public class JDTModifiedDeclaration * Return the declaration's annotations. */ protected Iterator<Annotation> annotations() { - return new FilteringIterator<IExtendedModifier, Annotation>(this.getModifiers().iterator()) { + return new SubIteratorWrapper<IExtendedModifier, Annotation>(this.annotations_()); + } + + protected Iterator<IExtendedModifier> annotations_() { + return new FilteringIterator<IExtendedModifier>(this.getModifiers().iterator()) { @Override protected boolean accept(IExtendedModifier next) { return next.isAnnotation(); |