Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java186
1 files changed, 0 insertions, 186 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java
deleted file mode 100644
index 04e8060995..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java
+++ /dev/null
@@ -1,186 +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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.utility.TextRange;
-
-public class GenericJavaIdClassReference
- extends AbstractJavaJpaContextNode
- implements JavaIdClassReference
-{
- protected String idClassName;
-
- protected JavaPersistentType idClass;
-
-
- public GenericJavaIdClassReference(JavaTypeMapping parent) {
- super(parent);
- }
-
-
- protected JavaTypeMapping getTypeMapping() {
- return (JavaTypeMapping) getParent();
- }
-
- protected JavaPersistentType getPersistentType() {
- return getTypeMapping().getPersistentType();
- }
-
-
- // **************** PersistentType.Owner impl *****************************
-
- public AccessType getOverridePersistentTypeAccess() {
- return getPersistentType().getAccess();
- }
-
- public AccessType getDefaultPersistentTypeAccess() {
- // this shouldn't be needed, since we've specified an override access, but just to be safe ...
- return getPersistentType().getAccess();
- }
-
-
- // **************** IdClassReference impl *********************************
-
- public String getSpecifiedIdClassName() {
- return this.idClassName;
- }
-
- public void setSpecifiedIdClassName(String newClassName) {
- String oldClassName = this.idClassName;
- this.idClassName = newClassName;
- if (this.valuesAreDifferent(newClassName, oldClassName)) {
- if (newClassName != null) {
- if (getIdClassAnnotation() == null) {
- addIdClassAnnotation();
- }
- getIdClassAnnotation().setValue(newClassName);
- }
- else {
- removeIdClassAnnotation();
- }
- }
- firePropertyChanged(SPECIFIED_ID_CLASS_NAME_PROPERTY, oldClassName, newClassName);
- }
-
- protected void setIdClassName_(String newClassName) {
- String oldClassName = this.idClassName;
- this.idClassName = newClassName;
- firePropertyChanged(SPECIFIED_ID_CLASS_NAME_PROPERTY, oldClassName, newClassName);
- }
-
- protected String buildIdClassName() {
- IdClassAnnotation annotation = getIdClassAnnotation();
- if (annotation != null) {
- return annotation.getValue();
- }
- return null;
- }
-
- public String getDefaultIdClassName() {
- return null;
- }
-
- public String getIdClassName() {
- return getSpecifiedIdClassName();
- }
-
- public boolean isSpecified() {
- return getSpecifiedIdClassName() != null;
- }
-
- public JavaPersistentType getIdClass() {
- return this.idClass;
- }
-
- protected void setIdClass_(JavaPersistentType newIdClass) {
- JavaPersistentType oldIdClass = this.idClass;
- this.idClass = newIdClass;
- firePropertyChanged(ID_CLASS_PROPERTY, oldIdClass, newIdClass);
- }
-
- protected JavaPersistentType buildIdClass() {
- JavaResourcePersistentType resourceIdClass = getResourceIdClass();
- return (resourceIdClass == null) ?
- null : this.buildIdClass(resourceIdClass);
- }
-
- protected JavaPersistentType buildIdClass(JavaResourcePersistentType resourceClass) {
- return getJpaFactory().buildJavaPersistentType(this, resourceClass);
- }
-
- protected JavaResourcePersistentType getResourcePersistentType() {
- return getPersistentType().getResourcePersistentType();
- }
-
- protected IdClassAnnotation getIdClassAnnotation() {
- return (IdClassAnnotation) getResourcePersistentType().
- getAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- protected void addIdClassAnnotation() {
- getResourcePersistentType().addAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeIdClassAnnotation() {
- getResourcePersistentType().removeAnnotation(IdClassAnnotation.ANNOTATION_NAME);
- }
-
- protected JavaResourcePersistentType getResourceIdClass() {
- IdClassAnnotation annotation = getIdClassAnnotation();
- String className = (annotation == null) ?
- null : annotation.getFullyQualifiedClassName();
- return (className == null) ?
- null : getJpaProject().getJavaResourcePersistentType(className);
- }
-
- public char getIdClassEnclosingTypeSeparator() {
- return '.';
- }
-
- public void initialize() {
- this.idClassName = buildIdClassName();
- this.idClass = buildIdClass();
- }
-
- public void update() {
- setIdClassName_(buildIdClassName());
- updateIdClass();
- }
-
- protected void updateIdClass() {
- JavaResourcePersistentType resourceIdClass = getResourceIdClass();
- if (resourceIdClass == null) {
- setIdClass_(null);
- }
- else {
- if (this.idClass == null || this.idClass.getResourcePersistentType() != resourceIdClass) {
- setIdClass_(buildIdClass(resourceIdClass));
- }
- this.idClass.update(resourceIdClass);
- }
- }
-
-
- // **************** validation ********************************************
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return (getIdClassAnnotation() == null) ?
- getTypeMapping().getValidationTextRange(astRoot)
- : getIdClassAnnotation().getTextRange(astRoot);
- }
-}

Back to the top