Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java35
1 files changed, 12 insertions, 23 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java
index cbd658d5d1..3153d89b9c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java
@@ -745,36 +745,25 @@ public class JavaPersistentType extends JavaEObject implements IPersistentType
}
public JavaPersistentAttribute attributeNamed(String attributeName) {
- Iterator<JavaPersistentAttribute> attributes = attributesNamed(attributeName);
- if (attributes.hasNext()) {
- return attributes.next();
- }
- else {
- return null;
- }
+ Iterator<JavaPersistentAttribute> stream = attributesNamed(attributeName);
+ return (stream.hasNext()) ? stream.next() : null;
}
public IPersistentAttribute resolveAttribute(String attributeName) {
- Iterator<JavaPersistentAttribute> attributes = attributesNamed(attributeName);
- if (attributes.hasNext()) {
- JavaPersistentAttribute attribute = attributes.next();
- if (attributes.hasNext()) {
- // more than one
- return null;
- }
- else {
- return attribute;
- }
- }
- else if (parentPersistentType() != null) {
- return parentPersistentType().resolveAttribute(attributeName);
- }
- else {
- return null;
+ Iterator<JavaPersistentAttribute> stream = attributesNamed(attributeName);
+ if (stream.hasNext()) {
+ JavaPersistentAttribute attribute = stream.next();
+ return (stream.hasNext()) ? null /*more than one*/ : attribute;
}
+ return (parentPersistentType() == null) ? null : parentPersistentType().resolveAttribute(attributeName);
}
+ @Override
public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
Iterator<String> values = this.mapping.candidateValuesFor(pos, filter, astRoot);
if (values != null) {
return values;

Back to the top