Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2011-02-06 02:07:28 +0000
committerkmoore2011-02-06 02:07:28 +0000
commitc9c9e2b3e236ad701f642b72bca0cfabcac1d97b (patch)
tree346196323dc94395c2348339ac67e4f4cec6ebbf /jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java
parent8f2746f6b8c2ddc81d653d54d280043c41ed4734 (diff)
downloadwebtools.dali-c9c9e2b3e236ad701f642b72bca0cfabcac1d97b.tar.gz
webtools.dali-c9c9e2b3e236ad701f642b72bca0cfabcac1d97b.tar.xz
webtools.dali-c9c9e2b3e236ad701f642b72bca0cfabcac1d97b.zip
renamed org.eclipse.jpt.core to org.eclipse.jpt.jpa.core
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java
new file mode 100644
index 0000000000..4460a740a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.core.internal.context.java;
+
+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.DefaultJavaAttributeMappingDefinition;
+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;
+
+public abstract class AbstractJavaEmbeddedMappingDefinition
+ implements DefaultJavaAttributeMappingDefinition
+{
+ protected AbstractJavaEmbeddedMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return EmbeddedAnnotation.ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
+ AttributeOverrideAnnotation.ANNOTATION_NAME,
+ AttributeOverridesAnnotation.ANNOTATION_NAME,
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return factory.buildJavaEmbeddedMapping(persistentAttribute);
+ }
+
+ public boolean isDefault(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getEmbeddable() != null;
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}

Back to the top