Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jpa
diff options
context:
space:
mode:
authorBrian Vosburgh2015-12-08 18:55:51 +0000
committerBrian Vosburgh2015-12-08 18:55:51 +0000
commitde466117fa603c4a51b2ec1974ef990aef2350fc (patch)
treeec3a1669a8b11780d814f20a3db465da640f6713 /jpa
parentbfe53338e6aca78beee3476a7c122df41b933e3d (diff)
downloadwebtools.dali-de466117fa603c4a51b2ec1974ef990aef2350fc.tar.gz
webtools.dali-de466117fa603c4a51b2ec1974ef990aef2350fc.tar.xz
webtools.dali-de466117fa603c4a51b2ec1974ef990aef2350fc.zip
various minor changes (comments, generics, etc.)
Diffstat (limited to 'jpa')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java17
6 files changed, 37 insertions, 41 deletions
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 a733288c71..48971a997f 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -131,14 +131,14 @@ public interface PersistentType
/**
* Return the persistent type's "persistence" inheritance hierarchy,
* <em>including</em> the persistent type itself.
- * @see TypeMapping#getTypeMappingInheritanceHierarchy()
+ * @see TypeMapping#getInheritanceHierarchy()
*/
Iterable<PersistentType> getInheritanceHierarchy();
/**
* Return the persistent type's "persistence" inheritance hierarchy,
* <em>excluding</em> the persistent type itself.
- * @see TypeMapping#getAncesors()
+ * @see TypeMapping#getAncestors()
*/
Iterable<PersistentType> getAncestors();
@@ -162,7 +162,7 @@ public interface PersistentType
}
- // ********** parent interface **********
+ // ********** parent **********
interface Parent
extends JpaContextModel
@@ -178,7 +178,6 @@ public interface PersistentType
* <code>null</code> if there is no such access default.
*/
AccessType getDefaultPersistentTypeAccess();
-
}
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 d333c9935a..c68ec2e108 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -649,7 +649,7 @@ public abstract class AbstractJavaPersistentAttribute
protected abstract JpaValidator buildAttributeValidator();
/**
- * If the attribute's owning type is an <code>orm.xml</code> persistent
+ * If the attribute's declaring type is an <code>orm.xml</code> persistent
* type, the attribute must be one of the type's default attributes.
* (Actually, the Java attribute is held by a <em>virtual</em>
* <code>orm.xml</code> attribute
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 ee47c331c5..c640846df5 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
@@ -58,16 +58,16 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
*/
public abstract class AbstractJavaPersistentType
extends AbstractJavaManagedType<PersistentType.Parent>
- implements JavaPersistentType {
-
+ implements JavaPersistentType
+{
protected AccessType specifiedAccess;
protected AccessType defaultAccess; // never null
protected JavaTypeMapping mapping; // never null
- protected final Vector<JavaSpecifiedPersistentAttribute> attributes = new Vector<JavaSpecifiedPersistentAttribute>();
+ protected final Vector<JavaSpecifiedPersistentAttribute> attributes = new Vector<>();
- protected final Vector<JavaSpecifiedPersistentAttribute> structureChildren = new Vector<JavaSpecifiedPersistentAttribute>();
+ protected final Vector<JavaSpecifiedPersistentAttribute> structureChildren = new Vector<>();
protected AbstractJavaPersistentType(PersistentType.Parent parent, JavaResourceType resourceType) {
@@ -103,7 +103,7 @@ public abstract class AbstractJavaPersistentType
}
- // ***** inheritance *****
+ // ********** inheritance **********
public PersistentType getSuperPersistentType() {
TypeMapping superTypeMapping = this.mapping.getSuperTypeMapping();
@@ -175,7 +175,7 @@ public abstract class AbstractJavaPersistentType
* Check the access "specified" by the Java resource model:<ul>
* <li>Check Java annotations first
* <li>If <code>null</code>, check XML mapping specified access
- * <li>If still <code>null</code>, check {@link #superPersistentType} access
+ * <li>If still <code>null</code>, check {@link #getSuperPersistentType()} access
* <li>If still <code>null</code>, check <code>entity-mappings</code>
* specified access setting if the corresponding <code>persistent-type</code>
* is listed in a mapping (<code>orm.xml</code>) file
@@ -194,8 +194,9 @@ public abstract class AbstractJavaPersistentType
return accessType;
}
- if (getSuperPersistentType() != null) {
- accessType = getSuperPersistentType().getAccess();
+ PersistentType superType = this.getSuperPersistentType();
+ if (superType != null) {
+ accessType = superType.getAccess();
if (accessType != null) {
return accessType;
}
@@ -380,7 +381,8 @@ public abstract class AbstractJavaPersistentType
return stream.hasNext() ? null : attribute;
}
// recurse
- return (getSuperPersistentType() == null) ? null : getSuperPersistentType().resolveAttribute(attributeName);
+ PersistentType superType = this.getSuperPersistentType();
+ return (superType == null) ? null : superType.resolveAttribute(attributeName);
}
protected Iterable<String> convertToNames(Iterable<? extends PersistentAttribute> attrs) {
@@ -654,11 +656,11 @@ public abstract class AbstractJavaPersistentType
// ********** inheritance **********
public Iterable<PersistentType> getInheritanceHierarchy() {
- return IterableTools.insert(this, getAncestors());
+ return IterableTools.insert(this, this.getAncestors());
}
public Iterable<PersistentType> getAncestors() {
- return IterableTools.transform(getMapping().getAncestors(), TypeMapping.PERSISTENT_TYPE_TRANSFORMER);
+ return IterableTools.transform(this.getMapping().getAncestors(), TypeMapping.PERSISTENT_TYPE_TRANSFORMER);
}
protected Iterable<JavaResourceType> getResourceInheritanceHierarchy() {
@@ -671,10 +673,10 @@ public abstract class AbstractJavaPersistentType
* Transform a Java resource type into its super Java resource type.
*/
protected class SuperJavaResourceTypeTransformer
- extends TransformerAdapter<JavaResourceType, JavaResourceType> {
-
+ extends TransformerAdapter<JavaResourceType, JavaResourceType>
+ {
// keep track of visited resource types to prevent cyclical inheritance
- private final HashSet<JavaResourceType> visitedResourceTypes = new HashSet<JavaResourceType>();
+ private final HashSet<JavaResourceType> visitedResourceTypes = new HashSet<>();
@Override
public JavaResourceType transform(JavaResourceType jrt) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
index ed3c32f4cb..705eabd83c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
@@ -88,16 +88,16 @@ public abstract class SpecifiedOrmPersistentType
protected AccessType specifiedAccess;
protected AccessType defaultAccess; // never null
- protected final Vector<OrmSpecifiedPersistentAttribute> specifiedAttributes = new Vector<OrmSpecifiedPersistentAttribute>();
+ protected final Vector<OrmSpecifiedPersistentAttribute> specifiedAttributes = new Vector<>();
protected final SpecifiedAttributeContainerAdapter specifiedAttributeContainerAdapter = new SpecifiedAttributeContainerAdapter();
- protected final Vector<OrmPersistentAttribute> defaultAttributes = new Vector<OrmPersistentAttribute>();
+ protected final Vector<OrmPersistentAttribute> defaultAttributes = new Vector<>();
protected String declaringTypeName;
protected final MetamodelSourceType2_0.Synchronizer metamodelSynchronizer;
- protected final Vector<OrmPersistentAttribute> structureChildren = new Vector<OrmPersistentAttribute>();
+ protected final Vector<OrmPersistentAttribute> structureChildren = new Vector<>();
protected SpecifiedOrmPersistentType(EntityMappings parent, XmlTypeMapping xmlTypeMapping) {
@@ -493,7 +493,7 @@ public abstract class SpecifiedOrmPersistentType
}
protected ListIterable<OrmPersistentAttribute> getReadOnlySpecifiedAttributes() {
- return new SuperListIterableWrapper<OrmPersistentAttribute>(this.getSpecifiedAttributes());
+ return new SuperListIterableWrapper<>(this.getSpecifiedAttributes());
}
public int getSpecifiedAttributesSize() {
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 9c4390fc0a..8c0608a067 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -170,7 +170,8 @@ public class VirtualOrmPersistentAttribute
}
protected JavaSpecifiedPersistentAttribute buildAnnotatedJavaAttribute() {
- return this.buildJavaAttribute(this.javaAccessor);
+ // pass in the orm persistent type as the parent...
+ return this.getJpaFactory().buildJavaPersistentAttribute(this.getDeclaringPersistentType(), this.javaAccessor);
}
protected JavaSpecifiedPersistentAttribute getUnannotatedJavaAttribute() {
@@ -185,11 +186,6 @@ public class VirtualOrmPersistentAttribute
return this.javaAccessor.buildUnannotatedJavaAttribute(this.getDeclaringPersistentType());
}
- protected JavaSpecifiedPersistentAttribute buildJavaAttribute(Accessor accessor) {
- // pass in the orm persistent type as the parent...
- return this.getJpaFactory().buildJavaPersistentAttribute(this.getDeclaringPersistentType(), accessor);
- }
-
protected void syncLocalJavaAttributes() {
this.annotatedJavaAttribute.synchronizeWithResourceModel();
if (this.unannotatedJavaAttribute != null) {
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java
index 73f7857221..cd634bdbe7 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2015 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* 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,25 +16,24 @@ import org.eclipse.jpt.common.core.tests.internal.projects.JavaProjectTestHarnes
import org.eclipse.jpt.common.utility.internal.iterator.IteratorTools;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.IdMapping;
-import org.eclipse.jpt.jpa.core.context.SpecifiedJoinColumn;
-import org.eclipse.jpt.jpa.core.context.SpecifiedJoinTable;
import org.eclipse.jpt.jpa.core.context.ManyToManyMapping;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.SpecifiedJoinColumn;
+import org.eclipse.jpt.jpa.core.context.SpecifiedJoinTable;
import org.eclipse.jpt.jpa.core.context.SpecifiedUniqueConstraint;
import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaSpecifiedJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaSpecifiedJoinTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaSpecifiedPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
+import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmSpecifiedJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmSpecifiedJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmSpecifiedPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmSpecifiedUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.VirtualOrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
@@ -1210,7 +1209,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
assertFalse(uniqueConstraints.hasNext());
- OrmManyToManyMapping specifiedManyToManyMapping = (OrmManyToManyMapping) ((VirtualOrmPersistentAttribute) virtualAttribute).addToXml().getMapping();
+ OrmManyToManyMapping specifiedManyToManyMapping = (OrmManyToManyMapping) ((OrmPersistentAttribute) virtualAttribute).addToXml().getMapping();
assertEquals(0, specifiedManyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().getUniqueConstraintsSize());
}

Back to the top