diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource')
65 files changed, 0 insertions, 5625 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java deleted file mode 100644 index 0e3e95e81d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAccess2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAccess2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.Access - */ -public final class Access2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new Access2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private Access2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceAccess2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullAccess2_0Annotation((JavaResourcePersistentMember) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAccess2_0Annotation((JavaResourcePersistentMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return Access2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java deleted file mode 100644 index 12d1fe772f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.AssociationOverride - */ -public final class AssociationOverride2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new AssociationOverride2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private AssociationOverride2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceAssociationOverride2_0Annotation.buildAssociationOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAssociationOverride2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return AssociationOverrideAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java deleted file mode 100644 index 87eaa59f93..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverrides2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverrides2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.AssociationOverrides - */ -public final class AssociationOverrides2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new AssociationOverrides2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private AssociationOverrides2_0AnnotationDefinition() { - super(); - } - - public AssociationOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceAssociationOverrides2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public AssociationOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAssociationOverrides2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return AssociationOverridesAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java deleted file mode 100644 index 0e99636386..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Cacheable - */ -public final class Cacheable2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new Cacheable2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private Cacheable2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceCacheable2_0Annotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryCacheable2_0Annotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return Cacheable2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java deleted file mode 100644 index 34710f0028..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.CollectionTable - */ -public final class CollectionTable2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new CollectionTable2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private CollectionTable2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceCollectionTable2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullCollectionTable2_0Annotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryCollectionTable2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return CollectionTable2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java deleted file mode 100644 index 3d99fe6c92..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.ElementCollection - */ -public final class ElementCollection2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new ElementCollection2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ElementCollection2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ElementCollection2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java deleted file mode 100644 index 5b897d1620..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryGeneratedAnnotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceGeneratedAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.annotation.Generated - * <p> - * This annotation definition is not really required; it's just here for a bit - * of consistency.... - */ -public final class GeneratedAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final GeneratedAnnotationDefinition INSTANCE = new GeneratedAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static GeneratedAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private GeneratedAnnotationDefinition() { - super(); - } - - public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceGeneratedAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public GeneratedAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryGeneratedAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return GeneratedAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java deleted file mode 100644 index 37b7e18382..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyClass - */ -public final class MapKeyClass2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyClass2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyClass2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyClass2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyClass2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyClass2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java deleted file mode 100644 index 53a40c8fcf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyColumn - */ -public final class MapKeyColumn2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyColumn2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyColumn2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyColumn2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullMapKeyColumnAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyColumn2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyColumn2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java deleted file mode 100644 index 6ba277bdc2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class MapKeyEnumerated2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyEnumerated2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyEnumerated2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java deleted file mode 100644 index c943113e00..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; - -/** - * javax.persistence.MapKeyJoinColumn - */ -public final class MapKeyJoinColumn2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyJoinColumn2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyJoinColumn2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceMapKeyJoinColumn2_0Annotation.createMapKeyJoinColumn(parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyJoinColumn2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java deleted file mode 100644 index 23ddfdc204..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyJoinColumns - */ -public final class MapKeyJoinColumns2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyJoinColumns2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyJoinColumns2_0AnnotationDefinition() { - super(); - } - - public MapKeyJoinColumns2_0Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyJoinColumns2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public MapKeyJoinColumns2_0Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyJoinColumns2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java deleted file mode 100644 index 4539b09588..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class MapKeyTemporal2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyTemporal2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyTemporal2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyTemporal2_0Annotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java deleted file mode 100644 index a597251aee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.MapsId - */ -public class MapsId2_0AnnotationDefinition implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapsId2_0AnnotationDefinition(); - - - /** - * Return the singleton - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private MapsId2_0AnnotationDefinition() { - super(); - } - - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapsId2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullMapsId2_0Annotation((JavaResourcePersistentMember) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapsId2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapsId2_0Annotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java deleted file mode 100644 index 888cc8e2a8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQueries2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQueries2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation; - -/** - * javax.persistence.NamedQueries - */ -public class NamedQueries2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new NamedQueries2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NamedQueries2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedQueries2_0Annotation(parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedQueries2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return NamedQueriesAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java deleted file mode 100644 index 86ba2b97c6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; - -/** - * javax.persistence.NamedQuery - */ -public class NamedQuery2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new NamedQuery2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NamedQuery2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedQuery2_0Annotation(parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedQuery2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return NamedQueryAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java deleted file mode 100644 index 2aa8b84300..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AccessType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * <code>javax.persistence.Access</code> - */ -public final class NullAccess2_0Annotation - extends NullAnnotation<Access2_0Annotation> - implements Access2_0Annotation -{ - - protected NullAccess2_0Annotation(JavaResourcePersistentMember parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public AccessType getValue() { - return null; - } - - public void setValue(AccessType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java deleted file mode 100644 index 2393ed2dd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * <code>javax.persistence.JoinTable</code> found in a - * <code>javax.persistence.AssociationOverride</code> annotation - */ -public final class NullAssociationOverrideJoinTableAnnotation - extends NullJoinTableAnnotation -{ - public NullAssociationOverrideJoinTableAnnotation(AssociationOverride2_0Annotation parent) { - super(parent); - } - - private AssociationOverride2_0Annotation getAssociationOverride2_0Annotation() { - return (AssociationOverride2_0Annotation) this.parent; - } - - @Override - protected JoinTableAnnotation addAnnotation() { - return this.getAssociationOverride2_0Annotation().addJoinTable(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java deleted file mode 100644 index eba00c41e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseTableAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; - -/** - * <code>javax.persistence.CollectionTable</code> - */ -public final class NullCollectionTable2_0Annotation - extends NullBaseTableAnnotation<CollectionTable2_0Annotation> - implements CollectionTable2_0Annotation -{ - public NullCollectionTable2_0Annotation(JavaResourceNode parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** join columns - public ListIterator<JoinColumnAnnotation> joinColumns() { - return EmptyListIterator.instance(); - } - - public int joinColumnsSize() { - return 0; - } - - public JoinColumnAnnotation joinColumnAt(int index) { - return null; - } - - public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { - throw new UnsupportedOperationException(); - } - - public JoinColumnAnnotation addJoinColumn(int index) { - // the CollectionTable annotation is missing, add both it and a join column at the same time - return this.addAnnotation().addJoinColumn(index); - } - - public void moveJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeJoinColumn(int index) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java deleted file mode 100644 index 6a4b869bbe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * <code>javax.persistence.MapKeyColumn</code> - */ -public final class NullMapKeyColumnAnnotation - extends NullBaseColumnAnnotation<MapKeyColumn2_0Annotation> - implements MapKeyColumn2_0Annotation -{ - public NullMapKeyColumnAnnotation(JavaResourceNode parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** length - public Integer getLength() { - return null; - } - - public void setLength(Integer length) { - if (length != null) { - this.addAnnotation().setLength(length); - } - } - - public TextRange getLengthTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** scale - public Integer getScale() { - return null; - } - - public void setScale(Integer scale) { - if (scale != null) { - this.addAnnotation().setScale(scale); - } - } - - public TextRange getScaleTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** precision - public Integer getPrecision() { - return null; - } - - public void setPrecision(Integer precision) { - if (precision != null) { - this.addAnnotation().setPrecision(precision); - } - } - - public TextRange getPrecisionTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java deleted file mode 100644 index c9eaf62795..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.EnumType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * <code>javax.persistence.MapKeyEnumerated</code> - */ -public final class NullMapKeyEnumerated2_0Annotation - extends NullAnnotation<MapKeyEnumerated2_0Annotation> - implements MapKeyEnumerated2_0Annotation -{ - protected NullMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public EnumType getValue() { - return null; - } - - public void setValue(EnumType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java deleted file mode 100644 index 2a8a676aba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.TemporalType; - -/** - * <code>javax.persistence.MapKeyTemporal</code> - */ -public final class NullMapKeyTemporal2_0Annotation - extends NullAnnotation<MapKeyTemporal2_0Annotation> - implements MapKeyTemporal2_0Annotation -{ - protected NullMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public TemporalType getValue() { - return null; - } - - public void setValue(TemporalType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java deleted file mode 100644 index 0dcf181809..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * <code>javax.persistence.MapsId</code> - */ -public final class NullMapsId2_0Annotation - extends NullAnnotation<MapsId2_0Annotation> - implements MapsId2_0Annotation -{ - protected NullMapsId2_0Annotation(JavaResourcePersistentMember parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public String getValue() { - return null; - } - - public void setValue(String newValue) { - if (newValue != null) { - this.addAnnotation().setValue(newValue); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean valueTouches(int pos, CompilationUnit astRoot) { - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java deleted file mode 100644 index ca2a7b5123..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullNamedColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * <code>javax.persistence.OrderColumn</code> - */ -public final class NullOrderColumn2_0Annotation - extends NullNamedColumnAnnotation<OrderColumn2_0Annotation> - implements OrderColumn2_0Annotation -{ - public NullOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** updatable - public Boolean getUpdatable() { - return null; - } - - public void setUpdatable(Boolean updatable) { - if (updatable != null) { - this.addAnnotation().setUpdatable(updatable); - } - } - - public TextRange getUpdatableTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** insertable - public Boolean getInsertable() { - return null; - } - - public void setInsertable(Boolean insertable) { - if (insertable != null) { - this.addAnnotation().setInsertable(insertable); - } - } - - public TextRange getInsertableTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** nullable - public Boolean getNullable() { - return null; - } - - public void setNullable(Boolean nullable) { - if (nullable != null) { - this.addAnnotation().setNullable(nullable); - } - } - - public TextRange getNullableTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java deleted file mode 100644 index 91ff5ae6fc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryOrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceOrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.OrderColumn - */ -public final class OrderColumn2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new OrderColumn2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrderColumn2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return OrderColumn2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java deleted file mode 100644 index 513678f78d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinarySequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceSequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; - -/** - * javax.persistence.SequenceGenerator - */ -public final class SequenceGenerator2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new SequenceGenerator2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private SequenceGenerator2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceSequenceGenerator2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinarySequenceGenerator2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return SequenceGeneratorAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java deleted file mode 100644 index 1d1d2289a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * <code>javax.persistence.MapKeyJoinColumn</code> - */ -public final class SourceMapKeyJoinColumn2_0Annotation - extends SourceBaseJoinColumnAnnotation - implements NestableMapKeyJoinColumnAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - } - - public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) { - this(parent, attribute, daa, new ElementAnnotationAdapter(attribute, daa)); - } - - public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, IndexedDeclarationAnnotationAdapter idaa) { - this(parent, attribute, idaa, new ElementIndexedAnnotationAdapter(attribute, idaa)); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ********** SourceNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION; - } - - - // ********** SourceBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE; - } - - - // ********** SourceBaseJoinColumnAnnotation implementation ********** - - @Override - protected String getReferencedColumnNameElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME; - } - - - // ********** static methods ********** - - public static SourceMapKeyJoinColumn2_0Annotation createMapKeyJoinColumn(JavaResourceNode parent, Attribute attribute) { - return new SourceMapKeyJoinColumn2_0Annotation(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - static SourceMapKeyJoinColumn2_0Annotation createNestedMapKeyJoinColumn(JavaResourceNode parent, Attribute attribute, int index, DeclarationAnnotationAdapter joinColumnsAdapter) { - IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter, ANNOTATION_NAME); - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(attribute, idaa); - return new SourceMapKeyJoinColumn2_0Annotation(parent, attribute, idaa, annotationAdapter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java deleted file mode 100644 index c538288cb1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import java.util.Vector; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; - -/** - * <code>javax.persistence.MapKeyJoinColumns</code> - */ -public final class SourceMapKeyJoinColumns2_0Annotation - extends SourceAnnotation<Attribute> - implements MapKeyJoinColumns2_0Annotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final Vector<NestableMapKeyJoinColumnAnnotation> mapKeyJoinColumns = new Vector<NestableMapKeyJoinColumnAnnotation>(); - - - public SourceMapKeyJoinColumns2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - AnnotationContainerTools.initialize(this, astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - AnnotationContainerTools.synchronize(this, astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - this.mapKeyJoinColumns.isEmpty(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.mapKeyJoinColumns); - } - - - // ********** AnnotationContainer implementation ********** - - public String getElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE; - } - - public String getNestedAnnotationName() { - return MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME; - } - - public Iterable<NestableMapKeyJoinColumnAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestableMapKeyJoinColumnAnnotation>(this.mapKeyJoinColumns); - } - - public int getNestedAnnotationsSize() { - return this.mapKeyJoinColumns.size(); - } - - public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) { - this.nestStandAloneAnnotation(standAloneAnnotation, this.mapKeyJoinColumns.size()); - } - - private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) { - standAloneAnnotation.convertToNested(this, this.daa, index); - } - - public void addNestedAnnotation(int index, NestableAnnotation annotation) { - this.mapKeyJoinColumns.add(index, (NestableMapKeyJoinColumnAnnotation) annotation); - } - - public void convertLastNestedAnnotationToStandAlone() { - this.mapKeyJoinColumns.remove(0).convertToStandAlone(); - } - - public NestableMapKeyJoinColumnAnnotation addNestedAnnotation() { - return this.addNestedAnnotation(this.mapKeyJoinColumns.size()); - } - - private NestableMapKeyJoinColumnAnnotation addNestedAnnotation(int index) { - NestableMapKeyJoinColumnAnnotation joinColumn = this.buildMapKeyJoinColumn(index); - this.mapKeyJoinColumns.add(index, joinColumn); - return joinColumn; - } - - public void syncAddNestedAnnotation(Annotation astAnnotation) { - int index = this.mapKeyJoinColumns.size(); - NestableMapKeyJoinColumnAnnotation joinColumn = this.addNestedAnnotation(index); - joinColumn.initialize((CompilationUnit) astAnnotation.getRoot()); - this.fireItemAdded(MAP_KEY_JOIN_COLUMNS_LIST, index, joinColumn); - } - - private NestableMapKeyJoinColumnAnnotation buildMapKeyJoinColumn(int index) { - // pass the Java resource persistent member as the nested annotation's parent - // since the nested annotation can be converted to stand-alone - return SourceMapKeyJoinColumn2_0Annotation.createNestedMapKeyJoinColumn(this.parent, this.annotatedElement, index, this.daa); - } - - public NestableMapKeyJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) { - return CollectionTools.move(this.mapKeyJoinColumns, targetIndex, sourceIndex).get(targetIndex); - } - - public NestableMapKeyJoinColumnAnnotation removeNestedAnnotation(int index) { - return this.mapKeyJoinColumns.remove(index); - } - - public void syncRemoveNestedAnnotations(int index) { - this.removeItemsFromList(index, this.mapKeyJoinColumns, MAP_KEY_JOIN_COLUMNS_LIST); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java deleted file mode 100644 index b88a0b18bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryStaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceStaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.metamodel.StaticMetamodel - * <p> - * This annotation definition is not really required; it's just here for a bit - * of consistency.... - */ -public final class StaticMetamodelAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final StaticMetamodelAnnotationDefinition INSTANCE = new StaticMetamodelAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static StaticMetamodelAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private StaticMetamodelAnnotationDefinition() { - super(); - } - - public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceStaticMetamodelAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public StaticMetamodelAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryStaticMetamodelAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return StaticMetamodelAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java deleted file mode 100644 index ee01d96507..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.AccessType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.Access - */ -public final class BinaryAccess2_0Annotation - extends BinaryAnnotation - implements Access2_0Annotation -{ - private AccessType value; - - - public BinaryAccess2_0Annotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** AccessAnnotation implementation ********** - - // ***** value - public AccessType getValue() { - return this.value; - } - - public void setValue(AccessType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(AccessType value) { - AccessType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private AccessType buildValue() { - return AccessType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ACCESS)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java deleted file mode 100644 index eb213548d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * BinarySequenceGenerator2_0Annotation - */ -public final class BinaryAssociationOverride2_0Annotation - extends BinaryAssociationOverrideAnnotation - implements AssociationOverride2_0Annotation -{ - private JoinTableAnnotation joinTable; - private final JoinTableAnnotation nullJoinTable; - - public BinaryAssociationOverride2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.joinTable = this.buildJoinTable(); - this.nullJoinTable = this.buildNullJoinTable(); - } - - @Override - public void update() { - super.update(); - this.updateJoinTable(); - } - - - // ********** AssociationOverride2_0Annotation implementation ********** - - // ***** joinTable - public JoinTableAnnotation getJoinTable() { - return this.joinTable; - } - - public JoinTableAnnotation getNonNullJoinTable() { - return (this.joinTable != null) ? this.joinTable : this.nullJoinTable; - } - - public JoinTableAnnotation addJoinTable() { - throw new UnsupportedOperationException(); - } - - public void removeJoinTable() { - throw new UnsupportedOperationException(); - } - - private JoinTableAnnotation buildJoinTable() { - IAnnotation jdtJoinTable = this.getJdtJoinTable(); - return (jdtJoinTable == null) ? null : this.buildJoinTable(jdtJoinTable); - } - - private JoinTableAnnotation buildNullJoinTable() { - return new NullJoinTableAnnotation(this); - } - - private JoinTableAnnotation buildJoinTable(IAnnotation jdtJoinTable) { - return new BinaryJoinTableAnnotation(this, jdtJoinTable); - } - - private IAnnotation getJdtJoinTable() { - return (IAnnotation) this.getJdtMemberValue(JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE); - } - - // TODO - private void updateJoinTable() { - throw new UnsupportedOperationException(); -// IAnnotation jdtJoinTable = this.getJdtJoinTable(); -// if (jdtJoinTable == null) { -// this.setJoinTable(null); -// } else { -// if (this.column == null) { -// this.setJoinTable(this.buildJoinTable(jdtJoinTable)); -// } else { -// this.column.update(jdtJoinTable); -// } -// } - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java deleted file mode 100644 index e2877de83d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation; - -/** - * javax.persistence.AssociationOverrides - */ -public class BinaryAssociationOverrides2_0Annotation - extends BinaryAssociationOverridesAnnotation -{ - - public BinaryAssociationOverrides2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - @Override - protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) { - return new BinaryAssociationOverride2_0Annotation(this, (IAnnotation) jdtAssociationOverride); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java deleted file mode 100644 index 3702c2ec5f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Cacheable - */ -public final class BinaryCacheable2_0Annotation - extends BinaryAnnotation - implements Cacheable2_0Annotation -{ - private Boolean value; - - - public BinaryCacheable2_0Annotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** Cacheable2_0Annotation implementation ********** - - // ***** value - public Boolean getValue() { - return this.value; - } - - public void setValue(Boolean value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(Boolean value) { - Boolean old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private Boolean buildValue() { - return (Boolean) this.getJdtMemberValue(JPA2_0.CACHEABLE__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java deleted file mode 100644 index 324ac63515..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; - -/** - * javax.persistence.CollectionTable - */ -public final class BinaryCollectionTable2_0Annotation - extends BinaryBaseTableAnnotation - implements CollectionTable2_0Annotation -{ - private final Vector<JoinColumnAnnotation> joinColumns; - - - public BinaryCollectionTable2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.joinColumns = this.buildJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateJoinColumns(); - } - - - // ********** BinaryBaseTableAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.COLLECTION_TABLE__NAME; - } - - @Override - protected String getSchemaElementName() { - return JPA2_0.COLLECTION_TABLE__SCHEMA; - } - - @Override - protected String getCatalogElementName() { - return JPA2_0.COLLECTION_TABLE__CATALOG; - } - - @Override - protected String getUniqueConstraintElementName() { - return JPA2_0.COLLECTION_TABLE__UNIQUE_CONSTRAINTS; - } - - - // ********** CollectionTable2_0Annotation implementation ********** - - // ***** join columns - public ListIterator<JoinColumnAnnotation> joinColumns() { - return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns); - } - - public int joinColumnsSize() { - return this.joinColumns.size(); - } - - public JoinColumnAnnotation joinColumnAt(int index) { - return this.joinColumns.get(index); - } - - public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { - return this.joinColumns.indexOf(joinColumn); - } - - public JoinColumnAnnotation addJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void moveJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - private Vector<JoinColumnAnnotation> buildJoinColumns() { - Object[] jdtJoinColumns = this.getJdtMemberValues(JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS); - Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length); - for (Object jdtJoinColumn : jdtJoinColumns) { - result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn)); - } - return result; - } - - // TODO - private void updateJoinColumns() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java deleted file mode 100644 index b4774b3c3c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * org.eclipse.persistence.annotations.Transformation - */ -public class BinaryElementCollection2_0Annotation - extends BinaryAnnotation - implements ElementCollection2_0Annotation -{ - private String targetClass; - private FetchType fetch; - - - public BinaryElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.targetClass = this.buildTargetClass(); - this.fetch = this.buildFetch(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setTargetClass_(this.buildTargetClass()); - this.setFetch_(this.buildFetch()); - } - - - // ********** ElementCollection2_0Annotation implementation ********** - - // ***** target entity - public String getTargetClass() { - return this.targetClass; - } - - public void setTargetClass(String targetClass) { - throw new UnsupportedOperationException(); - } - - private void setTargetClass_(String targetClass) { - String old = this.targetClass; - this.targetClass = targetClass; - this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, targetClass); - } - - private String buildTargetClass() { - return (String) this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS); - } - - public TextRange getTargetClassTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified target entity class name - public String getFullyQualifiedTargetClassName() { - return this.targetClass; - } - - // ***** fetch - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType fetch) { - throw new UnsupportedOperationException(); - } - - private void setFetch_(FetchType fetch) { - FetchType old = this.fetch; - this.fetch = fetch; - this.firePropertyChanged(FETCH_PROPERTY, old, fetch); - } - - private FetchType buildFetch() { - return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__FETCH)); - } - - public TextRange getFetchTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java deleted file mode 100644 index 798b809e9e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.annotation.Generated - */ -public final class BinaryGeneratedAnnotation - extends BinaryAnnotation - implements GeneratedAnnotation -{ - private final Vector<String> values; - private String date; - private String comments; - - - public BinaryGeneratedAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.values = this.buildValues(); - this.date = this.buildDate(); - this.comments = this.buildComments(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateValues(); - this.setDate_(this.buildDate()); - this.setComments_(this.buildComments()); - } - - // TODO - private void updateValues() { - throw new UnsupportedOperationException(); - } - - - // ********** GeneratedAnnotation implementation ********** - - // ***** values - public ListIterator<String> values() { - return new CloneListIterator<String>(this.values); - } - - public int valuesSize() { - return this.values.size(); - } - - public String getValue(int index) { - return this.values.get(index); - } - - private Vector<String> buildValues() { - Object[] jdtValues = this.getJdtMemberValues(VALUE_ELEMENT_NAME); - Vector<String> result = new Vector<String>(jdtValues.length); - for (Object value : jdtValues) { - result.add((String) value); - } - return result; - } - - public void addValue(String value) { - throw new UnsupportedOperationException(); - } - - public void addValue(int index, String value) { - throw new UnsupportedOperationException(); - } - - public void moveValue(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeValue(String value) { - throw new UnsupportedOperationException(); - } - - public void removeValue(int index) { - throw new UnsupportedOperationException(); - } - - // ***** date - public String getDate() { - return this.date; - } - - public void setDate(String date) { - throw new UnsupportedOperationException(); - } - - private void setDate_(String date) { - String old = this.date; - this.date = date; - this.firePropertyChanged(DATE_PROPERTY, old, date); - } - - private String buildDate() { - return (String) this.getJdtMemberValue(DATE_ELEMENT_NAME); - } - - // ***** comments - public String getComments() { - return this.comments; - } - - public void setComments(String comments) { - throw new UnsupportedOperationException(); - } - - private void setComments_(String comments) { - String old = this.comments; - this.comments = comments; - this.firePropertyChanged(COMMENTS_PROPERTY, old, comments); - } - - private String buildComments() { - return (String) this.getJdtMemberValue(COMMENTS_ELEMENT_NAME); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java deleted file mode 100644 index e20a405b5c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyClass - */ -public final class BinaryMapKeyClass2_0Annotation - extends BinaryAnnotation - implements MapKeyClass2_0Annotation -{ - private String value; - - - public BinaryMapKeyClass2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** MapKeyClass2_0Annotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA2_0.MAP_KEY_CLASS__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified class name - /** - * binary is already fully-qualified - */ - public String getFullyQualifiedClassName() { - return this.value; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java deleted file mode 100644 index f2a2415614..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryCompleteColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyColumn - */ -public final class BinaryMapKeyColumn2_0Annotation - extends BinaryCompleteColumnAnnotation - implements MapKeyColumn2_0Annotation -{ - - public BinaryMapKeyColumn2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.MAP_KEY_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.MAP_KEY_COLUMN__COLUMN_DEFINITION; - } - - - // ********** BinaryBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA2_0.MAP_KEY_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA2_0.MAP_KEY_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA2_0.MAP_KEY_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA2_0.MAP_KEY_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA2_0.MAP_KEY_COLUMN__UPDATABLE; - } - - - // ********** BinaryCompleteColumnAnnotation implementation ********** - - @Override - protected String getLengthElementName() { - return JPA2_0.MAP_KEY_COLUMN__LENGTH; - } - - @Override - protected String getPrecisionElementName() { - return JPA2_0.MAP_KEY_COLUMN__PRECISION; - } - - @Override - protected String getScaleElementName() { - return JPA2_0.MAP_KEY_COLUMN__SCALE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java deleted file mode 100644 index 39f3229e74..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseEnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyEnumerated - */ -public final class BinaryMapKeyEnumerated2_0Annotation - extends BinaryBaseEnumeratedAnnotation - implements MapKeyEnumerated2_0Annotation -{ - - public BinaryMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA2_0.MAP_KEY_ENUMERATED__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java deleted file mode 100644 index c4d25d3ed2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.MapKeyJoinColumn - */ -public final class BinaryMapKeyJoinColumn2_0Annotation - extends BinaryBaseJoinColumnAnnotation - implements NestableMapKeyJoinColumnAnnotation -{ - - public BinaryMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION; - } - - - // ********** BinaryBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE; - } - - - // ********** BinaryBaseJoinColumnAnnotation implementation ********** - - @Override - protected String getReferencedColumnNameElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java deleted file mode 100644 index 2622efab7c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryContainerAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyJoinColumns - */ -public final class BinaryMapKeyJoinColumns2_0Annotation - extends BinaryContainerAnnotation<NestableMapKeyJoinColumnAnnotation> - implements MapKeyJoinColumns2_0Annotation -{ - private final Vector<NestableMapKeyJoinColumnAnnotation> mapKeyJoinColumns; - - - public BinaryMapKeyJoinColumns2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.mapKeyJoinColumns = this.buildMapKeyJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable<NestableMapKeyJoinColumnAnnotation> getNestedAnnotations() { - return new LiveCloneIterable<NestableMapKeyJoinColumnAnnotation>(this.mapKeyJoinColumns); - } - - public int getNestedAnnotationsSize() { - return this.mapKeyJoinColumns.size(); - } - - private Vector<NestableMapKeyJoinColumnAnnotation> buildMapKeyJoinColumns() { - Object[] jdtMapKeyJoinColumns = this.getJdtMemberValues(JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE); - Vector<NestableMapKeyJoinColumnAnnotation> result = new Vector<NestableMapKeyJoinColumnAnnotation>(jdtMapKeyJoinColumns.length); - for (Object jdtMapKeyJoinColumn : jdtMapKeyJoinColumns) { - result.add(new BinaryMapKeyJoinColumn2_0Annotation(this, (IAnnotation) jdtMapKeyJoinColumn)); - } - return result; - } - - @Override - public void update() { - super.update(); - this.updateMapKeyJoinColumns(); - } - - // TODO - private void updateMapKeyJoinColumns() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java deleted file mode 100644 index 1c5b97b821..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTemporalAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class BinaryMapKeyTemporal2_0Annotation - extends BinaryBaseTemporalAnnotation - implements MapKeyTemporal2_0Annotation -{ - - public BinaryMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyTemporal2_0Annotation.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA2_0.MAP_KEY_TEMPORAL__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java deleted file mode 100644 index c7d7e03c05..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapsId - */ -public class BinaryMapsId2_0Annotation - extends BinaryAnnotation - implements MapsId2_0Annotation -{ - private String value; - - - public BinaryMapsId2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** MapsId2_0Annotation implementation ********** - - public String getValue() { - return this.value; - } - - public void setValue(String newValue) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String newValue) { - String oldValue = this.value; - this.value = newValue; - this.firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA2_0.MAPS_ID__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean valueTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java deleted file mode 100644 index b6270a6eb5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation; - -/** - * javax.persistence.NamedQueries - */ -public final class BinaryNamedQueries2_0Annotation - extends BinaryNamedQueriesAnnotation -{ - public BinaryNamedQueries2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - @Override - protected NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery) { - return new BinaryNamedQuery2_0Annotation(this, (IAnnotation) jdtQuery); - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java deleted file mode 100644 index 83e2f3e112..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * BinaryNamedQuery2_0Annotation - */ -public final class BinaryNamedQuery2_0Annotation - extends BinaryNamedQueryAnnotation - implements NamedQuery2_0Annotation -{ - private LockModeType_2_0 lockMode; - - public BinaryNamedQuery2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.lockMode = this.buildLockMode(); - } - - @Override - public void update() { - super.update(); - this.setLockMode_(this.buildLockMode()); - } - - // ********** NamedQuery2_0Annotation implementation ********** - - public LockModeType_2_0 getLockMode() { - return this.lockMode; - } - - public void setLockMode(LockModeType_2_0 lockMode) { - throw new UnsupportedOperationException(); - } - - private void setLockMode_(LockModeType_2_0 lockMode) { - LockModeType_2_0 old = this.lockMode; - this.lockMode = lockMode; - this.firePropertyChanged(LOCK_MODE_PROPERTY, old, lockMode); - } - - public TextRange getLockModeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean lockModeTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - private LockModeType_2_0 buildLockMode() { - return LockModeType_2_0.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.NAMED_QUERY__LOCK_MODE)); - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java deleted file mode 100644 index 446297a6a6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.OrderColumn - */ -public class BinaryOrderColumn2_0Annotation - extends BinaryNamedColumnAnnotation - implements OrderColumn2_0Annotation -{ - private Boolean nullable; - private Boolean insertable; - private Boolean updatable; - - - public BinaryOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.nullable = this.buildNullable(); - this.insertable = this.buildInsertable(); - this.updatable = this.buildUpdatable(); - } - - @Override - public void update() { - super.update(); - this.setNullable_(this.buildNullable()); - this.setInsertable_(this.buildInsertable()); - this.setUpdatable_(this.buildUpdatable()); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - //************* BinaryNamedColumnAnnotation implementation ************* - - @Override - protected String getColumnDefinitionElementName() { - return JPA.COLUMN__COLUMN_DEFINITION; - } - - @Override - protected String getNameElementName() { - return JPA.COLUMN__NAME; - } - - //************* OrderColumn2_0Annotation implementation ************* - - // ***** nullable - public Boolean getNullable() { - return this.nullable; - } - - public void setNullable(Boolean nullable) { - throw new UnsupportedOperationException(); - } - - private void setNullable_(Boolean nullable) { - Boolean old = this.nullable; - this.nullable = nullable; - this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable); - } - - private Boolean buildNullable() { - return (Boolean) this.getJdtMemberValue(getNullableElementName()); - } - - String getNullableElementName() { - return JPA.COLUMN__NULLABLE; - } - - public TextRange getNullableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** insertable - public Boolean getInsertable() { - return this.insertable; - } - - public void setInsertable(Boolean insertable) { - throw new UnsupportedOperationException(); - } - - private void setInsertable_(Boolean insertable) { - Boolean old = this.insertable; - this.insertable = insertable; - this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable); - } - - private Boolean buildInsertable() { - return (Boolean) this.getJdtMemberValue(this.getInsertableElementName()); - } - - String getInsertableElementName() { - return JPA.COLUMN__INSERTABLE; - } - - public TextRange getInsertableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** updatable - public Boolean getUpdatable() { - return this.updatable; - } - - public void setUpdatable(Boolean updatable) { - throw new UnsupportedOperationException(); - } - - private void setUpdatable_(Boolean updatable) { - Boolean old = this.updatable; - this.updatable = updatable; - this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable); - } - - private Boolean buildUpdatable() { - return (Boolean) this.getJdtMemberValue(this.getUpdatableElementName()); - } - - String getUpdatableElementName() { - return JPA.COLUMN__UPDATABLE; - } - - public TextRange getUpdatableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java deleted file mode 100644 index b9b94ad58d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * BinarySequenceGenerator2_0Annotation - */ -public final class BinarySequenceGenerator2_0Annotation - extends BinarySequenceGeneratorAnnotation - implements SequenceGenerator2_0Annotation -{ - private String catalog; - private String schema; - - - public BinarySequenceGenerator2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.catalog = this.buildCatalog(); - this.schema = this.buildSchema(); - } - - @Override - public void update() { - super.update(); - this.setCatalog_(this.buildCatalog()); - this.setSchema_(this.buildSchema()); - } - - // ********** SequenceGenerator2_0Annotation implementation ********** - - // ********** catalog ********** - - public String getCatalog() { - return this.catalog; - } - - public void setCatalog(String catalog) { - throw new UnsupportedOperationException(); - } - - private void setCatalog_(String catalog) { - String old = this.catalog; - this.catalog = catalog; - this.firePropertyChanged(CATALOG_PROPERTY, old, catalog); - } - - private String buildCatalog() { - return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__CATALOG); - } - - public TextRange getCatalogTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean catalogTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ********** schema ********** - - public String getSchema() { - return this.schema; - } - - public void setSchema(String schema) { - throw new UnsupportedOperationException(); - } - - private void setSchema_(String schema) { - String old = this.schema; - this.schema = schema; - this.firePropertyChanged(SCHEMA_PROPERTY, old, schema); - } - - private String buildSchema() { - return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__SCHEMA); - } - - public TextRange getSchemaTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean schemaTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java deleted file mode 100644 index 3f30009013..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.metamodel.StaticMetamodel - */ -public final class BinaryStaticMetamodelAnnotation - extends BinaryAnnotation - implements StaticMetamodelAnnotation -{ - private String value; - - - public BinaryStaticMetamodelAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** StaticMetamodelAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA2_0.STATIC_METAMODEL__VALUE); - } - - // ***** fully-qualified class name - /** - * binary is already fully-qualified - */ - public String getFullyQualifiedClassName() { - return this.value; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java deleted file mode 100644 index 4b8790b08b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.AccessType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.Access - */ -public final class SourceAccess2_0Annotation - extends SourceAnnotation<Member> - implements Access2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private AccessType value; - - - public SourceAccess2_0Annotation(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(member, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** AccessAnnotation implementation ********** - - // ***** value - public AccessType getValue() { - return this.value; - } - - public void setValue(AccessType value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(AccessType.toJavaAnnotationValue(value)); - } - } - - private void syncValue(AccessType astValue) { - AccessType old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private AccessType buildValue(CompilationUnit astRoot) { - return AccessType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ACCESS__VALUE); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java deleted file mode 100644 index 9ea428b84a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NullAssociationOverrideJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * <code>javax.persistence.AssociationOverride</code> - */ -public final class SourceAssociationOverride2_0Annotation - extends SourceAssociationOverrideAnnotation - implements AssociationOverride2_0Annotation -{ - private ElementAnnotationAdapter joinTableAdapter; - private JoinTableAnnotation joinTable; - private final JoinTableAnnotation nullJoinTable; - - - public SourceAssociationOverride2_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, member, daa, annotationAdapter); - this.joinTableAdapter = this.buildJoinTableAdapter(); - this.nullJoinTable = this.buildNullJoinTable(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - if (this.joinTableAdapter.getAnnotation(astRoot) != null) { - this.joinTable = buildJoinTableAnnotation(this, this.annotatedElement, this.daa); - this.joinTable.initialize(astRoot); - } - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncJoinTable(astRoot); - } - - - //************ AssociationOverride2_0Annotation implementation **************** - - // ***** joinTable - public JoinTableAnnotation getJoinTable() { - return this.joinTable; - } - - public JoinTableAnnotation getNonNullJoinTable() { - return (this.joinTable != null) ? this.joinTable : this.nullJoinTable; - } - - public JoinTableAnnotation addJoinTable() { - if (this.joinTable != null) { - throw new IllegalStateException("'joinTable' element already exists: " + this.joinTable); //$NON-NLS-1$ - } - this.joinTable = buildJoinTableAnnotation(this, this.annotatedElement, this.daa); - this.joinTable.newAnnotation(); - return this.joinTable; - } - - public void removeJoinTable() { - if (this.joinTable == null) { - throw new IllegalStateException("'joinTable' element does not exist"); //$NON-NLS-1$ - } - JoinTableAnnotation old = this.joinTable; - this.joinTable = null; - old.removeAnnotation(); - } - - private void syncJoinTable(CompilationUnit astRoot) { - if (this.joinTableAdapter.getAnnotation(astRoot) == null) { - this.syncJoinTable_(null); - } else { - if (this.joinTable == null) { - JoinTableAnnotation table = buildJoinTableAnnotation(this, this.annotatedElement, this.daa); - table.initialize(astRoot); - this.syncJoinTable_(table); - } else { - this.joinTable.synchronizeWith(astRoot); - } - } - } - - private void syncJoinTable_(JoinTableAnnotation astJoinTable) { - JoinTableAnnotation old = this.joinTable; - this.joinTable = astJoinTable; - this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, astJoinTable); - } - - private ElementAnnotationAdapter buildJoinTableAdapter() { - return new ElementAnnotationAdapter(this.annotatedElement, buildJoinTableAnnotationAdapter(this.daa)); - } - - private JoinTableAnnotation buildNullJoinTable() { - return new NullAssociationOverrideJoinTableAnnotation(this); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.joinTable == null); - } - - @Override - protected void rebuildAdapters() { - super.rebuildAdapters(); - this.joinTableAdapter = this.buildJoinTableAdapter(); - } - - @Override - public void storeOn(Map<String, Object> map) { - super.storeOn(map); - if (this.joinTable != null) { - Map<String, Object> joinTableState = new HashMap<String, Object>(); - this.joinTable.storeOn(joinTableState); - map.put(JOIN_TABLE_PROPERTY, joinTableState); - this.joinTable = null; - } - } - - @Override - public void restoreFrom(Map<String, Object> map) { - super.restoreFrom(map); - @SuppressWarnings("unchecked") - Map<String, Object> joinTableState = (Map<String, Object>) map.get(JOIN_TABLE_PROPERTY); - if (joinTableState != null) { - this.addJoinTable().restoreFrom(joinTableState); - } - } - - - // ********** static methods ********** - - public static SourceAssociationOverride2_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) { - return new SourceAssociationOverride2_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER)); - } - - static JoinTableAnnotation buildJoinTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) { - return new SourceJoinTableAnnotation(parent, member, buildJoinTableAnnotationAdapter(associationOverrideAnnotationAdapter)); - } - - static DeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) { - return new NestedDeclarationAnnotationAdapter(associationOverrideAnnotationAdapter, JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE, JPA.JOIN_TABLE); - } - - - static SourceAssociationOverrideAnnotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { - IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME); - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa); - return new SourceAssociationOverride2_0Annotation(parent, member, idaa, annotationAdapter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java deleted file mode 100644 index be45b19954..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation; - -/** - * <code>javax.persistence.AssociationOverrides</code> - */ -public final class SourceAssociationOverrides2_0Annotation - extends SourceAssociationOverridesAnnotation -{ - public SourceAssociationOverrides2_0Annotation(JavaResourceNode parent, Member member) { - super(parent, member); - } - - @Override - protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) { - // pass the Java resource persistent member as the nested annotation's parent - // since the nested annotation can be converted to stand-alone - return SourceAssociationOverride2_0Annotation.buildNestedAssociationOverride(this.parent, this.annotatedElement, index, this.daa); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java deleted file mode 100644 index f89f48edd4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Cacheable - */ -public final class SourceCacheable2_0Annotation - extends SourceAnnotation<Member> - implements Cacheable2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<Boolean> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<Boolean> valueAdapter; - private Boolean value; - - - public SourceCacheable2_0Annotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(type, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** Cacheable2_0Annotation implementation ********** - - // ***** value - public Boolean getValue() { - return this.value; - } - - public void setValue(Boolean value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(Boolean astValue) { - Boolean old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private Boolean buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<Boolean> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.CACHEABLE__VALUE, BooleanExpressionConverter.instance()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java deleted file mode 100644 index 8243f24a36..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.HashMap; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Vector; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation; - -/** - * <code>javax.persistence.CollectionTable</code> - */ -public final class SourceCollectionTable2_0Annotation - extends SourceBaseTableAnnotation - implements CollectionTable2_0Annotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(CollectionTable2_0Annotation.ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__NAME); - - private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__SCHEMA); - - private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__CATALOG); - - - private final Vector<NestableJoinColumnAnnotation> joinColumns = new Vector<NestableJoinColumnAnnotation>(); - private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer(); - - - public SourceCollectionTable2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - AnnotationContainerTools.synchronize(this.joinColumnsContainer, astRoot); - } - - - // ********** SourceBaseTableAnnotation implementation ********** - - @Override - protected DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() { - return NAME_ADAPTER; - } - - @Override - protected DeclarationAnnotationElementAdapter<String> buildSchemaDeclarationAdapter() { - return SCHEMA_ADAPTER; - } - - @Override - protected DeclarationAnnotationElementAdapter<String> buildCatalogDeclarationAdapter() { - return CATALOG_ADAPTER; - } - - @Override - protected String getUniqueConstraintsElementName() { - return JPA2_0.COLLECTION_TABLE__UNIQUE_CONSTRAINTS; - } - - // ********** CollectionTable2_0Annotation implementation ********** - - // ***** join columns - public ListIterator<JoinColumnAnnotation> joinColumns() { - return new CloneListIterator<JoinColumnAnnotation>(this.joinColumns); - } - - Iterable<NestableJoinColumnAnnotation> getNestableJoinColumns() { - return new LiveCloneIterable<NestableJoinColumnAnnotation>(this.joinColumns); - } - - public int joinColumnsSize() { - return this.joinColumns.size(); - } - - public NestableJoinColumnAnnotation joinColumnAt(int index) { - return this.joinColumns.get(index); - } - - public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { - return this.joinColumns.indexOf(joinColumn); - } - - private NestableJoinColumnAnnotation addJoinColumn() { - return this.addJoinColumn(this.joinColumns.size()); - } - - public NestableJoinColumnAnnotation addJoinColumn(int index) { - return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer); - } - - NestableJoinColumnAnnotation addJoinColumn_() { - return this.addJoinColumn_(this.joinColumns.size()); - } - - private NestableJoinColumnAnnotation addJoinColumn_(int index) { - NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index); - this.joinColumns.add(index, joinColumn); - return joinColumn; - } - - void syncAddJoinColumn(Annotation astAnnotation) { - int index = this.joinColumns.size(); - NestableJoinColumnAnnotation joinColumn = this.addJoinColumn_(index); - joinColumn.initialize((CompilationUnit) astAnnotation.getRoot()); - this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn); - } - - private NestableJoinColumnAnnotation buildJoinColumn(int index) { - return new SourceJoinColumnAnnotation(this, this.annotatedElement, buildJoinColumnAnnotationAdapter(index)); - } - - private IndexedDeclarationAnnotationAdapter buildJoinColumnAnnotationAdapter(int index) { - return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN); - } - - void joinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) { - this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn); - } - - public void moveJoinColumn(int targetIndex, int sourceIndex) { - AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer); - } - - NestableJoinColumnAnnotation moveJoinColumn_(int targetIndex, int sourceIndex) { - return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex); - } - - public void removeJoinColumn(int index) { - AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer); - } - - NestableJoinColumnAnnotation removeJoinColumn_(int index) { - return this.joinColumns.remove(index); - } - - void syncRemoveJoinColumns(int index) { - this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - this.joinColumns.isEmpty(); - } - - @Override - public void storeOn(Map<String, Object> map) { - super.storeOn(map); - - List<Map<String, Object>> joinColumnsState = this.buildStateList(this.joinColumns.size()); - for (NestableJoinColumnAnnotation joinColumn : this.getNestableJoinColumns()) { - Map<String, Object> joinColumnState = new HashMap<String, Object>(); - joinColumn.storeOn(joinColumnState); - joinColumnsState.add(joinColumnState); - } - map.put(JOIN_COLUMNS_LIST, joinColumnsState); - this.joinColumns.clear(); - } - - @Override - public void restoreFrom(Map<String, Object> map) { - super.restoreFrom(map); - - @SuppressWarnings("unchecked") - List<Map<String, Object>> joinColumnsState = (List<Map<String, Object>>) map.get(JOIN_COLUMNS_LIST); - for (Map<String, Object> joinColumnState : joinColumnsState) { - this.addJoinColumn().restoreFrom(joinColumnState); - } - } - - - // ********** join column container ********** - - /** - * adapt the AnnotationContainer interface to the collection table's join columns - */ - class JoinColumnsAnnotationContainer - implements AnnotationContainer<NestableJoinColumnAnnotation> - { - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - return SourceCollectionTable2_0Annotation.this.getAstAnnotation(astRoot); - } - - public String getElementName() { - return JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS; - } - - public String getNestedAnnotationName() { - return JoinColumnAnnotation.ANNOTATION_NAME; - } - - public Iterable<NestableJoinColumnAnnotation> getNestedAnnotations() { - return SourceCollectionTable2_0Annotation.this.getNestableJoinColumns(); - } - - public int getNestedAnnotationsSize() { - return SourceCollectionTable2_0Annotation.this.joinColumnsSize(); - } - - public NestableJoinColumnAnnotation addNestedAnnotation() { - return SourceCollectionTable2_0Annotation.this.addJoinColumn_(); - } - - public void syncAddNestedAnnotation(Annotation astAnnotation) { - SourceCollectionTable2_0Annotation.this.syncAddJoinColumn(astAnnotation); - } - - public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) { - return SourceCollectionTable2_0Annotation.this.moveJoinColumn_(targetIndex, sourceIndex); - } - - public NestableJoinColumnAnnotation removeNestedAnnotation(int index) { - return SourceCollectionTable2_0Annotation.this.removeJoinColumn_(index); - } - - public void syncRemoveNestedAnnotations(int index) { - SourceCollectionTable2_0Annotation.this.syncRemoveJoinColumns(index); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java deleted file mode 100644 index 3910e85f42..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * org.eclipse.persistence.annotations.Transformation - */ -public final class SourceElementCollection2_0Annotation - extends SourceAnnotation<Attribute> - implements ElementCollection2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> TARGET_CLASS_ADAPTER = buildTargetClassAdapter(); - private final AnnotationElementAdapter<String> targetClassAdapter; - private String targetClass; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedTargetClassName; - // we need a flag since the f-q name can be null - private boolean fqTargetClassNameStale = true; - - private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter(); - private final AnnotationElementAdapter<String> fetchAdapter; - private FetchType fetch; - - - public SourceElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.targetClassAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, TARGET_CLASS_ADAPTER); - this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.targetClass = this.buildTargetClass(astRoot); - this.fetch = this.buildFetch(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncTargetClass(this.buildTargetClass(astRoot)); - this.syncFetch(this.buildFetch(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.targetClass == null) && - (this.fetch == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.targetClass); - } - - - // ********** ElementCollection2_0Annotation implementation ********** - - // ***** target class - public String getTargetClass() { - return this.targetClass; - } - - public void setTargetClass(String targetClass) { - if (this.attributeValueHasChanged(this.targetClass, targetClass)) { - this.targetClass = targetClass; - this.fqTargetClassNameStale = true; - this.targetClassAdapter.setValue(targetClass); - } - } - - private void syncTargetClass(String astTargetClass) { - if (this.attributeValueHasChanged(this.targetClass, astTargetClass)) { - this.syncTargetClass_(astTargetClass); - } - } - - private void syncTargetClass_(String astTargetClass) { - String old = this.targetClass; - this.targetClass = astTargetClass; - this.fqTargetClassNameStale = true; - this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, astTargetClass); - } - - private String buildTargetClass(CompilationUnit astRoot) { - return this.targetClassAdapter.getValue(astRoot); - } - - public TextRange getTargetClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(TARGET_CLASS_ADAPTER, astRoot); - } - - // ***** fully-qualified target entity class name - public String getFullyQualifiedTargetClassName() { - if (this.fqTargetClassNameStale) { - this.fullyQualifiedTargetClassName = this.buildFullyQualifiedTargetClassName(); - this.fqTargetClassNameStale = false; - } - return this.fullyQualifiedTargetClassName; - } - - private String buildFullyQualifiedTargetClassName() { - return (this.targetClass == null) ? null : this.buildFullyQualifiedTargetClassName_(); - } - - private String buildFullyQualifiedTargetClassName_() { - return ASTTools.resolveFullyQualifiedName(this.targetClassAdapter.getExpression(this.buildASTRoot())); - } - - // ***** fetch - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType fetch) { - if (this.attributeValueHasChanged(this.fetch, fetch)) { - this.fetch = fetch; - this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch)); - } - } - - private void syncFetch(FetchType astFetch) { - FetchType old = this.fetch; - this.fetch = astFetch; - this.firePropertyChanged(FETCH_PROPERTY, old, astFetch); - } - - private FetchType buildFetch(CompilationUnit astRoot) { - return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot)); - } - - public TextRange getFetchTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(FETCH_ADAPTER, astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ELEMENT_COLLECTION__FETCH); - } - - private static DeclarationAnnotationElementAdapter<String> buildTargetClassAdapter() { - return buildTargetClassAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS); - } - - private static DeclarationAnnotationElementAdapter<String> buildTargetClassAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - // TODO what about QualifiedType? - return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java deleted file mode 100644 index 4e68a01b21..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.Arrays; -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.annotation.Generated - */ -public final class SourceGeneratedAnnotation - extends SourceAnnotation<Type> - implements GeneratedAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String[]> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String[]> valueAdapter; - private final Vector<String> values = new Vector<String>(); - - private static final DeclarationAnnotationElementAdapter<String> DATE_ADAPTER = buildAdapter(DATE_ELEMENT_NAME); - private final AnnotationElementAdapter<String> dateAdapter; - private String date; - - private static final DeclarationAnnotationElementAdapter<String> COMMENTS_ADAPTER = buildAdapter(COMMENTS_ELEMENT_NAME); - private final AnnotationElementAdapter<String> commentsAdapter; - private String comments; - - - public SourceGeneratedAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); - this.dateAdapter = this.buildAdapter(DATE_ADAPTER); - this.commentsAdapter = this.buildAdapter(COMMENTS_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - private AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) { - return new AnnotatedElementAnnotationElementAdapter<String[]>(this.annotatedElement, daea); - } - - private AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public void initialize(CompilationUnit astRoot) { - this.initializeValues(astRoot); - this.date = this.buildDate(astRoot); - this.comments = this.buildComments(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValues(astRoot); - this.syncDate(this.buildDate(astRoot)); - this.syncComments(this.buildComments(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - this.values.isEmpty() && - (this.date == null) && - (this.comments == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.values); - } - - - // ********** GeneratedAnnotation implementation ********** - - // ***** values - public ListIterator<String> values() { - return new CloneListIterator<String>(this.values); - } - - public int valuesSize() { - return this.values.size(); - } - - public String getValue(int index) { - return this.values.get(index); - } - - public void addValue(String value) { - this.addValue(this.values.size(), value); - } - - public void addValue(int index, String value) { - this.values.add(index, value); - this.writeValues(); - } - - public void moveValue(int targetIndex, int sourceIndex) { - CollectionTools.move(this.values, targetIndex, sourceIndex); - this.writeValues(); - } - - public void removeValue(String value) { - this.values.remove(value); - this.writeValues(); - } - - public void removeValue(int index) { - this.values.remove(index); - this.writeValues(); - } - - private void writeValues() { - this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()])); - } - - private void initializeValues(CompilationUnit astRoot) { - String[] astValues = this.valueAdapter.getValue(astRoot); - for (int i = 0; i < astValues.length; i++) { - this.values.add(astValues[i]); - } - } - - private void syncValues(CompilationUnit astRoot) { - String[] astValues = this.valueAdapter.getValue(astRoot); - this.synchronizeList(Arrays.asList(astValues), this.values, VALUES_LIST); - } - - // ***** date - public String getDate() { - return this.date; - } - - public void setDate(String date) { - if (this.attributeValueHasChanged(this.date, date)) { - this.date = date; - this.dateAdapter.setValue(date); - } - } - - protected void syncDate(String astDate) { - String old = this.date; - this.date = astDate; - this.firePropertyChanged(DATE_PROPERTY, old, astDate); - } - - private String buildDate(CompilationUnit astRoot) { - return this.dateAdapter.getValue(astRoot); - } - - // ***** comments - public String getComments() { - return this.comments; - } - - public void setComments(String comments) { - if (this.attributeValueHasChanged(this.comments, comments)) { - this.comments = comments; - this.commentsAdapter.setValue(comments); - } - } - - protected void syncComments(String astComments) { - String old = this.comments; - this.comments = astComments; - this.firePropertyChanged(COMMENTS_PROPERTY, old, astComments); - } - - private String buildComments(CompilationUnit astRoot) { - return this.commentsAdapter.getValue(astRoot); - } - - - // ********** static methods ********** - - protected static DeclarationAnnotationElementAdapter<String[]> buildValueAdapter() { - return buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, VALUE_ELEMENT_NAME); - } - - private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings()); - } - - private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, converter); - } - - protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) { - return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName); - } - - static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java deleted file mode 100644 index ca2f005792..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyClass - */ -public final class SourceMapKeyClass2_0Annotation - extends SourceAnnotation<Attribute> - implements MapKeyClass2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private String value; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedClassName; - // we need a flag since the f-q name can be null - private boolean fqClassNameStale = true; - - - public SourceMapKeyClass2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** MapKeyClass2_0Annotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.fqClassNameStale = true; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - if (this.attributeValueHasChanged(this.value, astValue)) { - this.syncValue_(astValue); - } - } - - private void syncValue_(String astValue) { - String old = this.value; - this.value = astValue; - this.fqClassNameStale = true; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ***** fully-qualified class name - public String getFullyQualifiedClassName() { - if (this.fqClassNameStale) { - this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(); - this.fqClassNameStale = false; - } - return this.fullyQualifiedClassName; - } - - private String buildFullyQualifiedClassName() { - return (this.value == null) ? null : this.buildFullyQualifiedClassName_(); - } - - private String buildFullyQualifiedClassName_() { - return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot())); - } - - - // ********** static methods ********** - - protected static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.MAP_KEY_CLASS__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java deleted file mode 100644 index e0ee92ad8f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompleteColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * <code>javax.persistence.MapKeyColumn</code> - */ -public final class SourceMapKeyColumn2_0Annotation - extends SourceCompleteColumnAnnotation - implements MapKeyColumn2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyColumn2_0Annotation.ANNOTATION_NAME); - - - public SourceMapKeyColumn2_0Annotation(JavaResourcePersistentAttribute parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return MapKeyColumn2_0Annotation.ANNOTATION_NAME; - } - - - // ********** SourceNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.MAP_KEY_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.MAP_KEY_COLUMN__COLUMN_DEFINITION; - } - - - // ********** SourceBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA2_0.MAP_KEY_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA2_0.MAP_KEY_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA2_0.MAP_KEY_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA2_0.MAP_KEY_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA2_0.MAP_KEY_COLUMN__UPDATABLE; - } - - // ********** SourceCompleteColumnAnnotation implementation ********** - - @Override - protected String getLengthElementName() { - return JPA2_0.MAP_KEY_COLUMN__LENGTH; - } - - @Override - protected String getPrecisionElementName() { - return JPA2_0.MAP_KEY_COLUMN__PRECISION; - } - - @Override - protected String getScaleElementName() { - return JPA2_0.MAP_KEY_COLUMN__SCALE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java deleted file mode 100644 index 6a6adffa06..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseEnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyEnumerated - */ -public final class SourceMapKeyEnumerated2_0Annotation - extends SourceBaseEnumeratedAnnotation - implements MapKeyEnumerated2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyEnumerated2_0Annotation.ANNOTATION_NAME); - - public SourceMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA2_0.MAP_KEY_ENUMERATED__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java deleted file mode 100644 index 6f119b77fb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTemporalAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class SourceMapKeyTemporal2_0Annotation - extends SourceBaseTemporalAnnotation - implements MapKeyTemporal2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyTemporal2_0Annotation.ANNOTATION_NAME); - - - public SourceMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return MapKeyTemporal2_0Annotation.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA2_0.MAP_KEY_TEMPORAL__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java deleted file mode 100644 index 866f42d481..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapsId - */ -public final class SourceMapsId2_0Annotation - extends SourceAnnotation<Attribute> - implements MapsId2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private String value; - - - public SourceMapsId2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** MapsId2_0Annotation implementation ********** - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - public boolean valueTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(VALUE_ADAPTER, pos, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings( - DECLARATION_ANNOTATION_ADAPTER, JPA2_0.MAPS_ID__VALUE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java deleted file mode 100644 index 71a614c996..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation; - -/** - * <code>javax.persistence.NamedQueries</code> - */ -public final class SourceNamedQueries2_0Annotation - extends SourceNamedQueriesAnnotation -{ - public SourceNamedQueries2_0Annotation(JavaResourceNode parent, Type type) { - super(parent, type); - } - - @Override - protected NestableNamedQueryAnnotation buildNamedQuery(int index) { - // pass the Java resource persistent member as the nested annotation's parent - // since the nested annotation can be converted to stand-alone - return SourceNamedQuery2_0Annotation.createNestedNamedQuery(this.parent, this.annotatedElement, index, this.daa); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java deleted file mode 100644 index 780c127a30..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.Map; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * <code>javax.persistence.NamedQuery</code> - */ -public final class SourceNamedQuery2_0Annotation - extends SourceNamedQueryAnnotation - implements NamedQuery2_0Annotation -{ - private DeclarationAnnotationElementAdapter<String> lockModeDeclarationAdapter; - private AnnotationElementAdapter<String> lockModeAdapter; - private LockModeType_2_0 lockMode; - - - public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, type, daa, annotationAdapter); - this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter(); - this.lockModeAdapter = this.buildLockModeAdapter(); - } - - public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type) { - this(parent, type, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER)); - } - - private String getLockModeElementName() { - return JPA2_0.NAMED_QUERY__LOCK_MODE; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.lockMode = this.buildLockMode(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncLockMode(this.buildLockMode(astRoot)); - } - - - // ********** NamedQuery2_0Annotation implementation ********** - - public LockModeType_2_0 getLockMode() { - return this.lockMode; - } - - public void setLockMode(LockModeType_2_0 lockMode) { - if (this.attributeValueHasChanged(this.lockMode, lockMode)) { - this.lockMode = lockMode; - this.lockModeAdapter.setValue(LockModeType_2_0.toJavaAnnotationValue(lockMode)); - } - } - - private void syncLockMode(LockModeType_2_0 astLockMode) { - LockModeType_2_0 old = this.lockMode; - this.lockMode = astLockMode; - this.firePropertyChanged(LOCK_MODE_PROPERTY, old, astLockMode); - } - - private LockModeType_2_0 buildLockMode(CompilationUnit astRoot) { - return LockModeType_2_0.fromJavaAnnotationValue(this.lockModeAdapter.getValue(astRoot)); - } - - public TextRange getLockModeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.lockModeDeclarationAdapter, astRoot); - } - - public boolean lockModeTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(this.lockModeDeclarationAdapter, pos, astRoot); - } - - private DeclarationAnnotationElementAdapter<String> buildLockModeDeclarationAdapter() { - return new EnumDeclarationAnnotationElementAdapter(this.daa, this.getLockModeElementName()); - } - - private AnnotationElementAdapter<String> buildLockModeAdapter() { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, this.lockModeDeclarationAdapter); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.lockMode == null); - } - - @Override - protected void rebuildAdapters() { - super.rebuildAdapters(); - this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter(); - this.lockModeAdapter = this.buildLockModeAdapter(); - } - - @Override - public void storeOn(Map<String, Object> map) { - super.storeOn(map); - map.put(LOCK_MODE_PROPERTY, this.lockMode); - this.lockMode = null; - } - - @Override - public void restoreFrom(Map<String, Object> map) { - super.restoreFrom(map); - this.setLockMode((LockModeType_2_0) map.get(LOCK_MODE_PROPERTY)); - } - - - // ********** static methods ********** - - static SourceNamedQuery2_0Annotation createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { - IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME); - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(type, idaa); - return new SourceNamedQuery2_0Annotation(parent, type, idaa, annotationAdapter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java deleted file mode 100644 index 9d45f1d4b1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.Map; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * <code>javax.persistence.OrderColumn</code> - */ -public final class SourceOrderColumn2_0Annotation - extends SourceNamedColumnAnnotation - implements OrderColumn2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private DeclarationAnnotationElementAdapter<Boolean> nullableDeclarationAdapter; - private AnnotationElementAdapter<Boolean> nullableAdapter; - private Boolean nullable; - - private DeclarationAnnotationElementAdapter<Boolean> insertableDeclarationAdapter; - private AnnotationElementAdapter<Boolean> insertableAdapter; - private Boolean insertable; - - private DeclarationAnnotationElementAdapter<Boolean> updatableDeclarationAdapter; - private AnnotationElementAdapter<Boolean> updatableAdapter; - private Boolean updatable; - - - public SourceOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter(); - this.nullableAdapter = this.buildNullableAdapter(); - this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter(); - this.insertableAdapter = this.buildInsertableAdapter(); - this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter(); - this.updatableAdapter = this.buildUpdatableAdapter(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.nullable = this.buildNullable(astRoot); - this.insertable = this.buildInsertable(astRoot); - this.updatable = this.buildUpdatable(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncNullable(this.buildNullable(astRoot)); - this.syncInsertable(this.buildInsertable(astRoot)); - this.syncUpdatable(this.buildUpdatable(astRoot)); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected String getNameElementName() { - return JPA2_0.ORDER_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.ORDER_COLUMN__COLUMN_DEFINITION; - } - - - //************* OrderColumn2_0Annotation implementation ************* - - // ***** nullable - public Boolean getNullable() { - return this.nullable; - } - - public void setNullable(Boolean nullable) { - if (this.attributeValueHasChanged(this.nullable, nullable)) { - this.nullable = nullable; - this.nullableAdapter.setValue(nullable); - } - } - - private void syncNullable(Boolean astNullable) { - Boolean old = this.nullable; - this.nullable = astNullable; - this.firePropertyChanged(NULLABLE_PROPERTY, old, astNullable); - } - - private Boolean buildNullable(CompilationUnit astRoot) { - return this.nullableAdapter.getValue(astRoot); - } - - public TextRange getNullableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nullableDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildNullableDeclarationAdapter() { - return this.buildBooleanElementAdapter(this.getNullableElementName()); - } - - private AnnotationElementAdapter<Boolean> buildNullableAdapter() { - return this.buildBooleanElementAdapter(this.nullableDeclarationAdapter); - } - - String getNullableElementName() { - return JPA2_0.ORDER_COLUMN__NULLABLE; - } - - // ***** insertable - public Boolean getInsertable() { - return this.insertable; - } - - public void setInsertable(Boolean insertable) { - if (this.attributeValueHasChanged(this.insertable, insertable)) { - this.insertable = insertable; - this.insertableAdapter.setValue(insertable); - } - } - - private void syncInsertable(Boolean astInsertable) { - Boolean old = this.insertable; - this.insertable = astInsertable; - this.firePropertyChanged(INSERTABLE_PROPERTY, old, astInsertable); - } - - private Boolean buildInsertable(CompilationUnit astRoot) { - return this.insertableAdapter.getValue(astRoot); - } - - public TextRange getInsertableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.insertableDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildInsertableDeclarationAdapter() { - return this.buildBooleanElementAdapter(this.getInsertableElementName()); - } - - private AnnotationElementAdapter<Boolean> buildInsertableAdapter() { - return this.buildBooleanElementAdapter(this.insertableDeclarationAdapter); - } - - String getInsertableElementName() { - return JPA2_0.ORDER_COLUMN__INSERTABLE; - } - - // ***** updatable - public Boolean getUpdatable() { - return this.updatable; - } - - public void setUpdatable(Boolean updatable) { - if (this.attributeValueHasChanged(this.updatable, updatable)) { - this.updatable = updatable; - this.updatableAdapter.setValue(updatable); - } - } - - private void syncUpdatable(Boolean astUpdatable) { - Boolean old = this.updatable; - this.updatable = astUpdatable; - this.firePropertyChanged(UPDATABLE_PROPERTY, old, astUpdatable); - } - - private Boolean buildUpdatable(CompilationUnit astRoot) { - return this.updatableAdapter.getValue(astRoot); - } - - public TextRange getUpdatableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.updatableDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildUpdatableDeclarationAdapter() { - return this.buildBooleanElementAdapter(this.getUpdatableElementName()); - } - - private AnnotationElementAdapter<Boolean> buildUpdatableAdapter() { - return this.buildBooleanElementAdapter(this.updatableDeclarationAdapter); - } - - String getUpdatableElementName() { - return JPA2_0.ORDER_COLUMN__UPDATABLE; - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.nullable == null) && - (this.insertable == null) && - (this.updatable == null); - } - - @Override - protected void rebuildAdapters() { - super.rebuildAdapters(); - this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter(); - this.nullableAdapter = this.buildNullableAdapter(); - this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter(); - this.insertableAdapter = this.buildInsertableAdapter(); - this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter(); - this.updatableAdapter = this.buildUpdatableAdapter(); - } - - @Override - public void storeOn(Map<String, Object> map) { - super.storeOn(map); - map.put(NULLABLE_PROPERTY, this.nullable); - this.nullable = null; - map.put(INSERTABLE_PROPERTY, this.insertable); - this.insertable = null; - map.put(UPDATABLE_PROPERTY, this.updatable); - this.updatable = null; - } - - @Override - public void restoreFrom(Map<String, Object> map) { - super.restoreFrom(map); - this.setNullable((Boolean) map.get(NULLABLE_PROPERTY)); - this.setInsertable((Boolean) map.get(INSERTABLE_PROPERTY)); - this.setUpdatable((Boolean) map.get(UPDATABLE_PROPERTY)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java deleted file mode 100644 index f6fbcbcef1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * SourceSequenceGenerator2_0Annotation - */ -public final class SourceSequenceGenerator2_0Annotation - extends SourceSequenceGeneratorAnnotation - implements SequenceGenerator2_0Annotation -{ - private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__CATALOG); - private final AnnotationElementAdapter<String> catalogAdapter; - private String catalog; - - private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__SCHEMA); - private final AnnotationElementAdapter<String> schemaAdapter; - private String schema; - - - // ********** constructor ********** - public SourceSequenceGenerator2_0Annotation(JavaResourceNode parent, Member member) { - super(parent, member); - this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER); - this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.catalog = this.buildCatalog(astRoot); - this.schema = this.buildSchema(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncCatalog(this.buildCatalog(astRoot)); - this.syncSchema(this.buildSchema(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.catalog == null) && - (this.schema == null); - } - - - // ********** catalog ********** - public String getCatalog() { - return this.catalog; - } - - public void setCatalog(String catalog) { - if (this.attributeValueHasChanged(this.catalog, catalog)) { - this.catalog = catalog; - this.catalogAdapter.setValue(catalog); - } - } - - private void syncCatalog(String astCatalog) { - String old = this.catalog; - this.catalog = astCatalog; - this.firePropertyChanged(CATALOG_PROPERTY, old, astCatalog); - } - - private String buildCatalog(CompilationUnit astRoot) { - return this.catalogAdapter.getValue(astRoot); - } - - public TextRange getCatalogTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(CATALOG_ADAPTER, astRoot); - } - - public boolean catalogTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(CATALOG_ADAPTER, pos, astRoot); - } - - // ********** schema ********** - public String getSchema() { - return this.schema; - } - - public void setSchema(String schema) { - if (this.attributeValueHasChanged(this.schema, schema)) { - this.schema = schema; - this.schemaAdapter.setValue(schema); - } - } - - private void syncSchema(String astSchema) { - String old = this.schema; - this.schema = astSchema; - this.firePropertyChanged(SCHEMA_PROPERTY, old, astSchema); - } - - private String buildSchema(CompilationUnit astRoot) { - return this.schemaAdapter.getValue(astRoot); - } - - public TextRange getSchemaTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SCHEMA_ADAPTER, astRoot); - } - - public boolean schemaTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(SCHEMA_ADAPTER, pos, astRoot); - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java deleted file mode 100644 index 165188d7e6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.metamodel.StaticMetamodel - */ -public final class SourceStaticMetamodelAnnotation - extends SourceAnnotation<Type> - implements StaticMetamodelAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter<String> valueAdapter; - private String value; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedClassName; - // we need a flag since the f-q name can be null - private boolean fqClassNameStale = true; - - - public SourceStaticMetamodelAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(type, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** StaticMetamodelAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.fqClassNameStale = true; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - if (this.attributeValueHasChanged(this.value, astValue)) { - this.syncValue_(astValue); - } - } - - private void syncValue_(String astValue) { - String old = this.value; - this.value = astValue; - this.fqClassNameStale = true; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - // ***** fully-qualified class name - public String getFullyQualifiedClassName() { - if (this.fqClassNameStale) { - this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(); - this.fqClassNameStale = false; - } - return this.fullyQualifiedClassName; - } - - private String buildFullyQualifiedClassName() { - return (this.value == null) ? null : this.buildFullyQualifiedClassName_(); - } - - private String buildFullyQualifiedClassName_() { - return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot())); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.STATIC_METAMODEL__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - -} |