diff options
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource')
111 files changed, 0 insertions, 12653 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullAnnotation.java deleted file mode 100644 index a5fb26a455..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullAnnotation.java +++ /dev/null @@ -1,78 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.AbstractJavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * Simplify null annotation classes - */ -public abstract class NullAnnotation - extends AbstractJavaResourceNode - implements Annotation -{ - - protected NullAnnotation(JavaResourceNode parent) { - super(parent); - } - - public void initialize(CompilationUnit astRoot) { - // do nothing - } - - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - return null; - } - - public JavaResourceCompilationUnit getJavaResourceCompilationUnit() { - throw new UnsupportedOperationException(); - } - - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return null; - } - - public void synchronizeWith(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - /** - * Convenience method: Cast the annotation's parent to a - * persistent member. - */ - protected JavaResourceAnnotatedElement getAnnotatedElement() { - return (JavaResourceAnnotatedElement) this.parent; - } - - /** - * Convenience method: Add the type or attribute's annotation - * and return it. - * Pre-condition: The annotation's parent must be a persistent member - * (type or attribute). - */ - protected Annotation addAnnotation() { - return this.getAnnotatedElement().addAnnotation(this.getAnnotationName()); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java deleted file mode 100644 index dae57d6a99..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java +++ /dev/null @@ -1,56 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorOrder - */ -public final class NullXmlAccessorOrderAnnotation - extends NullAnnotation - implements XmlAccessorOrderAnnotation -{ - protected NullXmlAccessorOrderAnnotation(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlAccessorOrderAnnotation addAnnotation() { - return (XmlAccessorOrderAnnotation) super.addAnnotation(); - } - - - // ********** XmlAccessorTOrderAnnotation implementation ********** - - // ***** value - public XmlAccessOrder getValue() { - return null; - } - - public void setValue(XmlAccessOrder value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java deleted file mode 100644 index bb8856ee0e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java +++ /dev/null @@ -1,56 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorType - */ -public final class NullXmlAccessorTypeAnnotation - extends NullAnnotation - implements XmlAccessorTypeAnnotation -{ - protected NullXmlAccessorTypeAnnotation(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlAccessorTypeAnnotation addAnnotation() { - return (XmlAccessorTypeAnnotation) super.addAnnotation(); - } - - - // ********** XmlAccessorTypeAnnotation implementation ********** - - // ***** value - public XmlAccessType getValue() { - return null; - } - - public void setValue(XmlAccessType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlElementDeclAnnotation.java deleted file mode 100644 index 72f000dedd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlElementDeclAnnotation.java +++ /dev/null @@ -1,134 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementDecl - */ -public final class NullXmlElementDeclAnnotation - extends NullAnnotation - implements XmlElementDeclAnnotation -{ - protected NullXmlElementDeclAnnotation(JavaResourceMethod parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlElementDeclAnnotation addAnnotation() { - return (XmlElementDeclAnnotation) super.addAnnotation(); - } - - - // ********** XmlEnumAnnotation implementation ********** - - // ***** name - public String getName() { - return null; - } - - public void setName(String name) { - if (name != null) { - this.addAnnotation().setName(name); - } - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** namespace - public String getNamespace() { - return null; - } - - public void setNamespace(String namespace) { - if (namespace != null) { - this.addAnnotation().setNamespace(namespace); - } - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** defaultValue - public String getDefaultValue() { - return null; - } - - public void setDefaultValue(String defaultValue) { - if (defaultValue != null) { - this.addAnnotation().setDefaultValue(defaultValue); - } - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** scope - public String getScope() { - return null; - } - - public String getFullyQualifiedScopeClassName() { - return null; - } - - public void setScope(String scope) { - if (scope != null) { - this.addAnnotation().setScope(scope); - } - } - - public TextRange getScopeTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** substitutionHeadName - public String getSubstitutionHeadName() { - return null; - } - - public void setSubstitutionHeadName(String substitutionHeadName) { - if (substitutionHeadName != null) { - this.addAnnotation().setSubstitutionHeadName(substitutionHeadName); - } - } - - public TextRange getSubstitutionHeadNameTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** substitutionHeadNamespace - public String getSubstitutionHeadNamespace() { - return null; - } - - public void setSubstitutionHeadNamespace(String substitutionHeadNamespace) { - if (substitutionHeadNamespace != null) { - this.addAnnotation().setSubstitutionHeadNamespace(substitutionHeadNamespace); - } - } - - public TextRange getSubstitutionHeadNamespaceTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java deleted file mode 100644 index 25ee32e4a3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java +++ /dev/null @@ -1,58 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnum - */ -public final class NullXmlEnumAnnotation - extends NullAnnotation - implements XmlEnumAnnotation -{ - protected NullXmlEnumAnnotation(JavaResourceAbstractType parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlEnumAnnotation addAnnotation() { - return (XmlEnumAnnotation) super.addAnnotation(); - } - - - // ********** XmlEnumAnnotation implementation ********** - - // ***** value - public String getValue() { - return null; - } - - public String getFullyQualifiedValueClassName() { - return null; - } - - public void setValue(String value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java deleted file mode 100644 index 4d2adeba94..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java +++ /dev/null @@ -1,54 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnumValue - */ -public final class NullXmlEnumValueAnnotation - extends NullAnnotation - implements XmlEnumValueAnnotation -{ - protected NullXmlEnumValueAnnotation(JavaResourceEnumConstant parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlEnumValueAnnotation addAnnotation() { - return (XmlEnumValueAnnotation) super.addAnnotation(); - } - - - // ********** XmlEnumValueAnnotation implementation ********** - - // ***** value - public String getValue() { - return null; - } - - public void setValue(String value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlSchemaAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlSchemaAnnotation.java deleted file mode 100644 index 667baacffd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlSchemaAnnotation.java +++ /dev/null @@ -1,137 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; - -/** - * javax.xml.bind.annotation.XmlSchema - */ -public final class NullXmlSchemaAnnotation - extends NullAnnotation - implements XmlSchemaAnnotation -{ - protected NullXmlSchemaAnnotation(JavaResourcePackage parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlSchemaAnnotation addAnnotation() { - return (XmlSchemaAnnotation) super.addAnnotation(); - } - - - // ********** XmlSchemaAnnotation implementation ********** - - // ***** namespace - - public String getNamespace() { - return null; - } - - public void setNamespace(String namespace) { - if (namespace != null) { - this.addAnnotation().setNamespace(namespace); - } - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return false; - } - - - // ***** location - - public String getLocation() { - return null; - } - - public void setLocation(String location) { - if (location != null) { - this.addAnnotation().setLocation(location); - } - } - - public TextRange getLocationTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - - public XmlNsForm getAttributeFormDefault() { - return null; - } - - public void setAttributeFormDefault(XmlNsForm attributeFormDefault) { - if (attributeFormDefault != null) { - this.addAnnotation().setAttributeFormDefault(attributeFormDefault); - } - } - - public TextRange getAttributeFormDefaultTextRange(CompilationUnit astRoot) { - return null; - } - - public XmlNsForm getElementFormDefault() { - return null; - } - - public void setElementFormDefault(XmlNsForm elementFormDefault) { - if (elementFormDefault != null) { - this.addAnnotation().setElementFormDefault(elementFormDefault); - } - } - - public TextRange getElementFormDefaultTextRange(CompilationUnit astRoot) { - return null; - } - - public ListIterable<XmlNsAnnotation> getXmlns() { - return EmptyListIterable.instance(); - } - - public int getXmlnsSize() { - return 0; - } - - public XmlNsAnnotation xmlnsAt(int index) { - return null; - } - - public XmlNsAnnotation addXmlns(int index) { - return this.addAnnotation().addXmlns(index); - } - - public void moveXmlns(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeXmlns(int index) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java deleted file mode 100644 index 339a8b3679..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlType - */ -public final class NullXmlTypeAnnotation - extends NullAnnotation - implements XmlTypeAnnotation -{ - protected NullXmlTypeAnnotation(JavaResourceAbstractType parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlTypeAnnotation addAnnotation() { - return (XmlTypeAnnotation) super.addAnnotation(); - } - - - // ********** XmlTypeAnnotation implementation ********** - - // ***** factory class - public String getFactoryClass() { - return null; - } - - public String getFullyQualifiedFactoryClassName() { - return null; - } - - public void setFactoryClass(String factoryClass) { - if (factoryClass != null) { - this.addAnnotation().setFactoryClass(factoryClass); - } - } - - public TextRange getFactoryClassTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** factory method - public String getFactoryMethod() { - return null; - } - - public void setFactoryMethod(String factoryMethod) { - if (factoryMethod != null) { - this.addAnnotation().setFactoryMethod(factoryMethod); - } - } - - public TextRange getFactoryMethodTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** name - public String getName() { - return null; - } - - public void setName(String name) { - if (name != null) { - this.addAnnotation().setName(name); - } - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return false; - } - - - // ***** namespace - public String getNamespace() { - return null; - } - - public void setNamespace(String namespace) { - if (namespace != null) { - this.addAnnotation().setNamespace(namespace); - } - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return false; - } - - - public ListIterable<String> getPropOrder() { - return EmptyListIterable.instance(); - } - - public int getPropOrderSize() { - return 0; - } - - public void addProp(int index, String prop) { - this.addAnnotation().addProp(index, prop); - } - - public void addProp(String prop) { - this.addAnnotation().addProp(prop); - } - - public void moveProp(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeProp(int index) { - throw new UnsupportedOperationException(); - } - - public void removeProp(String prop) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorOrderAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorOrderAnnotationDefinition.java deleted file mode 100644 index 362d0f430b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorOrderAnnotationDefinition.java +++ /dev/null @@ -1,60 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorOrder - */ -public final class XmlAccessorOrderAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAccessorOrderAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAccessorOrderAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAccessorOrderAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlAccessorOrderAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAccessorOrderAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAccessorOrderAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorTypeAnnotationDefinition.java deleted file mode 100644 index e36e85dd89..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorTypeAnnotationDefinition.java +++ /dev/null @@ -1,60 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorType - */ -public final class XmlAccessorTypeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAccessorTypeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAccessorTypeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAccessorTypeAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlAccessorTypeAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAccessorTypeAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAccessorTypeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java deleted file mode 100644 index 008f0be7cf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlAnyAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAnyAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyAttribute - */ -public final class XmlAnyAttributeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAnyAttributeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAnyAttributeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAnyAttributeAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAnyAttributeAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAnyAttributeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyElementAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyElementAnnotationDefinition.java deleted file mode 100644 index 1a652d1664..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyElementAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlAnyElementAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAnyElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyElement - */ -public final class XmlAnyElementAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAnyElementAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAnyElementAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAnyElementAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAnyElementAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAnyElementAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java deleted file mode 100644 index 4de95f3fff..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlAttachmentRefAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAttachmentRefAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttachmentRef - */ -public final class XmlAttachmentRefAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAttachmentRefAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAttachmentRefAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAttachmentRefAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAttachmentRefAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAttachmentRefAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttributeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttributeAnnotationDefinition.java deleted file mode 100644 index f1386ae20d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttributeAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttribute - */ -public final class XmlAttributeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAttributeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAttributeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAttributeAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAttributeAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAttributeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java deleted file mode 100644 index aadf23dedf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlElement - */ -public final class XmlElementAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlElementAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceXmlElementAnnotation.buildSourceXmlElementAnnotation((JavaResourceAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlElementAnnotation.ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementDeclAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementDeclAnnotationDefinition.java deleted file mode 100644 index 80e909350d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementDeclAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.MethodAttribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementDeclAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementDeclAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementDecl - */ -public final class XmlElementDeclAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlElementDeclAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementDeclAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlElementDeclAnnotation((JavaResourceMethod) parent, (MethodAttribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlElementDeclAnnotation((JavaResourceMethod) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementDeclAnnotation((JavaResourceMethod) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlElementDeclAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java deleted file mode 100644 index 906de66d39..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java +++ /dev/null @@ -1,71 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlElementRefAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementRefAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -/** - * javax.xml.bind.annotation.XmlElementRef - */ -public final class XmlElementRefAnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE = new XmlElementRefAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementRefAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceXmlElementRefAnnotation.buildSourceXmlElementRefAnnotation((JavaResourceField) parent, (Attribute) annotatedElement, index); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementRefAnnotation(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return JAXB.XML_ELEMENT_REF; - } - - public String getContainerAnnotationName() { - return JAXB.XML_ELEMENT_REFS; - } - - public String getElementName() { - return JAXB.XML_ELEMENT_REFS__VALUE; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementWrapperAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementWrapperAnnotationDefinition.java deleted file mode 100644 index 56efd05d7c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementWrapperAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlElementWrapperAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementWrapperAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementWrapper - */ -public final class XmlElementWrapperAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlElementWrapperAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementWrapperAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlElementWrapperAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementWrapperAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlElementWrapperAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java deleted file mode 100644 index d9a5683a43..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlElementsAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation; - -/** - * javax.xml.bind.annotation.XmlElement - */ -public final class XmlElementsAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlElementsAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementsAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlElementsAnnotation((JavaResourceAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementsAnnotation((JavaResourceAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlElementsAnnotation.ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumAnnotationDefinition.java deleted file mode 100644 index fd8f2c8db7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlEnumAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlEnumAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnum - */ -public final class XmlEnumAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlEnumAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlEnumAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlEnumAnnotation((JavaResourceAbstractType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlEnumAnnotation((JavaResourceAbstractType) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlEnumAnnotation((JavaResourceAbstractType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlEnumAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java deleted file mode 100644 index 309104f514..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.EnumConstant; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlEnumValueAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlEnumValueAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnumValue - */ -public final class XmlEnumValueAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlEnumValueAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlEnumValueAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlEnumValueAnnotation((JavaResourceEnumConstant) parent, (EnumConstant) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlEnumValueAnnotation((JavaResourceEnumConstant) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlEnumValueAnnotation((JavaResourceEnumConstant) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlEnumValueAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java deleted file mode 100644 index de18ccecf0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlIDAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlIDAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; - -/** - * javax.xml.bind.annotation.XmlID - */ -public final class XmlIDAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlIDAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlIDAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlIDAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlIDAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlIDAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java deleted file mode 100644 index 2d07bc9a34..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlIDREFAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlIDREFAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; - -/** - * javax.xml.bind.annotation.XmlIDREF - */ -public final class XmlIDREFAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlIDREFAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlIDREFAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlIDREFAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlIDREFAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlIDREFAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlInlineBinaryDataAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlInlineBinaryDataAnnotationDefinition.java deleted file mode 100644 index 8d14d81a46..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlInlineBinaryDataAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlInlineBinaryDataAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlInlineBinaryDataAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; - -/** - * javax.xml.bind.annotation.XmlInlineBinaryData - */ -public final class XmlInlineBinaryDataAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlInlineBinaryDataAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlInlineBinaryDataAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlInlineBinaryDataAnnotation((JavaResourceMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlInlineBinaryDataAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlInlineBinaryDataAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlJavaTypeAdapterAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlJavaTypeAdapterAnnotationDefinition.java deleted file mode 100644 index 8d3039fd24..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlJavaTypeAdapterAnnotationDefinition.java +++ /dev/null @@ -1,64 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -/** - * javax.xml.bind.annotation.adapters.XmlJavaTypeAdapterAnnotation - */ -public final class XmlJavaTypeAdapterAnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE = new XmlJavaTypeAdapterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlJavaTypeAdapterAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceXmlJavaTypeAdapterAnnotation.buildSourceXmlJavaTypeAdapterAnnotation(parent, annotatedElement, index); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlJavaTypeAdapterAnnotation(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return JAXB.XML_JAVA_TYPE_ADAPTER; - } - - public String getContainerAnnotationName() { - return JAXB.XML_JAVA_TYPE_ADAPTERS; - } - - public String getElementName() { - return JAXB.XML_JAVA_TYPE_ADAPTERS__VALUE; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java deleted file mode 100644 index 5ee5334802..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlListAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlListAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; - -/** - * javax.xml.bind.annotation.XmlList - */ -public final class XmlListAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlListAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlListAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlListAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlListAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlListAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java deleted file mode 100644 index 084b40291a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlMimeTypeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlMimeTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlMimeType - */ -public final class XmlMimeTypeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlMimeTypeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlMimeTypeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlMimeTypeAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlMimeTypeAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlMimeTypeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java deleted file mode 100644 index 77263c2fd1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlMixedAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlMixedAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation; - -/** - * javax.xml.bind.annotation.XmlMixed - */ -public final class XmlMixedAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlMixedAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlMixedAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlMixedAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlMixedAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlMixedAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRegistryAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRegistryAnnotationDefinition.java deleted file mode 100644 index eac9f401b6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRegistryAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlRegistryAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlRegistryAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation; - -/** - * javax.xml.bind.annotation.XmlRegistry - */ -public final class XmlRegistryAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlRegistryAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlRegistryAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlRegistryAnnotation((JavaResourceAbstractType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlRegistryAnnotation((JavaResourceAbstractType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlRegistryAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRootElementAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRootElementAnnotationDefinition.java deleted file mode 100644 index 62f222c346..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRootElementAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlRootElement - */ -public final class XmlRootElementAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlRootElementAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlRootElementAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlRootElementAnnotation((JavaResourceAbstractType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlRootElementAnnotation((JavaResourceAbstractType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlRootElementAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaAnnotationDefinition.java deleted file mode 100644 index 0ac46c3036..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaAnnotationDefinition.java +++ /dev/null @@ -1,61 +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.jaxb.core.internal.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.AnnotatedPackage; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlSchemaAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; - -public class XmlSchemaAnnotationDefinition - implements AnnotationDefinition { - - // singleton - private static final AnnotationDefinition INSTANCE = new XmlSchemaAnnotationDefinition(); - - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Ensure single instance. - */ - private XmlSchemaAnnotationDefinition() { - super(); - } - - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlSchemaAnnotation((JavaResourcePackage) parent, (AnnotatedPackage) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlSchemaAnnotation((JavaResourcePackage) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - // TODO - throw new UnsupportedOperationException(); - } - - public String getAnnotationName() { - return JAXB.XML_SCHEMA; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaTypeAnnotationDefinition.java deleted file mode 100644 index 385af2b93c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaTypeAnnotationDefinition.java +++ /dev/null @@ -1,60 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlSchemaTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - - -public class XmlSchemaTypeAnnotationDefinition - implements NestableAnnotationDefinition { - - // singleton - private static final NestableAnnotationDefinition INSTANCE = new XmlSchemaTypeAnnotationDefinition(); - - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - - private XmlSchemaTypeAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceXmlSchemaTypeAnnotation.buildSourceXmlSchemaTypeAnnotation(parent, annotatedElement, index); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - throw new UnsupportedOperationException(); - } - - public String getNestableAnnotationName() { - return JAXB.XML_SCHEMA_TYPE; - } - - public String getContainerAnnotationName() { - return JAXB.XML_SCHEMA_TYPES; - } - - public String getElementName() { - return JAXB.XML_SCHEMA_TYPES__VALUE; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSeeAlsoAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSeeAlsoAnnotationDefinition.java deleted file mode 100644 index b4a3b98ed5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSeeAlsoAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlSeeAlsoAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlSeeAlsoAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation; - -/** - * javax.xml.bind.annotation.XmlSeeAlso - */ -public final class XmlSeeAlsoAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlSeeAlsoAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlSeeAlsoAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlSeeAlsoAnnotation((JavaResourceAbstractType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlSeeAlsoAnnotation((JavaResourceAbstractType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlSeeAlsoAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTransientAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTransientAnnotationDefinition.java deleted file mode 100644 index 2f40820e51..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTransientAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlTransientAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlTransientAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -/** - * javax.xml.bind.annotation.XmlTransient - */ -public final class XmlTransientAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlTransientAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlTransientAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlTransientAnnotation((JavaResourceMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlTransientAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlTransientAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTypeAnnotationDefinition.java deleted file mode 100644 index 0ab260ff21..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTypeAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlTypeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlType - */ -public final class XmlTypeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlTypeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlTypeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlTypeAnnotation((JavaResourceAbstractType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlTypeAnnotation((JavaResourceAbstractType) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlTypeAnnotation((JavaResourceAbstractType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlTypeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java deleted file mode 100644 index cf706d63d8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java +++ /dev/null @@ -1,62 +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.jaxb.core.internal.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.jaxb.core.internal.resource.java.binary.BinaryXmlValueAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlValueAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlValue - */ -public final class XmlValueAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlValueAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlValueAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlValueAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlValueAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlValueAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryAnnotation.java deleted file mode 100644 index 5dd44ff4c6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryAnnotation.java +++ /dev/null @@ -1,93 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.IMemberValuePair; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * JAR annotation - */ -public abstract class BinaryAnnotation - extends BinaryNode - implements Annotation -{ - final IAnnotation jdtAnnotation; - - protected BinaryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent); - this.jdtAnnotation = jdtAnnotation; - } - - - // ********** convenience methods ********** - - /** - * Return the values of the JDT annotation's member with the specified name. - */ - protected Object[] getJdtMemberValues(String memberName) { - Object[] values = (Object[]) this.getJdtMemberValue(memberName); - return (values != null) ? values : EMPTY_OBJECT_ARRAY; - } - private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - - /** - * Return the value of the JDT annotation's member with the specified name. - */ - protected Object getJdtMemberValue(String memberName) { - IMemberValuePair pair = this.getJdtMemberValuePair(memberName); - return (pair == null) ? null : pair.getValue(); - } - - /** - * Return the JDT annotation's member-value pair with the specified name. - */ - private IMemberValuePair getJdtMemberValuePair(String memberName) { - for (IMemberValuePair pair : this.getJdtMemberValuePairs()) { - if (pair.getMemberName().equals(memberName)) { - return pair; - } - } - return null; - } - - private IMemberValuePair[] getJdtMemberValuePairs() { - try { - return this.jdtAnnotation.getMemberValuePairs(); - } catch (JavaModelException ex) { - JptJaxbCorePlugin.log(ex); - return EMPTY_MEMBER_VALUE_PAIR_ARRAY; - } - } - private static final IMemberValuePair[] EMPTY_MEMBER_VALUE_PAIR_ARRAY = new IMemberValuePair[0]; - - - // ********** Annotation implementation ********** - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - - // ********** NestableAnnotation implementation ********** - public void moveAnnotation(@SuppressWarnings("unused") int index) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryNode.java deleted file mode 100644 index 653f1bdc2d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryNode.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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.AbstractJavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * Binary convenience methods - */ -// TODO hopefully this class can go away with some sort of refactoring of the -// source and binary hierarchies... -public abstract class BinaryNode - extends AbstractJavaResourceNode -{ - - // ********** construction ********** - - protected BinaryNode(JavaResourceNode parent) { - super(parent); - } - - - // ********** JavaResourceNode implementation ********** - - @Override - public IFile getFile() { - return null; // only BinaryPackageFragmentRoot has a file... - } - - public void update() { - // nothing by default - } - - public JavaResourceCompilationUnit getJavaResourceCompilationUnit() { - throw new UnsupportedOperationException(); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public void initialize(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public void synchronizeWith(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java deleted file mode 100644 index 651dbc16eb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java +++ /dev/null @@ -1,71 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorOrder - */ -public final class BinaryXmlAccessorOrderAnnotation - extends BinaryAnnotation - implements XmlAccessorOrderAnnotation -{ - private XmlAccessOrder value; - - - public BinaryXmlAccessorOrderAnnotation(JavaResourceAnnotatedElement 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()); - } - - - //*************** XmlAccessorOrderAnnotation implementation **************** - - // ***** value - public XmlAccessOrder getValue() { - return this.value; - } - - public void setValue(XmlAccessOrder value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(XmlAccessOrder value) { - XmlAccessOrder old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private XmlAccessOrder buildValue() { - return XmlAccessOrder.fromJavaAnnotationValue(this.getJdtMemberValue(JAXB.XML_ACCESSOR_ORDER__VALUE)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java deleted file mode 100644 index 4b4d94ecc9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java +++ /dev/null @@ -1,71 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorType - */ -public final class BinaryXmlAccessorTypeAnnotation - extends BinaryAnnotation - implements XmlAccessorTypeAnnotation -{ - private XmlAccessType value; - - - public BinaryXmlAccessorTypeAnnotation(JavaResourceAnnotatedElement 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()); - } - - - //*************** XmlAccessorTypeAnnotation implementation **************** - - // ***** value - public XmlAccessType getValue() { - return this.value; - } - - public void setValue(XmlAccessType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(XmlAccessType value) { - XmlAccessType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private XmlAccessType buildValue() { - return XmlAccessType.fromJavaAnnotationValue(this.getJdtMemberValue(JAXB.XML_ACCESSOR_TYPE__VALUE)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java deleted file mode 100644 index 4bfd81dbd9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyAttribute - */ -public final class BinaryXmlAnyAttributeAnnotation - extends BinaryAnnotation - implements XmlAnyAttributeAnnotation -{ - - public BinaryXmlAnyAttributeAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java deleted file mode 100644 index 09bd4937e7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java +++ /dev/null @@ -1,107 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyElement - */ -public final class BinaryXmlAnyElementAnnotation - extends BinaryAnnotation - implements XmlAnyElementAnnotation -{ - private Boolean lax; - private String value; - - - public BinaryXmlAnyElementAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.lax = this.buildLax(); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setLax_(this.buildLax()); - this.setValue_(this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlAnyElementAnnotation implementation ********** - - // ***** lax - public Boolean getLax() { - return this.lax; - } - - public void setLax(Boolean lax) { - throw new UnsupportedOperationException(); - } - - private void setLax_(Boolean lax) { - Boolean old = this.lax; - this.lax = lax; - this.firePropertyChanged(LAX_PROPERTY, old, lax); - } - - private Boolean buildLax() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ANY_ELEMENT__LAX); - } - - public TextRange getLaxTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** 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); - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ANY_ELEMENT__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified value class name - public String getFullyQualifiedValueClassName() { - return this.value; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java deleted file mode 100644 index decc7a278a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttachmentRef - */ -public final class BinaryXmlAttachmentRefAnnotation - extends BinaryAnnotation - implements XmlAttachmentRefAnnotation -{ - - public BinaryXmlAttachmentRefAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java deleted file mode 100644 index 44f0d3e9f9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java +++ /dev/null @@ -1,125 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttribute - */ -public final class BinaryXmlAttributeAnnotation - extends BinaryAnnotation - implements XmlAttributeAnnotation -{ - private String name; - private String namespace; - private Boolean required; - - - public BinaryXmlAttributeAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.required = this.buildRequired(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setRequired_(this.buildRequired()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlAttributeAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ATTRIBUTE__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ATTRIBUTE__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - throw new UnsupportedOperationException(); - } - - private void setRequired_(Boolean required) { - Boolean old = this.required; - this.required = required; - this.firePropertyChanged(REQUIRED_PROPERTY, old, required); - } - - private Boolean buildRequired() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ATTRIBUTE__REQUIRED); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java deleted file mode 100644 index 7e83bef0b4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java +++ /dev/null @@ -1,210 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlElement - */ -public final class BinaryXmlElementAnnotation - extends BinaryAnnotation - implements XmlElementAnnotation -{ - private String name; - private String namespace; - private String defaultValue; - private Boolean nillable; - private Boolean required; - private String type; - - - public BinaryXmlElementAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.defaultValue = this.buildDefaultValue(); - this.nillable = this.buildNillable(); - this.required = this.buildRequired(); - this.type = this.buildType(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setDefaultValue_(this.buildDefaultValue()); - this.setNillable_(this.buildNillable()); - this.setRequired_(this.buildRequired()); - this.setType_(this.buildType()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** default value - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - throw new UnsupportedOperationException(); - } - - private void setDefaultValue_(String defaultValue) { - String old = this.defaultValue; - this.defaultValue = defaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, defaultValue); - } - - private String buildDefaultValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__DEFAULT_VALUE); - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** nillable - public Boolean getNillable() { - return this.nillable; - } - - public void setNillable(Boolean nillable) { - throw new UnsupportedOperationException(); - } - - private void setNillable_(Boolean nillable) { - Boolean old = this.nillable; - this.nillable = nillable; - this.firePropertyChanged(NILLABLE_PROPERTY, old, nillable); - } - - private Boolean buildNillable() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT__NILLABLE); - } - - public TextRange getNillableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - throw new UnsupportedOperationException(); - } - - private void setRequired_(Boolean required) { - Boolean old = this.required; - this.required = required; - this.firePropertyChanged(REQUIRED_PROPERTY, old, required); - } - - private Boolean buildRequired() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT__REQUIRED); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - throw new UnsupportedOperationException(); - } - - private void setType_(String type) { - String old = this.type; - this.type = type; - this.firePropertyChanged(TYPE_PROPERTY, old, type); - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, type); - } - - private String buildType() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__TYPE); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified type name - public String getFullyQualifiedTypeName() { - return this.type; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java deleted file mode 100644 index 3f418fa470..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java +++ /dev/null @@ -1,209 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementDecl - */ -public final class BinaryXmlElementDeclAnnotation - extends BinaryAnnotation - implements XmlElementDeclAnnotation -{ - private String name; - private String namespace; - private String defaultValue; - private String scope; - private String substitutionHeadName; - private String substitutionHeadNamespace; - - - public BinaryXmlElementDeclAnnotation(JavaResourceMethod parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.defaultValue = this.buildDefaultValue(); - this.scope = this.buildScope(); - this.substitutionHeadName = this.buildSubstitutionHeadName(); - this.substitutionHeadNamespace = this.buildSubstitutionHeadNamespace(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setDefaultValue_(this.buildDefaultValue()); - this.setScope_(this.buildScope()); - this.setSubstitutionHeadName_(this.buildSubstitutionHeadName()); - this.setSubstitutionHeadNamespace_(this.buildSubstitutionHeadNamespace()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementDeclAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** default value - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - throw new UnsupportedOperationException(); - } - - private void setDefaultValue_(String defaultValue) { - String old = this.defaultValue; - this.defaultValue = defaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, defaultValue); - } - - private String buildDefaultValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__DEFAULT_VALUE); - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** scope - public String getScope() { - return this.scope; - } - - public void setScope(String scope) { - throw new UnsupportedOperationException(); - } - - private void setScope_(String scope) { - String old = this.scope; - this.scope = scope; - this.firePropertyChanged(SCOPE_PROPERTY, old, scope); - this.firePropertyChanged(FULLY_QUALIFIED_SCOPE_CLASS_NAME_PROPERTY, old, scope); - } - - private String buildScope() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__SCOPE); - } - - public TextRange getScopeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified scope class name - public String getFullyQualifiedScopeClassName() { - return this.scope; - } - - // ***** substitutionHeadName - public String getSubstitutionHeadName() { - return this.substitutionHeadName; - } - - public void setSubstitutionHeadName(String substitutionHeadName) { - throw new UnsupportedOperationException(); - } - - private void setSubstitutionHeadName_(String substitutionHeadName) { - String old = this.substitutionHeadName; - this.substitutionHeadName = substitutionHeadName; - this.firePropertyChanged(SUBSTITUTION_HEAD_NAME_PROPERTY, old, substitutionHeadName); - } - - private String buildSubstitutionHeadName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAME); - } - - public TextRange getSubstitutionHeadNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** substitutionHeadNamespace - public String getSubstitutionHeadNamespace() { - return this.substitutionHeadNamespace; - } - - public void setSubstitutionHeadNamespace(String substitutionHeadNamespace) { - throw new UnsupportedOperationException(); - } - - private void setSubstitutionHeadNamespace_(String substitutionHeadNamespace) { - String old = this.substitutionHeadNamespace; - this.substitutionHeadNamespace = substitutionHeadNamespace; - this.firePropertyChanged(SUBSTITUTION_HEAD_NAMESPACE_PROPERTY, old, substitutionHeadNamespace); - } - - private String buildSubstitutionHeadNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAMESPACE); - } - - public TextRange getSubstitutionHeadNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java deleted file mode 100644 index 685e505318..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java +++ /dev/null @@ -1,132 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementRef - */ -public final class BinaryXmlElementRefAnnotation - extends BinaryAnnotation - implements XmlElementRefAnnotation -{ - private String name; - private String namespace; - private String type; - - - public BinaryXmlElementRefAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.type = this.buildType(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setType_(this.buildType()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementRefAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - throw new UnsupportedOperationException(); - } - - private void setType_(String type) { - String old = this.type; - this.type = type; - this.firePropertyChanged(TYPE_PROPERTY, old, type); - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, type); - } - - private String buildType() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__TYPE); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified type name - public String getFullyQualifiedTypeName() { - return this.type; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java deleted file mode 100644 index 942fcb50eb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java +++ /dev/null @@ -1,151 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementWrapper - */ -public final class BinaryXmlElementWrapperAnnotation - extends BinaryAnnotation - implements XmlElementWrapperAnnotation -{ - private String name; - private String namespace; - private Boolean nillable; - private Boolean required; - - - public BinaryXmlElementWrapperAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.nillable = this.buildNillable(); - this.required = this.buildRequired(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setNillable_(this.buildNillable()); - this.setRequired_(this.buildRequired()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementWrapperAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** nillable - public Boolean getNillable() { - return this.nillable; - } - - public void setNillable(Boolean nillable) { - throw new UnsupportedOperationException(); - } - - private void setNillable_(Boolean nillable) { - Boolean old = this.nillable; - this.nillable = nillable; - this.firePropertyChanged(NILLABLE_PROPERTY, old, nillable); - } - - private Boolean buildNillable() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__NILLABLE); - } - - public TextRange getNillableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - throw new UnsupportedOperationException(); - } - - private void setRequired_(Boolean required) { - Boolean old = this.required; - this.required = required; - this.firePropertyChanged(REQUIRED_PROPERTY, old, required); - } - - private Boolean buildRequired() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__REQUIRED); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java deleted file mode 100644 index 9cfa9a45a6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jaxb.core.internal.resource.java.binary; - -import java.util.Vector; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation; - -/** - * javax.xml.bind.annotation.XmlElements - */ -public final class BinaryXmlElementsAnnotation - extends BinaryAnnotation - implements XmlElementsAnnotation -{ - private final Vector<XmlElementAnnotation> xmlElements; - - - public BinaryXmlElementsAnnotation(JavaResourceAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.xmlElements = this.buildXmlElements(); - } - - private Vector<XmlElementAnnotation> buildXmlElements() { - Object[] jdtXmlElements = this.getJdtMemberValues(JAXB.XML_ELEMENTS__VALUE); - Vector<XmlElementAnnotation> result = new Vector<XmlElementAnnotation>(jdtXmlElements.length); - for (Object jdtXmlElement : jdtXmlElements) { - result.add(new BinaryXmlElementAnnotation(this, (IAnnotation) jdtXmlElement)); - } - return result; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public ListIterable<XmlElementAnnotation> getXmlElements() { - return new LiveCloneListIterable<XmlElementAnnotation>(this.xmlElements); - } - - public int getXmlElementsSize() { - return this.xmlElements.size(); - } - - public XmlElementAnnotation xmlElementAt(int index) { - return this.xmlElements.elementAt(index); - } - - public XmlElementAnnotation addXmlElement(int index) { - throw new UnsupportedOperationException(); - } - - public void moveXmlElement(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeXmlElement(int index) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java deleted file mode 100644 index e073b9ca1e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java +++ /dev/null @@ -1,80 +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.jaxb.core.internal.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.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnum - */ -public final class BinaryXmlEnumAnnotation - extends BinaryAnnotation - implements XmlEnumAnnotation -{ - private String value; - - - public BinaryXmlEnumAnnotation(JavaResourceAbstractType 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); - } - - - // ********** XmlEnum 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); - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ENUM__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified value class name - public String getFullyQualifiedValueClassName() { - return this.value; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java deleted file mode 100644 index e726a7a6c7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java +++ /dev/null @@ -1,69 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnumValue - */ -public final class BinaryXmlEnumValueAnnotation - extends BinaryAnnotation - implements XmlEnumValueAnnotation -{ - - private String value; - - public BinaryXmlEnumValueAnnotation(JavaResourceEnumConstant 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()); - } - - - // ********** XmlEnumValueAnnotation 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(JAXB.XML_ENUM_VALUE__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java deleted file mode 100644 index cbc80e7c93..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; - -/** - * javax.xml.bind.annotation.XmlID - */ -public final class BinaryXmlIDAnnotation - extends BinaryAnnotation - implements XmlIDAnnotation -{ - - public BinaryXmlIDAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java deleted file mode 100644 index 76fab01bb1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; - -/** - * javax.xml.bind.annotation.XmlIDREF - */ -public final class BinaryXmlIDREFAnnotation - extends BinaryAnnotation - implements XmlIDREFAnnotation -{ - - public BinaryXmlIDREFAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlInlineBinaryDataAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlInlineBinaryDataAnnotation.java deleted file mode 100644 index c06a25dc4d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlInlineBinaryDataAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; - -/** - * javax.xml.bind.annotation.XmlInlineBinaryDataAnnotation - */ -public final class BinaryXmlInlineBinaryDataAnnotation - extends BinaryAnnotation - implements XmlInlineBinaryDataAnnotation -{ - - public BinaryXmlInlineBinaryDataAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdapterAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdapterAnnotation.java deleted file mode 100644 index 5ebee1b2f3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdapterAnnotation.java +++ /dev/null @@ -1,111 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -/** - * javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter - */ -public final class BinaryXmlJavaTypeAdapterAnnotation - extends BinaryAnnotation - implements XmlJavaTypeAdapterAnnotation { - - private String value; - - private String type; - - - public BinaryXmlJavaTypeAdapterAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = buildValue(); - this.type = buildType(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - setValue_(buildValue()); - setType_(buildType()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlJavaTypeAdapterAnnotation 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); - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JAXB.XML_JAVA_TYPE_ADAPTER__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public String getFullyQualifiedValue() { - return this.value; - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - throw new UnsupportedOperationException(); - } - - private void setType_(String type) { - String old = this.type; - this.type = type; - this.firePropertyChanged(TYPE_PROPERTY, old, type); - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_PROPERTY, old, type); - } - - private String buildType() { - return (String) this.getJdtMemberValue(JAXB.XML_JAVA_TYPE_ADAPTER__TYPE); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public String getFullyQualifiedType() { - return this.type; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java deleted file mode 100644 index e41b57feb9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java +++ /dev/null @@ -1,32 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; - -/** - * javax.xml.bind.annotation.XmlList - */ -public final class BinaryXmlListAnnotation - extends BinaryAnnotation - implements XmlListAnnotation -{ - - public BinaryXmlListAnnotation(JavaResourceMember - parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java deleted file mode 100644 index a7fd90a62e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java +++ /dev/null @@ -1,69 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlMimeType - */ -public final class BinaryXmlMimeTypeAnnotation - extends BinaryAnnotation - implements XmlMimeTypeAnnotation -{ - - private String value; - - public BinaryXmlMimeTypeAnnotation(JavaResourceMember 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()); - } - - - // ********** XmlMimeTypeAnnotation 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(JAXB.XML_MIME_TYPE__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java deleted file mode 100644 index 3897ba916d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation; - -/** - * javax.xml.bind.annotation.XmlMixed - */ -public final class BinaryXmlMixedAnnotation - extends BinaryAnnotation - implements XmlMixedAnnotation -{ - - public BinaryXmlMixedAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRegistryAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRegistryAnnotation.java deleted file mode 100644 index 62db135eeb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRegistryAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation; - -/** - * javax.xml.bind.annotation.XmlRegistry - */ -public final class BinaryXmlRegistryAnnotation - extends BinaryAnnotation - implements XmlRegistryAnnotation -{ - - public BinaryXmlRegistryAnnotation(JavaResourceAbstractType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java deleted file mode 100644 index 6ec68ce24d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java +++ /dev/null @@ -1,109 +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.jaxb.core.internal.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.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlRootElement - */ -public final class BinaryXmlRootElementAnnotation - extends BinaryAnnotation - implements XmlRootElementAnnotation -{ - private String name; - private String namespace; - - - public BinaryXmlRootElementAnnotation(JavaResourceAbstractType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlRootElementAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ROOT_ELEMENT__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ROOT_ELEMENT__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSeeAlsoAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSeeAlsoAnnotation.java deleted file mode 100644 index 4603000057..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSeeAlsoAnnotation.java +++ /dev/null @@ -1,100 +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.jaxb.core.internal.resource.java.binary; - -import java.util.Vector; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation; - -/** - * javax.xml.bind.annotation.XmlSeeAlso - */ -public final class BinaryXmlSeeAlsoAnnotation - extends BinaryAnnotation - implements XmlSeeAlsoAnnotation { - - private final Vector<String> classes; - - - public BinaryXmlSeeAlsoAnnotation(JavaResourceAbstractType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.classes = this.buildClasses(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateClasses(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.classes); - } - - - // ********** XmlSeeAlsoAnnotation implementation ********** - - // ***** value - public ListIterable<String> getClasses() { - return new LiveCloneListIterable<String>(this.classes); - } - - public int getClassesSize() { - return this.classes.size(); - } - - private Vector<String> buildClasses() { - Object[] jdtClasses = this.getJdtMemberValues(JAXB.XML_SEE_ALSO__VALUE); - Vector<String> result = new Vector<String>(jdtClasses.length); - for (Object jdtClass : jdtClasses) { - result.add((String) jdtClass); - } - return result; - } - - public void addClass(String clazz) { - throw new UnsupportedOperationException(); - } - - public void addClass(int index, String clazz) { - throw new UnsupportedOperationException(); - } - - public void moveClass(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeClass(String clazz) { - throw new UnsupportedOperationException(); - } - - public void removeClass(int index) { - throw new UnsupportedOperationException(); - } - - public ListIterable<String> getFullyQualifiedClasses() { - return getClasses(); - } - - // TODO - private void updateClasses() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTransientAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTransientAnnotation.java deleted file mode 100644 index 81c43cbd10..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTransientAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -/** - * javax.xml.bind.annotation.XmlTransient - */ -public final class BinaryXmlTransientAnnotation - extends BinaryAnnotation - implements XmlTransientAnnotation -{ - - public BinaryXmlTransientAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java deleted file mode 100644 index d9f5c8cbbe..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb.core.internal.resource.java.binary; - -import java.util.Vector; -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.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlType - */ -public final class BinaryXmlTypeAnnotation - extends BinaryAnnotation - implements XmlTypeAnnotation -{ - private String factoryClass; - private String factoryMethod; - private String name; - private String namespace; - private final Vector<String> propOrder; - - - public BinaryXmlTypeAnnotation(JavaResourceAbstractType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.factoryClass = this.buildFactoryClass(); - this.factoryMethod = this.buildFactoryMethod(); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.propOrder = this.buildPropOrder(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setFactoryClass_(this.buildFactoryClass()); - this.setFactoryMethod_(this.buildFactoryMethod()); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlTypeAnnotation implementation ********** - - // ***** factoryClass - public String getFactoryClass() { - return this.factoryClass; - } - - public void setFactoryClass(String factoryClass) { - throw new UnsupportedOperationException(); - } - - private void setFactoryClass_(String factoryClass) { - String old = this.factoryClass; - this.factoryClass = factoryClass; - this.firePropertyChanged(FACTORY_CLASS_PROPERTY, old, factoryClass); - this.firePropertyChanged(FULLY_QUALIFIED_FACTORY_CLASS_NAME_PROPERTY, old, factoryClass); - } - - private String buildFactoryClass() { - return (String) this.getJdtMemberValue(JAXB.XML_TYPE__FACTORY_CLASS); - } - - public TextRange getFactoryClassTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified factory class name - public String getFullyQualifiedFactoryClassName() { - return this.factoryClass; - } - - // ***** factoryMethod - public String getFactoryMethod() { - return this.factoryMethod; - } - - public void setFactoryMethod(String factoryMethod) { - throw new UnsupportedOperationException(); - } - - private void setFactoryMethod_(String factoryMethod) { - String old = this.factoryMethod; - this.factoryMethod = factoryMethod; - this.firePropertyChanged(FACTORY_METHOD_PROPERTY, old, factoryMethod); - } - - private String buildFactoryMethod() { - return (String) this.getJdtMemberValue(JAXB.XML_TYPE__FACTORY_METHOD); - } - - public TextRange getFactoryMethodTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_TYPE__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_TYPE__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ***** prop order - public ListIterable<String> getPropOrder() { - return new LiveCloneListIterable<String>(this.propOrder); - } - - public int getPropOrderSize() { - return this.propOrder.size(); - } - - private Vector<String> buildPropOrder() { - Object[] jdtPropOrder = this.getJdtMemberValues(JAXB.XML_TYPE__PROP_ORDER); - Vector<String> result = new Vector<String>(jdtPropOrder.length); - for (Object jdtProp : jdtPropOrder) { - result.add((String) jdtProp); - } - return result; - } - - public void addProp(String propOrder) { - throw new UnsupportedOperationException(); - } - - public void addProp(int index, String propOrder) { - throw new UnsupportedOperationException(); - } - - public void moveProp(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeProp(String propOrder) { - throw new UnsupportedOperationException(); - } - - public void removeProp(int index) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java deleted file mode 100644 index d07f3d990c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java +++ /dev/null @@ -1,31 +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.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlValue - */ -public final class BinaryXmlValueAnnotation - extends BinaryAnnotation - implements XmlValueAnnotation -{ - - public BinaryXmlValueAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/AbstractJavaResourceNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/AbstractJavaResourceNode.java deleted file mode 100644 index c2ddcd153b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/AbstractJavaResourceNode.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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.jaxb.core.internal.resource.java.source; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * Java resource containment hierarchy - */ -public abstract class AbstractJavaResourceNode - extends AbstractModel - implements JavaResourceNode -{ - protected final JavaResourceNode parent; - - - // ********** constructor ********** - - protected AbstractJavaResourceNode(JavaResourceNode parent) { - super(); - this.checkParent(parent); - this.parent = parent; - } - - protected JavaResourceNode getParent() { - return this.parent; - } - - // ********** parent ********** - - protected void checkParent(JavaResourceNode p) { - if (p == null) { - if (this.requiresParent()) { - throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$ - } - } else { - if (this.forbidsParent()) { - throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$ - } - } - } - - protected boolean requiresParent() { - return true; - } - - protected boolean forbidsParent() { - return ! this.requiresParent(); // assume 'parent' is not optional - } - - - // ********** change support callback hook ********** - - @Override - protected final ChangeSupport buildChangeSupport() { - return new AspectChangeSupport(this, this.buildChangeSupportListener()); - } - - private AspectChangeSupport.Listener buildChangeSupportListener() { - return new AspectChangeSupport.Listener() { - public void aspectChanged(String aspectName) { - AbstractJavaResourceNode.this.aspectChanged(aspectName); - } - }; - } - - /** - * ignore the aspect name, we notify listeners of *every* change - */ - protected void aspectChanged(@SuppressWarnings("unused") String aspectName) { - this.getRoot().resourceModelChanged(); - } - - - // ********** JavaResourceNode implementation ********** - - /** - * @see org.eclipse.jpt.core.internal.resource.java.source.SourceCompilationUnit#getRoot() - * @see org.eclipse.jpt.core.internal.resource.java.binary.BinaryPackageFragmentRoot#getRoot() - * @see org.eclipse.jpt.core.internal.resource.java.binary.BinaryPersistentTypeCache#getRoot() - */ - public Root getRoot() { - return this.parent.getRoot(); - } - - public IFile getFile() { - return this.getRoot().getFile(); - } - - - // ********** convenience methods ********** - - protected AnnotationProvider getAnnotationProvider() { - return this.getRoot().getAnnotationProvider(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAbstractType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAbstractType.java deleted file mode 100644 index 543b40493b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAbstractType.java +++ /dev/null @@ -1,194 +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.jaxb.core.internal.resource.java.source; - -import java.util.HashMap; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.SimpleIntReference; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; - -/** - * Java source type - */ -abstract class SourceAbstractType<A extends AbstractType> - extends SourceMember<A> - implements JavaResourceAbstractType -{ - private String name; - - private String qualifiedName; - - private String packageName; - - private String declaringTypeName; - - private boolean memberType; - - - // ********** construction/initialization ********** - - protected SourceAbstractType(JavaResourceCompilationUnit javaResourceCompilationUnit, A type) { - super(javaResourceCompilationUnit, type); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - ITypeBinding binding = this.annotatedElement.getBinding(astRoot); - this.name = this.buildName(binding); - this.qualifiedName = this.buildQualifiedName(binding); - this.packageName = this.buildPackageName(binding); - this.declaringTypeName = this.buildDeclaringTypeName(binding); - this.memberType = this.buildMemberType(binding); - } - - - // ********** update ********** - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - ITypeBinding binding = this.annotatedElement.getBinding(astRoot); - this.syncName(this.buildName(binding)); - this.syncQualifiedName(this.buildQualifiedName(binding)); - this.syncPackageName(this.buildPackageName(binding)); - this.syncDeclaringTypeName(this.buildDeclaringTypeName(binding)); - this.syncMemberType(this.buildMemberType(binding)); - } - - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ******** JavaResourceAbstractType implementation ******** - - // ***** name - public String getName() { - return this.name; - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(ITypeBinding binding) { - return (binding == null) ? null : binding.getName(); - } - - // ***** qualified name - public String getQualifiedName() { - return this.qualifiedName; - } - - private void syncQualifiedName(String astQualifiedName) { - String old = this.qualifiedName; - this.qualifiedName = astQualifiedName; - this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, astQualifiedName); - } - - private String buildQualifiedName(ITypeBinding binding) { - return (binding == null) ? null : binding.getQualifiedName(); - } - - // ***** package name - public String getPackageName() { - return this.packageName; - } - - private void syncPackageName(String astPackageName) { - String old = this.packageName; - this.packageName = astPackageName; - this.firePropertyChanged(PACKAGE_NAME_PROPERTY, old, astPackageName); - } - - private String buildPackageName(ITypeBinding binding) { - return (binding == null) ? null : binding.getPackage().getName(); - } - - // ***** package - public boolean isIn(IPackageFragment packageFragment) { - return StringTools.stringsAreEqual(packageFragment.getElementName(), this.packageName); - } - - // ***** declaring type name - public String getDeclaringTypeName() { - return this.declaringTypeName; - } - - private void syncDeclaringTypeName(String astDeclaringTypeName) { - String old = this.declaringTypeName; - this.declaringTypeName = astDeclaringTypeName; - this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, astDeclaringTypeName); - } - - private String buildDeclaringTypeName(ITypeBinding binding) { - if (binding == null) { - return null; - } - ITypeBinding declaringClass = binding.getDeclaringClass(); - return (declaringClass == null) ? null : declaringClass.getTypeDeclaration().getQualifiedName(); - } - - // ***** member type - public boolean isMemberType() { - return this.memberType; - } - - private void syncMemberType(boolean memberType) { - boolean old = this.memberType; - this.memberType = memberType; - this.firePropertyChanged(MEMBER_TYPE_PROPERTY, old, memberType); - } - - private boolean buildMemberType(ITypeBinding binding) { - return (binding == null) ? false : binding.isMember(); - } - - public boolean isMapped() { - return ! CollectionTools.isEmpty(getAnnotations()); - } - - - // ********** CounterMap ********** - - protected static class CounterMap { - private final HashMap<Object, SimpleIntReference> counters; - - protected CounterMap(int initialCapacity) { - super(); - this.counters = new HashMap<Object, SimpleIntReference>(initialCapacity); - } - - /** - * Return the incremented count for the specified object. - */ - int increment(Object o) { - SimpleIntReference counter = this.counters.get(o); - if (counter == null) { - counter = new SimpleIntReference(); - this.counters.put(o, counter); - } - counter.increment(); - return counter.getValue(); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java deleted file mode 100644 index f92161e939..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java +++ /dev/null @@ -1,500 +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.jaxb.core.internal.resource.java.source; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ASTVisitor; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTNodeTextRange; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; - -/** - * Java source annotated element (annotations) - */ -abstract class SourceAnnotatedElement<A extends AnnotatedElement> - extends SourceNode - implements JavaResourceAnnotatedElement -{ - final A annotatedElement; - - /** - * annotations; no duplicates (java compiler has an error for duplicates) - */ - final Vector<Annotation> annotations = new Vector<Annotation>(); - - /** - * Annotation containers keyed on nestable annotation name. - * This is used to store annotations that can be both standalone and nested - * and are moved back and forth between the 2. - */ - final Map<String, AnnotationContainer> annotationContainers = new HashMap<String, AnnotationContainer>(); - - // ********** construction/initialization ********** - - SourceAnnotatedElement(JavaResourceNode parent, A annotatedElement) { - super(parent); - this.annotatedElement = annotatedElement; - } - - public void initialize(CompilationUnit astRoot) { - ASTNode node = this.annotatedElement.getBodyDeclaration(astRoot); - node.accept(this.buildInitialAnnotationVisitor(node)); - } - - private ASTVisitor buildInitialAnnotationVisitor(ASTNode node) { - return new InitialAnnotationVisitor(node); - } - - /** - * called from {@link InitialAnnotationVisitor} - */ - /* private */ void addInitialAnnotation(org.eclipse.jdt.core.dom.Annotation node) { - String jdtAnnotationName = ASTTools.resolveAnnotation(node); - if (jdtAnnotationName != null) { - if (this.annotationIsValid(jdtAnnotationName)) { - if (this.selectAnnotationNamed(this.annotations, jdtAnnotationName) == null) { // ignore duplicates - Annotation annotation = this.buildAnnotation(jdtAnnotationName); - annotation.initialize((CompilationUnit) node.getRoot()); - this.annotations.add(annotation); - } - } - else if(this.annotationIsValidNestable(jdtAnnotationName)) { - AnnotationContainer container = new AnnotationContainer(jdtAnnotationName); - container.initializeNestableAnnotation(node); - this.annotationContainers.put(jdtAnnotationName, container); - } - else if(this.annotationIsValidContainer(jdtAnnotationName)) { - String nestableAnnotationName = this.getNestableAnnotationName(jdtAnnotationName); - AnnotationContainer container = new AnnotationContainer(nestableAnnotationName); - container.initialize(node); - this.annotationContainers.put(nestableAnnotationName, container); - } - } - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncAnnotations(this.annotatedElement.getBodyDeclaration(astRoot)); - } - - - // ********** annotations ********** - - public Iterable<Annotation> getAnnotations() { - return new LiveCloneIterable<Annotation>(this.annotations); - } - - public int getAnnotationsSize() { - return this.annotations.size(); - } - - public Annotation getAnnotation(String annotationName) { - return this.selectAnnotationNamed(this.getAnnotations(), annotationName); - } - - public Annotation getNonNullAnnotation(String annotationName) { - Annotation annotation = this.getAnnotation(annotationName); - return (annotation != null) ? annotation : this.buildNullAnnotation(annotationName); - } - - public ListIterable<NestableAnnotation> getAnnotations(String nestableAnnotationName) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - return container != null ? container.getNestedAnnotations() : EmptyListIterable.<NestableAnnotation> instance(); - } - - public int getAnnotationsSize(String nestableAnnotationName) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - return container == null ? 0 : container.getNestedAnnotationsSize(); - } - - public NestableAnnotation getAnnotation(int index, String nestableAnnotationName) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - return container == null ? null : container.nestedAnnotationAt(index); - } - - private String getNestableAnnotationName(String containerAnnotationName) { - return getAnnotationProvider().getNestableAnnotationName(containerAnnotationName); - } - - private String getNestableElementName(String nestableAnnotationName) { - return getAnnotationProvider().getNestableElementName(nestableAnnotationName); - } - - public Annotation addAnnotation(String annotationName) { - Annotation annotation = this.buildAnnotation(annotationName); - this.annotations.add(annotation); - annotation.newAnnotation(); - return annotation; - } - - /** - * 1. check for a container annotation; - * if it is present, add a nested annotation to it - * 2. check for a stand-alone nested annotation; - * if it is missing, add a stand-alone nested annotation - * 3. if there is an existing stand-alone nested annotation, - * add a container annotation and move the stand-alone nested annotation to it - * and add a new nested annotation to it also - */ - public NestableAnnotation addAnnotation(int index, String nestableAnnotationName) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - if (container == null) { - container = new AnnotationContainer(nestableAnnotationName); - this.annotationContainers.put(nestableAnnotationName, container); - } - return container.addNestedAnnotation(index); - } - - public void moveAnnotation(int targetIndex, int sourceIndex, String nestableAnnotationName) { - this.annotationContainers.get(nestableAnnotationName).moveNestedAnnotation(targetIndex, sourceIndex); - } - - public void removeAnnotation(String annotationName) { - Annotation annotation = this.getAnnotation(annotationName); - if (annotation != null) { - this.removeAnnotation(annotation); - } - } - - private void removeAnnotation(Annotation annotation) { - this.annotations.remove(annotation); - annotation.removeAnnotation(); - } - - public void removeAnnotation(int index, String nestableAnnotationName) { - this.annotationContainers.get(nestableAnnotationName).removeNestedAnnotation(index); - } - - private boolean annotationIsValid(String annotationName) { - return CollectionTools.contains(this.getValidAnnotationNames(), annotationName); - } - - private boolean annotationIsValidContainer(String annotationName) { - return CollectionTools.contains(this.getValidContainerAnnotationNames(), annotationName); - } - - private boolean annotationIsValidNestable(String annotationName) { - return CollectionTools.contains(this.getValidNestableAnnotationNames(), annotationName); - } - - Iterable<String> getValidAnnotationNames() { - return this.getAnnotationProvider().getAnnotationNames(); - } - - Iterable<String> getValidContainerAnnotationNames() { - return this.getAnnotationProvider().getContainerAnnotationNames(); - } - - Iterable<String> getValidNestableAnnotationNames() { - return this.getAnnotationProvider().getNestableAnnotationNames(); - } - - Annotation buildAnnotation(String annotationName) { - return this.getAnnotationProvider().buildAnnotation(this, this.annotatedElement, annotationName); - } - - Annotation buildNullAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullAnnotation(this, annotationName); - } - - NestableAnnotation buildNestableAnnotation(String annotationName, int index) { - return this.getAnnotationProvider().buildAnnotation(this, this.annotatedElement, annotationName, index); - } - - private void syncAnnotations(ASTNode node) { - HashSet<Annotation> annotationsToRemove = new HashSet<Annotation>(this.annotations); - - HashSet<AnnotationContainer> containersToRemove = new HashSet<AnnotationContainer>(this.annotationContainers.values()); - node.accept(this.buildSynchronizeAnnotationVisitor(node, annotationsToRemove, containersToRemove)); - - for (Annotation annotation : annotationsToRemove) { - this.removeItemFromCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION); - } - - for (AnnotationContainer annotationContainer : containersToRemove) { - this.annotationContainers.remove(annotationContainer.getNestedAnnotationName()); - fireItemsRemoved(NESTABLE_ANNOTATIONS_COLLECTION, CollectionTools.collection(annotationContainer.getNestedAnnotations())); - } - - Iterator<String> keys = this.annotationContainers.keySet().iterator(); - - while (keys.hasNext()) { - String annotationName = keys.next(); - if (this.annotationContainers.get(annotationName).getNestedAnnotationsSize() == 0) { - keys.remove(); - } - } - } - - private ASTVisitor buildSynchronizeAnnotationVisitor(ASTNode node, Set<Annotation> annotationsToRemove, Set<AnnotationContainer> containersToRemove) { - return new SynchronizeAnnotationVisitor(node, annotationsToRemove, containersToRemove); - } - - /** - * called from {@link SynchronizeAnnotationVisitor} - */ - /* private */ void addOrSyncAnnotation(org.eclipse.jdt.core.dom.Annotation node, Set<Annotation> annotationsToRemove, Set<AnnotationContainer> containersToRemove) { - String jdtAnnotationName = ASTTools.resolveAnnotation(node); - if (jdtAnnotationName != null) { - if (this.annotationIsValid(jdtAnnotationName)) { - this.addOrSyncAnnotation_(node, jdtAnnotationName, annotationsToRemove); - } - else if(this.annotationIsValidNestable(jdtAnnotationName)) { - this.addOrSyncNestableAnnotation_(node, jdtAnnotationName, containersToRemove); - } - else if(this.annotationIsValidContainer(jdtAnnotationName)) { - this.addOrSyncContainerAnnotation_(node, jdtAnnotationName, containersToRemove); - } - } - } - - /** - * pre-condition: jdtAnnotationName is valid - */ - private void addOrSyncAnnotation_(org.eclipse.jdt.core.dom.Annotation node, String jdtAnnotationName, Set<Annotation> annotationsToRemove) { - Annotation annotation = this.selectAnnotationNamed(annotationsToRemove, jdtAnnotationName); - if (annotation != null) { - annotation.synchronizeWith((CompilationUnit) node.getRoot()); - annotationsToRemove.remove(annotation); - } else { - annotation = this.buildAnnotation(jdtAnnotationName); - annotation.initialize((CompilationUnit) node.getRoot()); - this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION); - } - } - - /** - * pre-condition: jdtAnnotationName is valid - */ - private void addOrSyncNestableAnnotation_(org.eclipse.jdt.core.dom.Annotation node, String nestableAnnotationName, Set<AnnotationContainer> containersToRemove) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - if (container != null) { - container.synchronizeNestableAnnotation(node); - containersToRemove.remove(container); - } - else { - container = new AnnotationContainer(nestableAnnotationName); - container.initializeNestableAnnotation(node); - this.annotationContainers.put(nestableAnnotationName, container); - this.fireItemAdded(NESTABLE_ANNOTATIONS_COLLECTION, container.nestedAnnotationAt(0)); - } - } - - /** - * pre-condition: node is valid container annotation - */ - private void addOrSyncContainerAnnotation_(org.eclipse.jdt.core.dom.Annotation node, String containerAnnotationName, Set<AnnotationContainer> containersToRemove) { - String nestableAnnotationName = this.getNestableAnnotationName(containerAnnotationName); - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - if (container == null) { - container = new AnnotationContainer(nestableAnnotationName); - container.initialize(node); - this.annotationContainers.put(nestableAnnotationName, container); - this.fireItemsAdded(NESTABLE_ANNOTATIONS_COLLECTION, CollectionTools.collection(container.getNestedAnnotations())); - } - else { - container.synchronize(node); - containersToRemove.remove(container); - } - } - - - // ********** miscellaneous ********** - - public boolean isAnnotated() { - return ! this.annotations.isEmpty() || ! this.annotationContainers.isEmpty(); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return this.fullTextRange(astRoot); - } - - private TextRange fullTextRange(CompilationUnit astRoot) { - return this.buildTextRange(this.annotatedElement.getBodyDeclaration(astRoot)); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.annotatedElement.getNameTextRange(astRoot); - } - - private Annotation selectAnnotationNamed(Iterable<Annotation> list, String annotationName) { - for (Annotation annotation : list) { - if (annotation.getAnnotationName().equals(annotationName)) { - return annotation; - } - } - return null; - } - - private TextRange buildTextRange(ASTNode astNode) { - return (astNode == null) ? null : new ASTNodeTextRange(astNode); - } - - - // ********** AST visitors ********** - - /** - * annotation visitor - */ - protected static abstract class AnnotationVisitor - extends ASTVisitor - { - protected final ASTNode node; - - - protected AnnotationVisitor(ASTNode node) { - super(); - this.node = node; - } - - @Override - public boolean visit(SingleMemberAnnotation node) { - return this.visit_(node); - } - - @Override - public boolean visit(NormalAnnotation node) { - return this.visit_(node); - } - - @Override - public boolean visit(MarkerAnnotation node) { - return this.visit_(node); - } - - protected boolean visit_(org.eclipse.jdt.core.dom.Annotation node) { - // ignore annotations for child members, only this member - if (node.getParent() == this.node) { - this.visitChildAnnotation(node); - } - return false; - } - - protected abstract void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node); - } - - - /** - * initial annotation visitor - */ - protected class InitialAnnotationVisitor - extends AnnotationVisitor - { - protected InitialAnnotationVisitor(ASTNode node) { - super(node); - } - - @Override - protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) { - SourceAnnotatedElement.this.addInitialAnnotation(node); - } - } - - - /** - * synchronize annotation visitor - */ - protected class SynchronizeAnnotationVisitor - extends AnnotationVisitor - { - protected final Set<Annotation> annotationsToRemove; - protected final Set<AnnotationContainer> containersToRemove; - - protected SynchronizeAnnotationVisitor(ASTNode node, Set<Annotation> annotationsToRemove, Set<AnnotationContainer> containersToRemove) { - super(node); - this.annotationsToRemove = annotationsToRemove; - this.containersToRemove = containersToRemove; - } - - @Override - protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) { - SourceAnnotatedElement.this.addOrSyncAnnotation(node, this.annotationsToRemove, this.containersToRemove); - } - } - - - class AnnotationContainer extends SourceNode.AnnotationContainer<NestableAnnotation> - { - private final String nestableAnnotationName; - - protected AnnotationContainer(String nestableAnnotationName) { - super(); - this.nestableAnnotationName = nestableAnnotationName; - } - - /** - * Return the element name of the nested annotations - */ - @Override - protected String getElementName() { - return SourceAnnotatedElement.this.getNestableElementName(this.nestableAnnotationName); - } - - /** - * Return the nested annotation name - */ - @Override - protected String getNestedAnnotationName() { - return this.nestableAnnotationName; - } - - /** - * Return a new nested annotation at the given index - */ - @Override - protected NestableAnnotation buildNestedAnnotation(int index) { - return SourceAnnotatedElement.this.buildNestableAnnotation(this.nestableAnnotationName, index); - } - - public void initializeNestableAnnotation(org.eclipse.jdt.core.dom.Annotation standaloneNestableAnnotation) { - NestableAnnotation nestedAnnotation = this.buildNestedAnnotation(0); - this.nestedAnnotations.add(nestedAnnotation); - nestedAnnotation.initialize((CompilationUnit) standaloneNestableAnnotation.getRoot()); - } - - public void synchronizeNestableAnnotation(org.eclipse.jdt.core.dom.Annotation standaloneNestableAnnotation) { - if (this.getNestedAnnotationsSize() > 1) { - //ignore the new standalone annotation as a container annotation already exists - } - else if (this.getNestedAnnotationsSize() == 1) { - this.nestedAnnotationAt(0).synchronizeWith((CompilationUnit) standaloneNestableAnnotation.getRoot()); - } - } - - @Override - protected void fireItemAdded(int index, NestableAnnotation nestedAnnotation) { - SourceAnnotatedElement.this.fireItemAdded(NESTABLE_ANNOTATIONS_COLLECTION, nestedAnnotation); - } - - @Override - protected void fireItemsRemoved(int index, List<NestableAnnotation> removedItems) { - SourceAnnotatedElement.this.fireItemsRemoved(NESTABLE_ANNOTATIONS_COLLECTION, removedItems); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotation.java deleted file mode 100644 index db2e0b4f22..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotation.java +++ /dev/null @@ -1,175 +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.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTNodeTextRange; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -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.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; - -/** - * some common state and behavior for Java source annotations; - * and lots of convenience methods - */ -public abstract class SourceAnnotation<A extends AnnotatedElement> - extends SourceNode - implements Annotation -{ - protected final A annotatedElement; - - protected final DeclarationAnnotationAdapter daa; - - protected final AnnotationAdapter annotationAdapter; - - - /** - * constructor for straight member annotation - */ - protected SourceAnnotation(JavaResourceNode parent, A annotatedElement, DeclarationAnnotationAdapter daa) { - this(parent, annotatedElement, daa, new ElementAnnotationAdapter(annotatedElement, daa)); - } - - /** - * constructor for nested annotation (typically) - */ - protected SourceAnnotation(JavaResourceNode parent, A annotatedElement, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent); - this.annotatedElement = annotatedElement; - this.daa = daa; - this.annotationAdapter = annotationAdapter; - } - - - // ********** JavaResourceNode implementation ********** - - public TextRange getTextRange(CompilationUnit astRoot) { - return this.getAnnotationTextRange(astRoot); - } - - - // ********** Annotation implementation ********** - - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - return this.annotationAdapter.getAnnotation(astRoot); - } - - public void newAnnotation() { - this.annotationAdapter.newMarkerAnnotation(); - } - - public void removeAnnotation() { - this.annotationAdapter.removeAnnotation(); - } - - - // ********** convenience methods ********** - - /** - * Return the text range corresponding to the annotation. - * If the annotation is missing, return null. - */ - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - return this.getTextRange(this.getAstAnnotation(astRoot)); - } - - /** - * Convenience method. - * Return the text range corresponding to the specified element. - * If the specified element is missing, return the annotation's text range instead. - */ - protected TextRange getElementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) { - return this.getElementTextRange(this.getAnnotationElementTextRange(elementAdapter, astRoot), astRoot); - } - - /** - * Convenience method. If the specified element text range is null - * return the member's text range instead. - */ - protected TextRange getElementTextRange(TextRange elementTextRange, CompilationUnit astRoot) { - return (elementTextRange != null) ? elementTextRange : this.getAnnotationTextRange(astRoot); - } - - /** - * Convenience method. Return whether the specified position exists and - * touches the specified element. - */ - protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) { - return this.textRangeTouches(this.getAnnotationElementTextRange(elementAdapter, astRoot), pos); - } - - /** - * Convenience method. Return whether the specified text range is not - * null (meaning the corresponding AST node exists) and the specified position touches it. - */ - protected boolean textRangeTouches(TextRange textRange, int pos) { - return (textRange != null) && textRange.touches(pos); - } - - /** - * Return the text range corresponding to the specified element. - * If the element is missing, return null. - */ - protected TextRange getAnnotationElementTextRange(DeclarationAnnotationElementAdapter<?> adapter, CompilationUnit astRoot) { - return this.getTextRange(this.getAnnotationElementExpression(adapter, astRoot)); - } - - /** - * Return the specified AST DOM element. - */ - protected Expression getAnnotationElementExpression(DeclarationAnnotationElementAdapter<?> adapter, CompilationUnit astRoot) { - return adapter.getExpression(this.annotatedElement.getModifiedDeclaration(astRoot)); - } - - /** - * Return the text range corresponding to the specified AST node. - * If the AST node is null, return null. - */ - protected TextRange getTextRange(ASTNode astNode) { - return (astNode == null) ? null : new ASTNodeTextRange(astNode); - } - - - - /** - * A container for nested annotations. The owner of the AnnotationContainer - * needs to call initialize(CompilationUnit) on it. - * @param <T> the type of the resource nestable annotations - */ - abstract class AnnotationContainer<T extends NestableAnnotation> extends SourceNode.AnnotationContainer<T> - { - protected AnnotationContainer() { - super(); - } - - /** - * Return the annotations property name for firing property change notification - */ - protected abstract String getAnnotationsPropertyName(); - - @Override - protected void fireItemAdded(int index, T addedItem) { - SourceAnnotation.this.fireItemAdded(this.getAnnotationsPropertyName(), index, addedItem); - } - - @Override - protected void fireItemsRemoved(int index, java.util.List<T> removedItems) { - SourceAnnotation.this.fireItemsRemoved(this.getAnnotationsPropertyName(), index, removedItems); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java deleted file mode 100644 index f43d19bf87..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java +++ /dev/null @@ -1,321 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 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.jaxb.core.internal.resource.java.source; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source attribute (field or method) - */ -abstract class SourceAttribute<A extends Attribute> - extends SourceMember<A> - implements JavaResourceAttribute -{ - private int modifiers; - - private String typeName; - - private boolean typeIsInterface; - - private boolean typeIsEnum; - - private boolean typeIsArray; - - private final Vector<String> typeSuperclassNames = new Vector<String>(); - - private final Vector<String> typeInterfaceNames = new Vector<String>(); - - private final Vector<String> typeTypeArgumentNames = new Vector<String>(); - - - protected SourceAttribute(JavaResourceType parent, A attribute){ - super(parent, attribute); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - ITypeBinding typeBinding = this.getTypeBinding(astRoot); //build once, minor performance tweak for major benefit - this.modifiers = this.buildModifiers(astRoot); - this.typeName = this.buildTypeName(typeBinding); - this.typeIsInterface = this.buildTypeIsInterface(typeBinding); - this.typeIsEnum = this.buildTypeIsEnum(typeBinding); - this.typeIsArray = this.buildTypeIsArray(typeBinding); - this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(typeBinding)); - this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(typeBinding)); - this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames(typeBinding)); - } - - - // ******** overrides ******** - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - ITypeBinding typeBinding = this.getTypeBinding(astRoot);//build once, minor performance tweak for major benefit - this.syncTypeName(this.buildTypeName(typeBinding)); - this.syncTypeSuperclassNames(this.buildTypeSuperclassNames(typeBinding)); - this.syncTypeInterfaceNames(this.buildTypeInterfaceNames(typeBinding)); - this.syncTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(typeBinding)); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - ITypeBinding typeBinding = this.getTypeBinding(astRoot);//build once, minor performance tweak for major benefit - this.syncModifiers(this.buildModifiers(astRoot)); - this.syncTypeName(this.buildTypeName(typeBinding)); - this.syncTypeIsInterface(this.buildTypeIsInterface(typeBinding)); - this.syncTypeIsEnum(this.buildTypeIsEnum(typeBinding)); - this.syncTypeIsArray(this.buildTypeIsArray(typeBinding)); - this.syncTypeSuperclassNames(this.buildTypeSuperclassNames(typeBinding)); - this.syncTypeInterfaceNames(this.buildTypeInterfaceNames(typeBinding)); - this.syncTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(typeBinding)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - - // ******** JavaResourcePersistentAttribute implementation ******** - - public String getName() { - return this.annotatedElement.getAttributeName(); - } - - public boolean typeIsSubTypeOf(String tn) { - if (this.typeName == null) { - return false; - } - return this.typeName.equals(tn) - || this.typeInterfaceNames.contains(tn) - || this.typeSuperclassNames.contains(tn); - } - - public boolean typeIsVariablePrimitive() { - return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName); - } - - private ITypeBinding getTypeBinding(CompilationUnit astRoot) { - return this.annotatedElement.getTypeBinding(astRoot); - } - - - // ***** modifiers - public int getModifiers() { - return this.modifiers; - } - - private void syncModifiers(int astModifiers) { - int old = this.modifiers; - this.modifiers = astModifiers; - this.firePropertyChanged(MODIFIERS_PROPERTY, old, astModifiers); - } - - /** - * zero seems like a reasonable default... - */ - private int buildModifiers(CompilationUnit astRoot) { - IBinding binding = this.annotatedElement.getBinding(astRoot); - return (binding == null) ? 0 : binding.getModifiers(); - } - - // ***** type name - public String getTypeName() { - return this.typeName; - } - - private void syncTypeName(String astTypeName) { - String old = this.typeName; - this.typeName = astTypeName; - this.firePropertyChanged(TYPE_NAME_PROPERTY, old, astTypeName); - } - - /** - * this can be an array (e.g. "java.lang.String[]"); - * but no generic type arguments - */ - private String buildTypeName(ITypeBinding typeBinding) { - if (typeBinding == null) { - return null; - } - // a type variable is what is declared by a generic type; - // e.g. "E" is a type variable declared by the generic type "Collection" in - // public interface Collection<E> - if (typeBinding.isTypeVariable()) { - // e.g. "E extends Number" has an erasure of "Number" - typeBinding = typeBinding.getErasure(); - } - String tbName = typeBinding.getTypeDeclaration().getQualifiedName(); - return (tbName.length() == 0) ? null : tbName; - } - - // ***** type is interface - public boolean typeIsInterface() { - return this.typeIsInterface; - } - - private void syncTypeIsInterface(boolean astTypeIsInterface) { - boolean old = this.typeIsInterface; - this.typeIsInterface = astTypeIsInterface; - this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, astTypeIsInterface); - } - - private boolean buildTypeIsInterface(ITypeBinding typeBinding) { - return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isInterface(); - } - - // ***** type is enum - public boolean typeIsEnum() { - return this.typeIsEnum; - } - - private void syncTypeIsEnum(boolean astTypeIsEnum) { - boolean old = this.typeIsEnum; - this.typeIsEnum = astTypeIsEnum; - this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, astTypeIsEnum); - } - - private boolean buildTypeIsEnum(ITypeBinding typeBinding) { - return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isEnum(); - } - - // ***** type is array - public boolean typeIsArray() { - return this.typeIsArray; - } - - private void syncTypeIsArray(boolean astTypeIsArray) { - boolean old = this.typeIsArray; - this.typeIsArray = astTypeIsArray; - this.firePropertyChanged(TYPE_IS_ARRAY_PROPERTY, old, astTypeIsArray); - } - - private boolean buildTypeIsArray(ITypeBinding typeBinding) { - return (typeBinding != null) && typeBinding.isArray(); - } - - // ***** type superclass hierarchy - public ListIterable<String> getTypeSuperclassNames() { - return new LiveCloneListIterable<String>(this.typeSuperclassNames); - } - - private void syncTypeSuperclassNames(List<String> astTypeSuperclassNames) { - this.synchronizeList(astTypeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST); - } - - private List<String> buildTypeSuperclassNames(ITypeBinding typeBinding) { - if (typeBinding == null) { - return Collections.emptyList(); - } - ArrayList<String> names = new ArrayList<String>(); - typeBinding = typeBinding.getSuperclass(); - while (typeBinding != null) { - names.add(typeBinding.getQualifiedName()); - typeBinding = typeBinding.getSuperclass(); - } - return names; - } - - // ***** type interface hierarchy - public Iterable<String> getTypeInterfaceNames() { - return new LiveCloneIterable<String>(this.typeInterfaceNames); - } - -// private boolean typeInterfaceNamesContains(String interfaceName) { -// return this.typeInterfaceNames.contains(interfaceName); -// } -// - private void syncTypeInterfaceNames(Collection<String> astTypeInterfaceNames) { - this.synchronizeCollection(astTypeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION); - } - - private Collection<String> buildTypeInterfaceNames(ITypeBinding typeBinding) { - if (typeBinding == null) { - return Collections.emptySet(); - } - HashSet<String> names = new HashSet<String>(); - while (typeBinding != null) { - this.addInterfaceNamesTo(typeBinding, names); - typeBinding = typeBinding.getSuperclass(); - } - return names; - } - - private void addInterfaceNamesTo(ITypeBinding typeBinding, HashSet<String> names) { - for (ITypeBinding interfaceBinding : typeBinding.getInterfaces()) { - names.add(interfaceBinding.getTypeDeclaration().getQualifiedName()); - this.addInterfaceNamesTo(interfaceBinding, names); // recurse - } - } - - // ***** type type argument names - public ListIterable<String> getTypeTypeArgumentNames() { - return new LiveCloneListIterable<String>(this.typeTypeArgumentNames); - } - - public int getTypeTypeArgumentNamesSize() { - return this.typeTypeArgumentNames.size(); - } - - public String getTypeTypeArgumentName(int index) { - return this.typeTypeArgumentNames.get(index); - } - - private void syncTypeTypeArgumentNames(List<String> astTypeTypeArgumentNames) { - this.synchronizeList(astTypeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST); - } - - /** - * these types can be arrays (e.g. "java.lang.String[]"); - * but they won't have any further nested generic type arguments - * (e.g. "java.util.Collection<java.lang.String>") - */ - private List<String> buildTypeTypeArgumentNames(ITypeBinding typeBinding) { - if (typeBinding == null) { - return Collections.emptyList(); - } - - ITypeBinding[] typeArguments = typeBinding.getTypeArguments(); - if (typeArguments.length == 0) { - return Collections.emptyList(); - } - - ArrayList<String> names = new ArrayList<String>(typeArguments.length); - for (ITypeBinding typeArgument : typeArguments) { - if (typeArgument == null) { - names.add(null); - } else { - // e.g. "? extends Number" has an erasure of "Number" - ITypeBinding erasure = typeArgument.getErasure(); - names.add(erasure.getTypeDeclaration().getQualifiedName()); - } - } - return names; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceCompilationUnit.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceCompilationUnit.java deleted file mode 100644 index 7ede5747b6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceCompilationUnit.java +++ /dev/null @@ -1,176 +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.jaxb.core.internal.resource.java.source; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.JptResourceModelListener; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; - -/** - * Java compilation unit (source file) - */ -public abstract class SourceCompilationUnit - extends SourceNode - implements JavaResourceCompilationUnit -{ - /** JDT compilation unit */ - final ICompilationUnit compilationUnit; - - /** pluggable annotation provider */ - private final AnnotationProvider annotationProvider; - - /** improved annotation formatting */ - private final AnnotationEditFormatter annotationEditFormatter; - - /** pluggable executor that allows the document to be modified on another thread */ - private final CommandExecutor modifySharedDocumentCommandExecutor; - - /** listeners notified whenever the resource model changes */ - private final ListenerList<JptResourceModelListener> resourceModelListenerList; - - - // ********** construction ********** - - protected SourceCompilationUnit( - ICompilationUnit compilationUnit, - AnnotationProvider annotationProvider, - AnnotationEditFormatter annotationEditFormatter, - CommandExecutor modifySharedDocumentCommandExecutor) { - super(null); // the JPA compilation unit is the root of its sub-tree - this.compilationUnit = compilationUnit; - this.annotationProvider = annotationProvider; - this.annotationEditFormatter = annotationEditFormatter; - this.modifySharedDocumentCommandExecutor = modifySharedDocumentCommandExecutor; - this.resourceModelListenerList = new ListenerList<JptResourceModelListener>(JptResourceModelListener.class); - } - - public void initialize(CompilationUnit astRoot) { - // never called? - } - - void openCompilationUnit() { - try { - this.compilationUnit.open(null); - } catch (JavaModelException ex) { - // do nothing - we just won't have a primary type in this case - } - } - - void closeCompilationUnit() { - try { - this.compilationUnit.close(); - } catch (JavaModelException ex) { - // hmmm - } - } - - - // ********** AbstractJavaResourceNode overrides ********** - - @Override - protected boolean requiresParent() { - return false; - } - - @Override - public JavaResourceCompilationUnit getRoot() { - return this; - } - - @Override - public IFile getFile() { - return (IFile) this.compilationUnit.getResource(); - } - - @Override - public AnnotationProvider getAnnotationProvider() { - return this.annotationProvider; - } - - - // ********** JavaResourceNode implementation ********** - - public TextRange getTextRange(CompilationUnit astRoot) { - return null; - } - - - // ********** JavaResourceNode.Root implementation ********** - - public void resourceModelChanged() { - for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) { - listener.resourceModelChanged(this); - } - } - - - // ********** JavaResourceCompilationUnit implementation ********** - - public ICompilationUnit getCompilationUnit() { - return this.compilationUnit; - } - - public CommandExecutor getModifySharedDocumentCommandExecutor() { - return this.modifySharedDocumentCommandExecutor; - } - - public AnnotationEditFormatter getAnnotationEditFormatter() { - return this.annotationEditFormatter; - } - - public CompilationUnit buildASTRoot() { - return ASTTools.buildASTRoot(this.compilationUnit); - } - - - // ********** JpaResourceModel implementation ********** - - public void addResourceModelListener(JptResourceModelListener listener) { - this.resourceModelListenerList.add(listener); - } - - public void removeResourceModelListener(JptResourceModelListener listener) { - this.resourceModelListenerList.remove(listener); - } - - - // ********** Java changes ********** - - public void synchronizeWithJavaSource() { - this.synchronizeWith(this.buildASTRoot()); - } - - - // ********** internal ********** - - String getCompilationUnitName() { - return this.removeJavaExtension(this.compilationUnit.getElementName()); - } - - private String removeJavaExtension(String fileName) { - int index = fileName.lastIndexOf(".java"); //$NON-NLS-1$ - return (index == -1) ? fileName : fileName.substring(0, index); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getCompilationUnitName()); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnum.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnum.java deleted file mode 100644 index 0c506206e7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnum.java +++ /dev/null @@ -1,220 +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.jaxb.core.internal.resource.java.source; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTEnum; -import org.eclipse.jpt.common.core.utility.jdt.Enum; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.internal.SimpleIntReference; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source type - */ -final class SourceEnum - extends SourceAbstractType<Enum> - implements JavaResourceEnum -{ - - private final Vector<JavaResourceEnumConstant> enumConstants; - - - - // ********** construction/initialization ********** - - /** - * build top-level type - */ - static JavaResourceEnum newInstance( - JavaResourceCompilationUnit javaResourceCompilationUnit, - EnumDeclaration enumDeclaration, - CompilationUnit astRoot) { - Enum _enum = new JDTEnum( - enumDeclaration, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceEnum jre = new SourceEnum(javaResourceCompilationUnit, _enum); - jre.initialize(astRoot); - return jre; - } - - /** - * build nested type - */ - protected static JavaResourceEnum newInstance( - JavaResourceCompilationUnit javaResourceCompilationUnit, - Type declaringType, - EnumDeclaration enumDeclaration, - int occurrence, - CompilationUnit astRoot) { - Enum _enum = new JDTEnum( - declaringType, - enumDeclaration, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceEnum jre = new SourceEnum(javaResourceCompilationUnit, _enum); - jre.initialize(astRoot); - return jre; - } - - private SourceEnum(JavaResourceCompilationUnit javaResourceCompilationUnit, Enum _enum) { - super(javaResourceCompilationUnit, _enum); - this.enumConstants = new Vector<JavaResourceEnumConstant>(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.initializeEnumConstants(astRoot); - } - - - // ********** update ********** - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncEnumConstants(astRoot); - } - - - // ********** SourceAnnotatedElement implementation ********** - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - - for (JavaResourceEnumConstant enumConstant : this.getEnumConstants()) { - enumConstant.resolveTypes(astRoot); - } - } - - - // ******** JavaResourceEnum implementation ******** - - public Kind getKind() { - return Kind.ENUM; - } - - - // ********** enum constants ********** - - public Iterable<JavaResourceEnumConstant> getEnumConstants() { - return new LiveCloneIterable<JavaResourceEnumConstant>(this.enumConstants); - } - - private void addEnumConstant(JavaResourceEnumConstant enumConstant) { - this.addItemToCollection(enumConstant, this.enumConstants, ENUM_CONSTANTS_COLLECTION); - } - - private JavaResourceEnumConstant getEnumConstant(String fieldName, int occurrence) { - for (JavaResourceEnumConstant enumConstant : this.getEnumConstants()) { - if (enumConstant.isFor(fieldName, occurrence)) { - return enumConstant; - } - } - return null; - } - - private void removeEnumConstants(Collection<JavaResourceEnumConstant> remove) { - this.removeItemsFromCollection(remove, this.enumConstants, ENUM_CONSTANTS_COLLECTION); - } - - private void initializeEnumConstants(CompilationUnit astRoot) { - EnumConstantDeclaration[] enumConstantDeclarations = this.annotatedElement.getEnumConstants(astRoot); - CounterMap counters = new CounterMap(enumConstantDeclarations.length); - for (EnumConstantDeclaration enumConstantDeclaration : enumConstantDeclarations) { - String constantName = enumConstantDeclaration.getName().getFullyQualifiedName(); - int occurrence = counters.increment(constantName); - this.enumConstants.add(this.buildEnumConstant(constantName, occurrence, astRoot)); - } - } - - private void syncEnumConstants(CompilationUnit astRoot) { - EnumConstantDeclaration[] enumConstantDeclarations = this.annotatedElement.getEnumConstants(astRoot); - CounterMap counters = new CounterMap(enumConstantDeclarations.length); - HashSet<JavaResourceEnumConstant> enumConstantsToRemove = new HashSet<JavaResourceEnumConstant>(this.enumConstants); - for (EnumConstantDeclaration enumConstantDeclaration : enumConstantDeclarations) { - String constantName = enumConstantDeclaration.getName().getFullyQualifiedName(); - int occurrence = counters.increment(constantName); - - JavaResourceEnumConstant enumConstant = this.getEnumConstant(constantName, occurrence); - if (enumConstant == null) { - this.addEnumConstant(this.buildEnumConstant(constantName, occurrence, astRoot)); - } else { - enumConstantsToRemove.remove(enumConstant); - enumConstant.synchronizeWith(astRoot); - } - } - this.removeEnumConstants(enumConstantsToRemove); - } - - private JavaResourceEnumConstant buildEnumConstant(String fieldName, int occurrence, CompilationUnit astRoot) { - return SourceEnumConstant.newInstance(this, this.annotatedElement, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot); - } - - - public Iterable<JavaResourceType> getTypes() { - return EmptyIterable.instance(); - } - - public Iterable<JavaResourceType> getAllTypes() { - return EmptyIterable.instance(); - } - - public Iterable<JavaResourceEnum> getEnums() { - return EmptyIterable.instance(); - } - - public Iterable<JavaResourceEnum> getAllEnums() { - return new SingleElementIterable<JavaResourceEnum>(this); - } - - // ********** CounterMap ********** - - private static class CounterMap { - private final HashMap<Object, SimpleIntReference> counters; - - protected CounterMap(int initialCapacity) { - super(); - this.counters = new HashMap<Object, SimpleIntReference>(initialCapacity); - } - - /** - * Return the incremented count for the specified object. - */ - int increment(Object o) { - SimpleIntReference counter = this.counters.get(o); - if (counter == null) { - counter = new SimpleIntReference(); - this.counters.put(o, counter); - } - counter.increment(); - return counter.getValue(); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnumConstant.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnumConstant.java deleted file mode 100644 index fec1045317..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnumConstant.java +++ /dev/null @@ -1,83 +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.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTEnumConstant; -import org.eclipse.jpt.common.core.utility.jdt.Enum; -import org.eclipse.jpt.common.core.utility.jdt.EnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; - -/** - * Java source enum constant - */ -final class SourceEnumConstant - extends SourceMember<EnumConstant> - implements JavaResourceEnumConstant -{ - - /** - * construct enum constant - */ - static JavaResourceEnumConstant newInstance( - JavaResourceEnum parent, - Enum declaringEnum, - String name, - int occurrence, - JavaResourceCompilationUnit javaResourceCompilationUnit, - CompilationUnit astRoot) { - EnumConstant enumConstant = new JDTEnumConstant( - declaringEnum, - name, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceEnumConstant jrec = new SourceEnumConstant(parent, enumConstant); - jrec.initialize(astRoot); - return jrec; - } - - private SourceEnumConstant(JavaResourceEnum parent, EnumConstant enumConstant){ - super(parent, enumConstant); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - } - - - // ******** overrides ******** - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - - // ******** JavaResourceEnumConstant implementation ******** - - public String getName() { - return this.annotatedElement.getName(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java deleted file mode 100644 index 3218f47915..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 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.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTFieldAttribute; -import org.eclipse.jpt.common.core.utility.jdt.FieldAttribute; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source field - */ -final class SourceField - extends SourceAttribute<FieldAttribute> - implements JavaResourceField -{ - - /** - * construct field attribute - */ - static JavaResourceField newInstance( - JavaResourceType parent, - Type declaringType, - String name, - int occurrence, - JavaResourceCompilationUnit javaResourceCompilationUnit, - CompilationUnit astRoot) { - FieldAttribute field = new JDTFieldAttribute( - declaringType, - name, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceField jrpa = new SourceField(parent, field); - jrpa.initialize(astRoot); - return jrpa; - } - - private SourceField(JavaResourceType parent, FieldAttribute field){ - super(parent, field); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMember.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMember.java deleted file mode 100644 index 15a93b2523..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMember.java +++ /dev/null @@ -1,162 +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.jaxb.core.internal.resource.java.source; - -import java.util.ArrayList; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IBinding; -import org.eclipse.jdt.core.dom.Modifier; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * Java source member (annotations, "persistable") - */ -abstract class SourceMember<M extends Member> - extends SourceAnnotatedElement<M> - implements JavaResourceMember -{ - - boolean final_; // 'final' is a reserved word - - boolean transient_; // 'transient' is a reserved word - - boolean public_; // 'public' is a reserved word - - boolean static_; // 'static' is a reserved word - - - // ********** construction/initialization ********** - - SourceMember(JavaResourceNode parent, M member) { - super(parent, member); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - IBinding binding = this.annotatedElement.getBinding(astRoot); - this.final_ = this.buildFinal(binding); - this.transient_ = this.buildTransient(binding); - this.public_ = this.buildPublic(binding); - this.static_ = this.buildStatic(binding); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - IBinding binding = this.annotatedElement.getBinding(astRoot); - this.syncFinal(this.buildFinal(binding)); - this.syncTransient(this.buildTransient(binding)); - this.syncPublic(this.buildPublic(binding)); - this.syncStatic(this.buildStatic(binding)); - } - - - // ********** annotations ********** - - public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) { - ArrayList<String> annotationNames = new ArrayList<String>(); - CollectionTools.addAll(annotationNames, supportingAnnotationNames); - if (primaryAnnotationName != null) { - annotationNames.add(primaryAnnotationName); - } - for (Annotation annotation : this.getAnnotations()) { - if ( ! CollectionTools.contains(annotationNames, annotation.getAnnotationName())) { - this.annotations.remove(annotation); - annotation.removeAnnotation(); - } - } - Annotation newPrimaryAnnotation = null; - if ((primaryAnnotationName != null) && (this.getAnnotation(primaryAnnotationName) == null)) { - newPrimaryAnnotation = this.buildAnnotation(primaryAnnotationName); - this.annotations.add(newPrimaryAnnotation); - newPrimaryAnnotation.newAnnotation(); - } - // fire collection change event after all annotation changes are done - this.fireCollectionChanged(ANNOTATIONS_COLLECTION, this.annotations); - return newPrimaryAnnotation; - } - - - // ***** final - public boolean isFinal() { - return this.final_; - } - - private void syncFinal(boolean astFinal) { - boolean old = this.final_; - this.final_ = astFinal; - this.firePropertyChanged(FINAL_PROPERTY, old, astFinal); - } - - private boolean buildFinal(IBinding binding) { - return (binding == null) ? false : Modifier.isFinal(binding.getModifiers()); - } - - // ***** transient - public boolean isTransient() { - return this.transient_; - } - - private void syncTransient(boolean astTransient) { - boolean old = this.transient_; - this.transient_ = astTransient; - this.firePropertyChanged(TRANSIENT_PROPERTY, old, astTransient); - } - - private boolean buildTransient(IBinding binding) { - return (binding == null) ? false : Modifier.isTransient(binding.getModifiers()); - } - - // ***** public - public boolean isPublic() { - return this.public_; - } - - private void syncPublic(boolean astPublic) { - boolean old = this.public_; - this.public_ = astPublic; - this.firePropertyChanged(PUBLIC_PROPERTY, old, astPublic); - } - - private boolean buildPublic(IBinding binding) { - return (binding == null) ? false : Modifier.isPublic(binding.getModifiers()); - } - - // ***** static - public boolean isStatic() { - return this.static_; - } - - private void syncStatic(boolean astStatic) { - boolean old = this.static_; - this.static_ = astStatic; - this.firePropertyChanged(STATIC_PROPERTY, old, astStatic); - } - - private boolean buildStatic(IBinding binding) { - return (binding == null) ? false : Modifier.isStatic(binding.getModifiers()); - } - - - // ********** miscellaneous ********** - - public boolean isFor(String memberName, int occurrence) { - return this.annotatedElement.matches(memberName, occurrence); - } - - public void resolveTypes(CompilationUnit astRoot) { - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java deleted file mode 100644 index 5d33f11f35..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb.core.internal.resource.java.source; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTMethodAttribute; -import org.eclipse.jpt.common.core.utility.jdt.MethodAttribute; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source method - */ -final class SourceMethod - extends SourceAttribute<MethodAttribute> - implements JavaResourceMethod -{ - boolean constructor; - - private final Vector<String> parameterTypeNames = new Vector<String>(); - - /** - * construct method - */ - static JavaResourceMethod newInstance( - JavaResourceType parent, - Type declaringType, - MethodSignature signature, - int occurrence, - JavaResourceCompilationUnit javaResourceCompilationUnit, - CompilationUnit astRoot) { - MethodAttribute method = JDTMethodAttribute.newInstance( - declaringType, - signature, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceMethod jrm = new SourceMethod(parent, method); - jrm.initialize(astRoot); - return jrm; - } - - private SourceMethod(JavaResourceType parent, MethodAttribute method){ - super(parent, method); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - IMethodBinding binding = this.annotatedElement.getBinding(astRoot); - this.constructor = this.buildConstructor(binding); - this.parameterTypeNames.addAll(this.buildParameterTypeNames(binding)); - } - - - // ******** overrides ******** - - @Override - protected JavaResourceType getParent() { - return (JavaResourceType) super.getParent(); - } - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - IMethodBinding binding = this.annotatedElement.getBinding(astRoot); - this.syncConstructor(this.buildConstructor(binding)); - this.syncParameterTypeNames(this.buildParameterTypeNames(binding)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getMethodName()); - } - - - // ******** JavaResourceMethod implementation ******** - - public String getMethodName() { - return this.annotatedElement.getName(); - } - - // ***** constructor - public boolean isConstructor() { - return this.constructor; - } - - private void syncConstructor(boolean astConstructor) { - boolean old = this.constructor; - this.constructor = astConstructor; - this.firePropertyChanged(CONSTRUCTOR_PROPERTY, old, astConstructor); - } - - private boolean buildConstructor(IMethodBinding methodBinding) { - return methodBinding == null ? false : methodBinding.isConstructor(); - } - - public boolean isFor(MethodSignature signature, int occurrence) { - return this.annotatedElement.matches(signature, occurrence); - } - - // ***** parameter type names - public ListIterable<String> getParameterTypeNames() { - return new LiveCloneListIterable<String>(this.parameterTypeNames); - } - - public int getParametersSize() { - return this.parameterTypeNames.size(); - } - - private void syncParameterTypeNames(List<String> astParameterTypeNames) { - this.synchronizeList(astParameterTypeNames, this.parameterTypeNames, PARAMETER_TYPE_NAMES_LIST); - } - - private List<String> buildParameterTypeNames(IMethodBinding methodBinding) { - if (methodBinding == null) { - return Collections.emptyList(); - } - ArrayList<String> names = new ArrayList<String>(); - for (ITypeBinding parameterType : methodBinding.getParameterTypes()) { - if (parameterType.isTypeVariable()) { - // e.g. "E extends Number" has an erasure of "Number" - parameterType = parameterType.getErasure(); - } - String ptName = parameterType.getTypeDeclaration().getQualifiedName(); - names.add(ptName); - } - return names; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceNode.java deleted file mode 100644 index f61cecd321..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceNode.java +++ /dev/null @@ -1,333 +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.jaxb.core.internal.resource.java.source; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; - - -/** - * Source convenience methods - */ -public abstract class SourceNode - extends AbstractJavaResourceNode -{ - - public SourceNode(JavaResourceNode parent) { - super(parent); - } - - public JavaResourceCompilationUnit getJavaResourceCompilationUnit() { - return (JavaResourceCompilationUnit) this.getRoot(); - } - - /** - * A container for nested annotations. The owner of the AnnotationContainer - * needs to call initialize(org.eclipse.jdt.core.dom.Annotation) on it. - * @param <T> the type of the resource nestable annotations - */ - abstract class AnnotationContainer<T extends NestableAnnotation> - { - protected final Vector<T> nestedAnnotations = new Vector<T>(); - - protected AnnotationContainer() { - super(); - } - - /** - * Return the element name of the nested annotations - */ - protected abstract String getElementName(); - - /** - * Return the nested annotation name - */ - protected abstract String getNestedAnnotationName(); - - /** - * Return a new nested annotation at the given index - */ - protected abstract T buildNestedAnnotation(int index); - - protected abstract void fireItemAdded(int index, T nestedAnnotation); - - protected abstract void fireItemsRemoved(int index, List<T> removedItems); - - protected void initialize(org.eclipse.jdt.core.dom.Annotation astContainerAnnotation) { - // ignore the nested AST annotations themselves - // (maybe someday we can use them during initialization...) - int size = this.getNestedAstAnnotations(astContainerAnnotation).size(); - for (int i = 0; i < size; i++) { - T nestedAnnotation = this.buildNestedAnnotation(i); - this.nestedAnnotations.add(i, nestedAnnotation); - nestedAnnotation.initialize((CompilationUnit) astContainerAnnotation.getRoot()); - } - } - - /** - * Synchronize the resource model annotations with those in the specified AST. - * Trigger the appropriate change notification. - */ - protected void synchronize(org.eclipse.jdt.core.dom.Annotation astContainerAnnotation) { - ArrayList<org.eclipse.jdt.core.dom.Annotation> astAnnotations = this.getNestedAstAnnotations(astContainerAnnotation); - Iterator<org.eclipse.jdt.core.dom.Annotation> astAnnotationStream = astAnnotations.iterator(); - - for (T nestedAnnotation : this.getNestedAnnotations()) { - if (astAnnotationStream.hasNext()) { - // matching AST annotation is present - synchronize the nested annotation - astAnnotationStream.next(); // maybe someday we can pass this to the update - nestedAnnotation.synchronizeWith((CompilationUnit) astContainerAnnotation.getRoot()); - } else { - // no more AST annotations - remove the remaining nested annotations and exit - this.syncRemoveNestedAnnotations(astAnnotations.size()); - return; - } - } - - // add nested annotations for any remaining AST annotations - while (astAnnotationStream.hasNext()) { - this.syncAddNestedAnnotation(astAnnotationStream.next()); - } - } - - public ListIterable<T> getNestedAnnotations() { - return new LiveCloneListIterable<T>(this.nestedAnnotations); - } - - public int getNestedAnnotationsSize() { - return this.nestedAnnotations.size(); - } - - public T nestedAnnotationAt(int index) { - return this.nestedAnnotations.get(index); - } - - public T addNestedAnnotation(int index) { - // add a new annotation to the end of the list... - int sourceIndex = this.getNestedAnnotationsSize(); - T nestedAnnotation = this.buildNestedAnnotation(sourceIndex); - this.nestedAnnotations.add(sourceIndex, nestedAnnotation); - nestedAnnotation.newAnnotation(); - // ...then move it to the specified index - this.moveNestedAnnotation(index, sourceIndex); - return nestedAnnotation; - } - - public T moveNestedAnnotation(int targetIndex, int sourceIndex) { - if (targetIndex != sourceIndex) { - return this.moveNestedAnnotation_(targetIndex, sourceIndex); - } - return null; - } - - public T removeNestedAnnotation(int index) { - T nestedAnnotation = this.nestedAnnotations.remove(index); - nestedAnnotation.removeAnnotation(); - this.syncAstAnnotationsAfterRemove(index); - return nestedAnnotation; - } - - private T moveNestedAnnotation_(int targetIndex, int sourceIndex) { - T nestedAnnotation = CollectionTools.move(this.nestedAnnotations, targetIndex, sourceIndex).get(targetIndex); - this.syncAstAnnotationsAfterMove(targetIndex, sourceIndex, nestedAnnotation); - return nestedAnnotation; - } - - /** - * Return a list of the nested AST annotations. - */ - private ArrayList<org.eclipse.jdt.core.dom.Annotation> getNestedAstAnnotations(org.eclipse.jdt.core.dom.Annotation astContainerAnnotation) { - ArrayList<org.eclipse.jdt.core.dom.Annotation> result = new ArrayList<org.eclipse.jdt.core.dom.Annotation>(); - if (astContainerAnnotation == null || astContainerAnnotation.isMarkerAnnotation()) { - // no nested annotations - } - else if (astContainerAnnotation.isSingleMemberAnnotation()) { - if (this.getElementName().equals("value")) { //$NON-NLS-1$ - Expression ex = ((SingleMemberAnnotation) astContainerAnnotation).getValue(); - this.addAstAnnotationsTo(ex, result); - } else { - // no nested annotations - } - } - else if (astContainerAnnotation.isNormalAnnotation()) { - MemberValuePair pair = this.getMemberValuePair((NormalAnnotation) astContainerAnnotation); - if (pair == null) { - // no nested annotations - } else { - this.addAstAnnotationsTo(pair.getValue(), result); - } - } - return result; - } - - /** - * Add whatever annotations are represented by the specified expression to - * the specified list. Do not add null to the list for any non-annotation expression. - */ - private void addAstAnnotationsTo(Expression expression, ArrayList<org.eclipse.jdt.core.dom.Annotation> astAnnotations) { - if (expression == null) { - //do not add null to the list, not sure how we would get here... - } - else if (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) { - this.addAstAnnotationsTo((ArrayInitializer) expression, astAnnotations); - } - else { - org.eclipse.jdt.core.dom.Annotation astAnnotation = this.getAstAnnotation_(expression); - if (astAnnotation != null) { - astAnnotations.add(astAnnotation); - } - } - } - - private void addAstAnnotationsTo(ArrayInitializer arrayInitializer, ArrayList<org.eclipse.jdt.core.dom.Annotation> astAnnotations) { - List<Expression> expressions = this.expressions(arrayInitializer); - for (Expression expression : expressions) { - org.eclipse.jdt.core.dom.Annotation astAnnotation = getAstAnnotation(expression); - if (astAnnotation != null) { - astAnnotations.add(astAnnotation); - } - } - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private List<Expression> expressions(ArrayInitializer arrayInitializer) { - return arrayInitializer.expressions(); - } - - /** - * If the specified expression is an annotation with the specified name, return it; - * otherwise return null. - */ - private org.eclipse.jdt.core.dom.Annotation getAstAnnotation(Expression expression) { - // not sure how the expression could be null... - return (expression == null) ? null : getAstAnnotation_(expression); - } - - /** - * pre-condition: expression is not null - */ - private org.eclipse.jdt.core.dom.Annotation getAstAnnotation_(Expression expression) { - switch (expression.getNodeType()) { - case ASTNode.NORMAL_ANNOTATION: - case ASTNode.SINGLE_MEMBER_ANNOTATION: - case ASTNode.MARKER_ANNOTATION: - org.eclipse.jdt.core.dom.Annotation astAnnotation = (org.eclipse.jdt.core.dom.Annotation) expression; - if (this.getQualifiedName(astAnnotation).equals(this.getNestedAnnotationName())) { - return astAnnotation; - } - return null; - default: - return null; - } - } - - private String getQualifiedName(org.eclipse.jdt.core.dom.Annotation astAnnotation) { - ITypeBinding typeBinding = astAnnotation.resolveTypeBinding(); - if (typeBinding != null) { - String resolvedName = typeBinding.getQualifiedName(); - if (resolvedName != null) { - return resolvedName; - } - } - return astAnnotation.getTypeName().getFullyQualifiedName(); - } - - private MemberValuePair getMemberValuePair(NormalAnnotation annotation) { - List<MemberValuePair> pairs = this.values(annotation); - for (MemberValuePair pair : pairs) { - if (pair.getName().getFullyQualifiedName().equals(this.getElementName())) { - return pair; - } - } - return null; - } - - @SuppressWarnings("unchecked") - protected List<MemberValuePair> values(NormalAnnotation na) { - return na.values(); - } - - /** - * An annotation was moved within the specified annotation container from - * the specified source index to the specified target index. - * Synchronize the AST annotations with the resource model annotation container, - * starting with the lower index to prevent overlap. - */ - private void syncAstAnnotationsAfterMove(int targetIndex, int sourceIndex, T nestedAnnotation) { - // move the Java annotation to the end of the list... - nestedAnnotation.moveAnnotation(this.getNestedAnnotationsSize()); - // ...then shift the other AST annotations over one slot... - if (sourceIndex < targetIndex) { - for (int i = sourceIndex; i < targetIndex; i++) { - this.nestedAnnotations.get(i).moveAnnotation(i); - } - } else { - for (int i = sourceIndex; i > targetIndex; i-- ) { - this.nestedAnnotations.get(i).moveAnnotation(i); - } - } - // ...then move the AST annotation to the now empty slot at the target index - nestedAnnotation.moveAnnotation(targetIndex); - } - - /** - * An annotation was removed from the specified annotation container at the - * specified index. - * Synchronize the AST annotations with the resource model annotation container, - * starting at the specified index to prevent overlap. - */ - private void syncAstAnnotationsAfterRemove(int index) { - for (int i = index; i < this.getNestedAnnotationsSize(); i++) { - // the indices are the same because the model annotations are - // already in the proper locations - it's the AST annotations that - // need to be moved to the matching location - this.nestedAnnotations.get(i).moveAnnotation(i); - } - } - - protected void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) { - int index = this.getNestedAnnotationsSize(); - T nestedAnnotation = this.buildNestedAnnotation(index); - nestedAnnotation.initialize((CompilationUnit) astAnnotation.getRoot()); - this.nestedAnnotations.add(index, nestedAnnotation); - this.fireItemAdded(index, nestedAnnotation); - } - - protected void syncRemoveNestedAnnotations(int index) { - List<T> subList = this.nestedAnnotations.subList(index, this.getNestedAnnotationsSize()); - List<T> removedItems = new ArrayList<T>(subList); - subList.clear(); - this.fireItemsRemoved(index, removedItems); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackage.java deleted file mode 100644 index 59d44226df..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackage.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * Distributed under license by Red Hat, Inc. All rights reserved. - * This program is 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 - * - * Contributor: - * Red Hat, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IPackageBinding; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTPackage; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; - -/** - * @author Dmitry Geraskov - * Source package-info.java - * - */ -public final class SourcePackage - extends SourceAnnotatedElement<AnnotatedPackage> - implements JavaResourcePackage { - - private String name; - - /** - * construct package info - */ - public static JavaResourcePackage newInstance( - JavaResourceCompilationUnit parent, - PackageDeclaration declaringPackage, - CompilationUnit astRoot) { - AnnotatedPackage pack = new JDTPackage( - declaringPackage, - parent.getCompilationUnit(), - parent.getModifySharedDocumentCommandExecutor(), - parent.getAnnotationEditFormatter()); - JavaResourcePackage jrpp = new SourcePackage(parent, pack); - jrpp.initialize(astRoot); - return jrpp; - } - - private SourcePackage( - JavaResourceCompilationUnit parent, - AnnotatedPackage pack){ - super(parent, pack); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.name = this.buildName(astRoot); - } - - - // ********** JavaResourcePackageInfo implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - private void syncName(String astName) { - if (valuesAreDifferent(astName, this.name)){ - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - } - - private String buildName(CompilationUnit astRoot) { - IPackageBinding binding = this.annotatedElement.getBinding(astRoot); - return (binding == null) ? null : binding.getName(); - } - - - // ********** Java changes ********** - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncName(this.buildName(astRoot)); - } - - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java deleted file mode 100644 index 19a02b00cb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * Distributed under license by Red Hat, Inc. All rights reserved. - * This program is 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 - * - * Contributor: - * Red Hat, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackageInfoCompilationUnit; - -/** - * @author Dmitry Geraskov - * Source package-info.java - * - */ -public final class SourcePackageInfoCompilationUnit - extends SourceCompilationUnit - implements JavaResourcePackageInfoCompilationUnit { - - private JavaResourcePackage package_; - - public SourcePackageInfoCompilationUnit( - ICompilationUnit compilationUnit, - AnnotationProvider annotationProvider, - AnnotationEditFormatter annotationEditFormatter, - CommandExecutor modifySharedDocumentCommandExecutor) { - super(compilationUnit, annotationProvider, annotationEditFormatter, modifySharedDocumentCommandExecutor); // the JPA compilation unit is the root of its sub-tree - this.package_ = this.buildPackage(); - } - - - private JavaResourcePackage buildPackage() { - this.openCompilationUnit(); - CompilationUnit astRoot = this.buildASTRoot(); - this.closeCompilationUnit(); - return this.buildPackage(astRoot); - } - - - // ********** JavaResourceNode.Root implementation ********** - - public Iterable<JavaResourceAbstractType> getTypes() { - return EmptyIterable.instance(); - } - - - // ********** JptResourceModel implementation ********** - - public JptResourceType getResourceType() { - return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE; - } - - - // ********** Java changes ********** - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncPackage(astRoot); - } - - - // ********** JavaResourceCompilationUnit implementation ********** - - public void resolveTypes() { - //no-op - } - - // ********** package-info ********** - - public JavaResourcePackage getPackage() { - return this.package_; - } - - private JavaResourcePackage buildPackage(CompilationUnit astRoot) { - return this.buildPackage(astRoot, this.getPackageDeclaration(astRoot)); - } - - private void syncPackage(CompilationUnit astRoot) { - PackageDeclaration pd = this.getPackageDeclaration(astRoot); - if (pd == null) { - this.syncPackage_(null); - } else { - if (this.package_ == null) { - this.syncPackage_(this.buildPackage(astRoot, pd)); - } else { - this.package_.synchronizeWith(astRoot); - } - } - } - - private PackageDeclaration getPackageDeclaration(CompilationUnit astRoot) { - return astRoot.getPackage(); - } - - private void syncPackage_(JavaResourcePackage astPackage) { - JavaResourcePackage old = this.package_; - this.package_ = astPackage; - this.firePropertyChanged(PACKAGE, old, astPackage); - } - - private JavaResourcePackage buildPackage(CompilationUnit astRoot, PackageDeclaration packageDeclaration) { - return SourcePackage.newInstance(this, packageDeclaration, astRoot); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceType.java deleted file mode 100644 index 5d35c52984..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceType.java +++ /dev/null @@ -1,488 +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.jaxb.core.internal.resource.java.source; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.Modifier; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jdt.core.dom.VariableDeclarationFragment; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTType; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TreeIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source type - */ -final class SourceType - extends SourceAbstractType<Type> - implements JavaResourceType -{ - - private String superclassQualifiedName; - - private boolean abstract_; // 'abstract' is a reserved word - - private boolean hasNoArgConstructor; - - private final Vector<JavaResourceType> types; - - private final Vector<JavaResourceEnum> enums; - - private final Vector<JavaResourceField> fields; - - private final Vector<JavaResourceMethod> methods; - - - // ********** construction/initialization ********** - - /** - * build top-level type - */ - static JavaResourceType newInstance( - JavaResourceCompilationUnit javaResourceCompilationUnit, - TypeDeclaration typeDeclaration, - CompilationUnit astRoot) { - Type type = new JDTType( - typeDeclaration, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceType jrpt = new SourceType(javaResourceCompilationUnit, type); - jrpt.initialize(astRoot); - return jrpt; - } - - /** - * build nested type - */ - private static JavaResourceType newInstance( - JavaResourceCompilationUnit javaResourceCompilationUnit, - Type declaringType, - TypeDeclaration typeDeclaration, - int occurrence, - CompilationUnit astRoot) { - Type type = new JDTType( - declaringType, - typeDeclaration, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceType jrpt = new SourceType(javaResourceCompilationUnit, type); - jrpt.initialize(astRoot); - return jrpt; - } - - private SourceType(JavaResourceCompilationUnit javaResourceCompilationUnit, Type type) { - super(javaResourceCompilationUnit, type); - this.types = new Vector<JavaResourceType>(); - this.enums = new Vector<JavaResourceEnum>(); - this.fields = new Vector<JavaResourceField>(); - this.methods = new Vector<JavaResourceMethod>(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - ITypeBinding binding = this.annotatedElement.getBinding(astRoot); - this.superclassQualifiedName = this.buildSuperclassQualifiedName(binding); - this.abstract_ = this.buildAbstract(binding); - this.hasNoArgConstructor = this.buildHasNoArgConstructor(binding); - this.initializeTypes(astRoot); - this.initializeEnums(astRoot); - this.initializeFields(astRoot); - this.initializeMethods(astRoot); - } - - - // ********** update ********** - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - ITypeBinding binding = this.annotatedElement.getBinding(astRoot); - this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(binding)); - this.syncAbstract(this.buildAbstract(binding)); - this.syncHasNoArgConstructor(this.buildHasNoArgConstructor(binding)); - this.syncTypes(astRoot); - this.syncEnums(astRoot); - this.syncFields(astRoot); - this.syncMethods(astRoot); - } - - - // ********** SourceAnnotatedElement implementation ********** - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - - this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(this.annotatedElement.getBinding(astRoot))); - - for (JavaResourceField field : this.getFields()) { - field.resolveTypes(astRoot); - } - - // a new type can trigger a method parameter type to be a resolved, - // fully-qualified name, so we need to rebuild our list of methods: - // "setFoo(Foo)" is not the same as "setFoo(com.bar.Foo)" - // and, vice-versa, a removed type can "unresolve" a parameter type - this.syncMethods(astRoot); - - for (JavaResourceMethod method : this.getMethods()) { - method.resolveTypes(astRoot); - } - for (JavaResourceType type : this.getTypes()) { - type.resolveTypes(astRoot); - } - for (JavaResourceEnum enum_ : this.getEnums()) { - enum_.resolveTypes(astRoot); - } - } - - - // ******** JavaResourceType implementation ******** - - public Kind getKind() { - return Kind.TYPE; - } - - // ***** superclass qualified name - public String getSuperclassQualifiedName() { - return this.superclassQualifiedName; - } - - private void syncSuperclassQualifiedName(String astSuperclassQualifiedName) { - String old = this.superclassQualifiedName; - this.superclassQualifiedName = astSuperclassQualifiedName; - this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, astSuperclassQualifiedName); - } - - private String buildSuperclassQualifiedName(ITypeBinding binding) { - if (binding == null) { - return null; - } - ITypeBinding superclass = binding.getSuperclass(); - return (superclass == null) ? null : superclass.getTypeDeclaration().getQualifiedName(); - } - - // ***** abstract - public boolean isAbstract() { - return this.abstract_; - } - - private void syncAbstract(boolean astAbstract) { - boolean old = this.abstract_; - this.abstract_ = astAbstract; - this.firePropertyChanged(ABSTRACT_PROPERTY, old, astAbstract); - } - - private boolean buildAbstract(ITypeBinding binding) { - return (binding == null) ? false : Modifier.isAbstract(binding.getModifiers()); - } - - // ***** no-arg constructor - public boolean hasNoArgConstructor() { - return this.hasNoArgConstructor; - } - - private void syncHasNoArgConstructor(boolean hasNoArgConstructor) { - boolean old = this.hasNoArgConstructor; - this.hasNoArgConstructor = hasNoArgConstructor; - this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, hasNoArgConstructor); - } - - private boolean buildHasNoArgConstructor(ITypeBinding binding) { - return (binding == null) ? false : typeHasNoArgConstructor(binding); - } - - protected static boolean typeHasNoArgConstructor(ITypeBinding binding) { - return findNoArgConstructor(binding) != null; - } - - protected static IMethodBinding findNoArgConstructor(ITypeBinding binding) { - for (IMethodBinding method : binding.getDeclaredMethods()) { - if (method.isConstructor()) { - if (method.getParameterTypes().length == 0) { - return method; - } - } - } - return null; - } - - // ********** types ********** - - public Iterable<JavaResourceType> getTypes() { - return new LiveCloneIterable<JavaResourceType>(this.types); // read-only - } - - public Iterable<JavaResourceType> getAllTypes() { - return new TreeIterable<JavaResourceType>(this) { - @Override - protected Iterator<? extends JavaResourceType> children(JavaResourceType type) { - return type.getTypes().iterator(); - } - }; - } - - private JavaResourceType getType(String typeName, int occurrence) { - for (JavaResourceType type : this.getTypes()) { - if (type.isFor(typeName, occurrence)) { - return type; - } - } - return null; - } - - private void addType(JavaResourceType type) { - this.addItemToCollection(type, this.types, TYPES_COLLECTION); - } - - private void removeTypes(Collection<JavaResourceType> remove) { - this.removeItemsFromCollection(remove, this.types, TYPES_COLLECTION); - } - - private void initializeTypes(CompilationUnit astRoot) { - TypeDeclaration[] typeDeclarations = this.annotatedElement.getTypes(astRoot); - CounterMap counters = new CounterMap(typeDeclarations.length); - for (TypeDeclaration td : typeDeclarations) { - String tdName = td.getName().getFullyQualifiedName(); - int occurrence = counters.increment(tdName); - this.types.add(this.buildType(td, occurrence, astRoot)); - } - } - - private void syncTypes(CompilationUnit astRoot) { - TypeDeclaration[] typeDeclarations = this.annotatedElement.getTypes(astRoot); - CounterMap counters = new CounterMap(typeDeclarations.length); - HashSet<JavaResourceType> typesToRemove = new HashSet<JavaResourceType>(this.types); - for (TypeDeclaration typeDeclaration : typeDeclarations) { - String tdName = typeDeclaration.getName().getFullyQualifiedName(); - int occurrence = counters.increment(tdName); - - JavaResourceType type = this.getType(tdName, occurrence); - if (type == null) { - this.addType(this.buildType(typeDeclaration, occurrence, astRoot)); - } else { - typesToRemove.remove(type); - type.synchronizeWith(astRoot); - } - } - this.removeTypes(typesToRemove); - } - - private JavaResourceType buildType(TypeDeclaration nestedTypeDeclaration, int occurrence, CompilationUnit astRoot) { - return newInstance(this.getJavaResourceCompilationUnit(), this.annotatedElement, nestedTypeDeclaration, occurrence, astRoot); - } - - - // ********** enums ********** - - public Iterable<JavaResourceEnum> getEnums() { - return new LiveCloneIterable<JavaResourceEnum>(this.enums); // read-only - } - - public Iterable<JavaResourceEnum> getAllEnums() { - return this.getEnums(); - } - - private JavaResourceEnum getEnum(String enumName, int occurrence) { - for (JavaResourceEnum enum_ : this.getEnums()) { - if (enum_.isFor(enumName, occurrence)) { - return enum_; - } - } - return null; - } - - private void addEnum(JavaResourceEnum enum_) { - this.addItemToCollection(enum_, this.enums, ENUMS_COLLECTION); - } - - private void removeEnums(Collection<JavaResourceEnum> remove) { - this.removeItemsFromCollection(remove, this.enums, ENUMS_COLLECTION); - } - - private void initializeEnums(CompilationUnit astRoot) { - EnumDeclaration[] enumDeclarations = this.annotatedElement.getEnums(astRoot); - CounterMap counters = new CounterMap(enumDeclarations.length); - for (EnumDeclaration ed : enumDeclarations) { - String tdName = ed.getName().getFullyQualifiedName(); - int occurrence = counters.increment(tdName); - this.enums.add(this.buildEnum(ed, occurrence, astRoot)); - } - } - - private void syncEnums(CompilationUnit astRoot) { - EnumDeclaration[] enumDeclarations = this.annotatedElement.getEnums(astRoot); - CounterMap counters = new CounterMap(enumDeclarations.length); - HashSet<JavaResourceEnum> enumsToRemove = new HashSet<JavaResourceEnum>(this.enums); - for (EnumDeclaration enumDeclaration : enumDeclarations) { - String tdName = enumDeclaration.getName().getFullyQualifiedName(); - int occurrence = counters.increment(tdName); - - JavaResourceEnum enum_ = this.getEnum(tdName, occurrence); - if (enum_ == null) { - this.addEnum(this.buildEnum(enumDeclaration, occurrence, astRoot)); - } else { - enumsToRemove.remove(enum_); - enum_.synchronizeWith(astRoot); - } - } - this.removeEnums(enumsToRemove); - } - - private JavaResourceEnum buildEnum(EnumDeclaration nestedEnumDeclaration, int occurrence, CompilationUnit astRoot) { - return SourceEnum.newInstance(this.getJavaResourceCompilationUnit(), this.annotatedElement, nestedEnumDeclaration, occurrence, astRoot); - } - - - // ********** fields ********** - - public Iterable<JavaResourceField> getFields() { - return new LiveCloneIterable<JavaResourceField>(this.fields); - } - - private void addField(JavaResourceField field) { - this.addItemToCollection(field, this.fields, FIELDS_COLLECTION); - } - - private JavaResourceField getField(String fieldName, int occurrence) { - for (JavaResourceField field : this.getFields()) { - if (field.isFor(fieldName, occurrence)) { - return field; - } - } - return null; - } - - private void removeFields(Collection<JavaResourceField> remove) { - this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION); - } - - private void initializeFields(CompilationUnit astRoot) { - FieldDeclaration[] fieldDeclarations = this.annotatedElement.getFields(astRoot); - CounterMap counters = new CounterMap(fieldDeclarations.length); - for (FieldDeclaration fieldDeclaration : fieldDeclarations) { - for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) { - String fieldName = fragment.getName().getFullyQualifiedName(); - int occurrence = counters.increment(fieldName); - this.fields.add(this.buildField(fieldName, occurrence, astRoot)); - } - } - } - - private void syncFields(CompilationUnit astRoot) { - FieldDeclaration[] fieldDeclarations = this.annotatedElement.getFields(astRoot); - CounterMap counters = new CounterMap(fieldDeclarations.length); - HashSet<JavaResourceField> fieldsToRemove = new HashSet<JavaResourceField>(this.fields); - for (FieldDeclaration fieldDeclaration : fieldDeclarations) { - for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) { - String fieldName = fragment.getName().getFullyQualifiedName(); - int occurrence = counters.increment(fieldName); - - JavaResourceField field = this.getField(fieldName, occurrence); - if (field == null) { - this.addField(this.buildField(fieldName, occurrence, astRoot)); - } else { - fieldsToRemove.remove(field); - field.synchronizeWith(astRoot); - } - } - } - this.removeFields(fieldsToRemove); - } - - private JavaResourceField buildField(String fieldName, int occurrence, CompilationUnit astRoot) { - return SourceField.newInstance(this, this.annotatedElement, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private static List<VariableDeclarationFragment> fragments(FieldDeclaration fd) { - return fd.fragments(); - } - - - // ********** methods ********** - - public Iterable<JavaResourceMethod> getMethods() { - return new LiveCloneIterable<JavaResourceMethod>(this.methods); - } - - private JavaResourceMethod getMethod(MethodSignature signature, int occurrence) { - for (JavaResourceMethod method : this.getMethods()) { - if (method.isFor(signature, occurrence)) { - return method; - } - } - return null; - } - - private void addMethod(JavaResourceMethod method) { - this.addItemToCollection(method, this.methods, METHODS_COLLECTION); - } - - private void removeMethods(Collection<JavaResourceMethod> remove) { - this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION); - } - - private void initializeMethods(CompilationUnit astRoot) { - MethodDeclaration[] methodDeclarations = this.annotatedElement.getMethods(astRoot); - CounterMap counters = new CounterMap(methodDeclarations.length); - for (MethodDeclaration methodDeclaration : methodDeclarations) { - MethodSignature signature = ASTTools.buildMethodSignature(methodDeclaration); - int occurrence = counters.increment(signature); - this.methods.add(this.buildMethod(signature, occurrence, astRoot)); - } - } - - private void syncMethods(CompilationUnit astRoot) { - MethodDeclaration[] methodDeclarations = this.annotatedElement.getMethods(astRoot); - CounterMap counters = new CounterMap(methodDeclarations.length); - HashSet<JavaResourceMethod> methodsToRemove = new HashSet<JavaResourceMethod>(this.methods); - for (MethodDeclaration methodDeclaration : methodDeclarations) { - MethodSignature signature = ASTTools.buildMethodSignature(methodDeclaration); - int occurrence = counters.increment(signature); - - JavaResourceMethod method = this.getMethod(signature, occurrence); - if (method == null) { - this.addMethod(this.buildMethod(signature, occurrence, astRoot)); - } else { - methodsToRemove.remove(method); - method.synchronizeWith(astRoot); - } - } - this.removeMethods(methodsToRemove); - } - - private JavaResourceMethod buildMethod(MethodSignature signature, int occurrence, CompilationUnit astRoot) { - return SourceMethod.newInstance(this, this.annotatedElement, signature, occurrence, this.getJavaResourceCompilationUnit(), astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceTypeCompilationUnit.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceTypeCompilationUnit.java deleted file mode 100644 index ee4d67c56f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceTypeCompilationUnit.java +++ /dev/null @@ -1,174 +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.jaxb.core.internal.resource.java.source; - -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; - -/** - * Java compilation unit (source file) - * non package-info.java file - */ -public final class SourceTypeCompilationUnit - extends SourceCompilationUnit -{ - - /** - * The primary type of the AST compilation unit. We are not going to handle - * multiple types defined in a single compilation unit. Entities must have - * a public/protected no-arg constructor, and there is no way to access - * the constructor in a package class (which is what all top-level, - * non-primary classes must be). - */ - private JavaResourceAbstractType type; - - - // ********** construction ********** - - public SourceTypeCompilationUnit( - ICompilationUnit compilationUnit, - AnnotationProvider annotationProvider, - AnnotationEditFormatter annotationEditFormatter, - CommandExecutor modifySharedDocumentCommandExecutor) { - super(compilationUnit, annotationProvider, annotationEditFormatter, modifySharedDocumentCommandExecutor); // the compilation unit is the root of its sub-tree - this.type = this.buildType(); - } - - private JavaResourceAbstractType buildType() { - this.openCompilationUnit(); - CompilationUnit astRoot = this.buildASTRoot(); - this.closeCompilationUnit(); - return this.buildPersistentType(astRoot); - } - - - // ********** JavaResourceNode implementation ********** - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncType(astRoot); - } - - - // ********** JavaResourceNode.Root implementation ********** - - /** - * NB: return *all* the types since we build them all - */ - public Iterable<JavaResourceAbstractType> getTypes() { - return (this.type == null) ? - EmptyIterable.<JavaResourceAbstractType>instance() : - new CompositeIterable<JavaResourceAbstractType>(this.type.getAllTypes(), this.type.getAllEnums()); - } - - - // ********** JpaResourceModel implementation ********** - - public JptResourceType getResourceType() { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - - - // ********** JavaResourceCompilationUnit implementation ********** - - public void resolveTypes() { - if (this.type != null) { - this.type.resolveTypes(this.buildASTRoot()); - } - } - - - // ********** persistent type ********** - - private JavaResourceAbstractType buildPersistentType(CompilationUnit astRoot) { - AbstractTypeDeclaration td = this.getPrimaryTypeDeclaration(astRoot); - return (td == null) ? null : this.buildType(astRoot, td); - } - - - private void syncType(CompilationUnit astRoot) { - AbstractTypeDeclaration td = this.getPrimaryTypeDeclaration(astRoot); - if (td == null) { - this.syncType_(null); - } else { - if (this.type == null) { - this.syncType_(this.buildType(astRoot, td)); - } else { - this.type.synchronizeWith(astRoot); - } - } - } - - private void syncType_(JavaResourceAbstractType astType) { - JavaResourceAbstractType old = this.type; - this.type = astType; - this.firePropertyChanged(TYPES_COLLECTION, old, astType); - } - - - // ********** internal ********** - - private JavaResourceAbstractType buildType(CompilationUnit astRoot, AbstractTypeDeclaration typeDeclaration) { - if (typeDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION) { - return SourceType.newInstance(this, (TypeDeclaration) typeDeclaration, astRoot); - } - else if (typeDeclaration.getNodeType() == ASTNode.ENUM_DECLARATION) { - return SourceEnum.newInstance(this, (EnumDeclaration) typeDeclaration, astRoot); - } - throw new IllegalArgumentException(); - } - - /** - * i.e. the type with the same name as the compilation unit; - * return the first class or interface (ignore annotations and enums) with - * the same name as the compilation unit (file); - * NB: this type could be in error if there is an annotation or enum - * with the same name preceding it in the compilation unit - * - * Return null if the parser did not resolve the type declaration's binding. - * This can occur if the project JRE is removed (bug 225332). - */ - private AbstractTypeDeclaration getPrimaryTypeDeclaration(CompilationUnit astRoot) { - String primaryTypeName = this.getPrimaryTypeName(); - for (AbstractTypeDeclaration atd : this.types(astRoot)) { - if (this.nodeIsPrimaryTypeDeclaration(atd, primaryTypeName)) { - return (atd.resolveBinding() == null) ? null : atd; - } - } - return null; - } - - private boolean nodeIsPrimaryTypeDeclaration(AbstractTypeDeclaration atd, String primaryTypeName) { - return (atd.getNodeType() == ASTNode.TYPE_DECLARATION || atd.getNodeType() == ASTNode.ENUM_DECLARATION) && - (atd.getName().getFullyQualifiedName().equals(primaryTypeName)); - } - - private String getPrimaryTypeName() { - return this.getCompilationUnitName(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private List<AbstractTypeDeclaration> types(CompilationUnit astRoot) { - return astRoot.types(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java deleted file mode 100644 index 63426d92f1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java +++ /dev/null @@ -1,99 +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.jaxb.core.internal.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.AnnotatedElement; -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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorOrder - */ -public final class SourceXmlAccessorOrderAnnotation - extends SourceAnnotation<AnnotatedElement> - implements XmlAccessorOrderAnnotation -{ - 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 XmlAccessOrder value; - - - public SourceXmlAccessorOrderAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(annotatedElement, 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 void toString(StringBuilder sb) { - sb.append(this.value); - } - - - //*************** XmlAccessorOrderAnnotation implementation **************** - - // ***** value - public XmlAccessOrder getValue() { - return this.value; - } - - public void setValue(XmlAccessOrder value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(XmlAccessOrder.toJavaAnnotationValue(value)); - } - } - - private void syncValue(XmlAccessOrder astValue) { - XmlAccessOrder old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private XmlAccessOrder buildValue(CompilationUnit astRoot) { - return XmlAccessOrder.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - //remove the XmlAccessorOrder annotation when the value element is removed. - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ACCESSOR_ORDER__VALUE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java deleted file mode 100644 index bbc7fd08ca..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java +++ /dev/null @@ -1,99 +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.jaxb.core.internal.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.AnnotatedElement; -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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorType - */ -public final class SourceXmlAccessorTypeAnnotation - extends SourceAnnotation<AnnotatedElement> - implements XmlAccessorTypeAnnotation -{ - 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 XmlAccessType value; - - - public SourceXmlAccessorTypeAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(annotatedElement, 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 void toString(StringBuilder sb) { - sb.append(this.value); - } - - - //*************** XmlAccessorTypeAnnotation implementation **************** - - // ***** value - public XmlAccessType getValue() { - return this.value; - } - - public void setValue(XmlAccessType value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(XmlAccessType.toJavaAnnotationValue(value)); - } - } - - private void syncValue(XmlAccessType astValue) { - XmlAccessType old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private XmlAccessType buildValue(CompilationUnit astRoot) { - return XmlAccessType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - //remove the XmlAccessorType annotation when the value element is removed. - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ACCESSOR_TYPE__VALUE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java deleted file mode 100644 index b8bb3a477d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyAttribute - */ -public final class SourceXmlAnyAttributeAnnotation - extends SourceAnnotation<Attribute> - implements XmlAnyAttributeAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlAnyAttributeAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java deleted file mode 100644 index 18fe641193..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java +++ /dev/null @@ -1,172 +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.jaxb.core.internal.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.ElementAnnotationAdapter; -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.AnnotationAdapter; -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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyElement - */ -public final class SourceXmlAnyElementAnnotation - extends SourceAnnotation<Attribute> - implements XmlAnyElementAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter<Boolean> laxDeclarationAdapter; - private final AnnotationElementAdapter<Boolean> laxAdapter; - private Boolean lax; - - private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter; - private final AnnotationElementAdapter<String> valueAdapter; - private String value; - private String fullyQualifiedValueClassName; - - - // ********** constructors ********** - public SourceXmlAnyElementAnnotation(JavaResourceMember parent, Attribute attribute) { - this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(attribute, DECLARATION_ANNOTATION_ADAPTER)); - } - - public SourceXmlAnyElementAnnotation(JavaResourceMember parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.laxDeclarationAdapter = this.buildLaxAdapter(daa); - this.laxAdapter = this.buildShortCircuitBooleanElementAdapter(this.laxDeclarationAdapter); - this.valueDeclarationAdapter = this.buildValueAdapter(daa); - this.valueAdapter = this.buildAnnotationElementAdapter(this.valueDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildLaxAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ANY_ELEMENT__LAX); - } - - private DeclarationAnnotationElementAdapter<String> buildValueAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_ANY_ELEMENT__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); - } - - private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - private AnnotationElementAdapter<Boolean> buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) { - return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.lax = this.buildLax(astRoot); - this.value = this.buildValue(astRoot); - this.fullyQualifiedValueClassName = this.buildFullyQualifiedValueClassName(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncLax(this.buildLax(astRoot)); - this.syncValue(this.buildValue(astRoot)); - this.syncFullyQualifiedValueClassName(this.buildFullyQualifiedValueClassName(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlAnyElementAnnotation implementation ********** - - // ***** lax - public Boolean getLax() { - return this.lax; - } - - public void setLax(Boolean lax) { - if (this.attributeValueHasChanged(this.lax, lax)) { - this.lax = lax; - this.laxAdapter.setValue(lax); - } - } - - private void syncLax(Boolean astLax) { - Boolean old = this.lax; - this.lax = astLax; - this.firePropertyChanged(LAX_PROPERTY, old, astLax); - } - - private Boolean buildLax(CompilationUnit astRoot) { - return this.laxAdapter.getValue(astRoot); - } - - public TextRange getLaxTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.laxDeclarationAdapter, astRoot); - } - - // ***** value - 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(this.valueDeclarationAdapter, astRoot); - } - - // ***** fully-qualified value class name - public String getFullyQualifiedValueClassName() { - return this.fullyQualifiedValueClassName; - } - - private void syncFullyQualifiedValueClassName(String name) { - String old = this.fullyQualifiedValueClassName; - this.fullyQualifiedValueClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedValueClassName(CompilationUnit astRoot) { - return (this.value == null) ? null : ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot)); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java deleted file mode 100644 index c342b209bb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttachmentRef - */ -public final class SourceXmlAttachmentRefAnnotation - extends SourceAnnotation<Attribute> - implements XmlAttachmentRefAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlAttachmentRefAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java deleted file mode 100644 index 26391d1a39..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java +++ /dev/null @@ -1,185 +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.jaxb.core.internal.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.ElementAnnotationAdapter; -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.AnnotationAdapter; -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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttribute - */ -public final class SourceXmlAttributeAnnotation - extends SourceAnnotation<Attribute> - implements XmlAttributeAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; - private final AnnotationElementAdapter<String> nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter; - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter<Boolean> requiredDeclarationAdapter; - private final AnnotationElementAdapter<Boolean> requiredAdapter; - private Boolean required; - - - // ********** constructors ********** - public SourceXmlAttributeAnnotation(JavaResourceMember parent, Attribute attribute) { - this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(attribute, DECLARATION_ANNOTATION_ADAPTER)); - } - - public SourceXmlAttributeAnnotation(JavaResourceMember parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.nameDeclarationAdapter = this.buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.requiredDeclarationAdapter = this.buildRequiredAdapter(daa); - this.requiredAdapter = this.buildShortCircuitBooleanElementAdapter(this.requiredDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ATTRIBUTE__NAME); - } - - private DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ATTRIBUTE__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildRequiredAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ATTRIBUTE__REQUIRED); - } - - private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - private AnnotationElementAdapter<Boolean> buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) { - return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.required = this.buildRequired(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncRequired(this.buildRequired(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlAttributeAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - if (this.attributeValueHasChanged(this.required, required)) { - this.required = required; - this.requiredAdapter.setValue(required); - } - } - - private void syncRequired(Boolean astRequired) { - Boolean old = this.required; - this.required = astRequired; - this.firePropertyChanged(REQUIRED_PROPERTY, old, astRequired); - } - - private Boolean buildRequired(CompilationUnit astRoot) { - return this.requiredAdapter.getValue(astRoot); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.requiredDeclarationAdapter, astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java deleted file mode 100644 index 9052b33bf5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java +++ /dev/null @@ -1,362 +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.jaxb.core.internal.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.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.internal.utility.jdt.SimpleTypeStringExpressionConverter; -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.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.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlElement - */ -public final class SourceXmlElementAnnotation - extends SourceAnnotation<Attribute> - implements XmlElementAnnotation -{ - private static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; - private final AnnotationElementAdapter<String> nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter; - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter<Boolean> nillableDeclarationAdapter; - private final AnnotationElementAdapter<Boolean> nillableAdapter; - private Boolean nillable; - - private final DeclarationAnnotationElementAdapter<Boolean> requiredDeclarationAdapter; - private final AnnotationElementAdapter<Boolean> requiredAdapter; - private Boolean required; - - private final DeclarationAnnotationElementAdapter<String> defaultValueDeclarationAdapter; - private final AnnotationElementAdapter<String> defaultValueAdapter; - private String defaultValue; - - private final DeclarationAnnotationElementAdapter<String> typeDeclarationAdapter; - private final AnnotationElementAdapter<String> typeAdapter; - private String type; - private String fullyQualifiedTypeName; - - - // ********** constructors ********** - public static SourceXmlElementAnnotation buildSourceXmlElementAnnotation(JavaResourceMember parent, Attribute attribute) { - return new SourceXmlElementAnnotation( - parent, - attribute, - DECLARATION_ANNOTATION_ADAPTER); - } - - public static SourceXmlElementAnnotation buildNestedSourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, IndexedDeclarationAnnotationAdapter idaa) { - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(attribute, idaa); - return new SourceXmlElementAnnotation(parent, attribute, idaa, annotationAdapter); - } - - - private SourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.nameDeclarationAdapter = this.buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.nillableDeclarationAdapter = this.buildNillableAdapter(daa); - this.nillableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nillableDeclarationAdapter); - this.requiredDeclarationAdapter = this.buildRequiredAdapter(daa); - this.requiredAdapter = this.buildShortCircuitBooleanElementAdapter(this.requiredDeclarationAdapter); - this.defaultValueDeclarationAdapter = this.buildDefaultValueAdapter(daa); - this.defaultValueAdapter = this.buildAnnotationElementAdapter(this.defaultValueDeclarationAdapter); - this.typeDeclarationAdapter = this.buildTypeAdapter(daa); - this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter); - } - - private SourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) { - this(parent, attribute, daa, new ElementAnnotationAdapter(attribute, daa)); - } - - private SourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, IndexedDeclarationAnnotationAdapter idaa) { - this(parent, attribute, idaa, new ElementIndexedAnnotationAdapter(attribute, idaa)); - } - - private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__NAME); - } - - private DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildNillableAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT__NILLABLE); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildRequiredAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT__REQUIRED); - } - - private DeclarationAnnotationElementAdapter<String> buildDefaultValueAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__DEFAULT_VALUE); - } - - private DeclarationAnnotationElementAdapter<String> buildTypeAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_ELEMENT__TYPE, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); - } - - private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - private AnnotationElementAdapter<Boolean> buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) { - return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.nillable = this.buildNillable(astRoot); - this.required = this.buildRequired(astRoot); - this.defaultValue = this.buildDefaultValue(astRoot); - this.type = this.buildType(astRoot); - this.fullyQualifiedTypeName = this.buildFullyQualifiedTypeName(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncNillable(this.buildNillable(astRoot)); - this.syncRequired(this.buildRequired(astRoot)); - this.syncDefaultValue(this.buildDefaultValue(astRoot)); - this.syncType(this.buildType(astRoot)); - this.syncFullyQualifiedTypeName(this.buildFullyQualifiedTypeName(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - // ***** nillable - public Boolean getNillable() { - return this.nillable; - } - - public void setNillable(Boolean nillable) { - if (this.attributeValueHasChanged(this.nillable, nillable)) { - this.nillable = nillable; - this.nillableAdapter.setValue(nillable); - } - } - - private void syncNillable(Boolean astNillable) { - Boolean old = this.nillable; - this.nillable = astNillable; - this.firePropertyChanged(NILLABLE_PROPERTY, old, astNillable); - } - - private Boolean buildNillable(CompilationUnit astRoot) { - return this.nillableAdapter.getValue(astRoot); - } - - public TextRange getNillableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nillableDeclarationAdapter, astRoot); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - if (this.attributeValueHasChanged(this.required, required)) { - this.required = required; - this.requiredAdapter.setValue(required); - } - } - - private void syncRequired(Boolean astRequired) { - Boolean old = this.required; - this.required = astRequired; - this.firePropertyChanged(REQUIRED_PROPERTY, old, astRequired); - } - - private Boolean buildRequired(CompilationUnit astRoot) { - return this.requiredAdapter.getValue(astRoot); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.requiredDeclarationAdapter, astRoot); - } - - // ***** defaultValue - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - if (this.attributeValueHasChanged(this.defaultValue, defaultValue)) { - this.defaultValue = defaultValue; - this.defaultValueAdapter.setValue(defaultValue); - } - } - - private void syncDefaultValue(String astDefaultValue) { - String old = this.defaultValue; - this.defaultValue = astDefaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, astDefaultValue); - } - - private String buildDefaultValue(CompilationUnit astRoot) { - return this.defaultValueAdapter.getValue(astRoot); - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.defaultValueDeclarationAdapter, astRoot); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.typeAdapter.setValue(type); - } - } - - private void syncType(String astType) { - String old = this.type; - this.type = astType; - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private String buildType(CompilationUnit astRoot) { - return this.typeAdapter.getValue(astRoot); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.typeDeclarationAdapter, astRoot); - } - - // ***** fully-qualified type name - public String getFullyQualifiedTypeName() { - return this.fullyQualifiedTypeName; - } - - private void syncFullyQualifiedTypeName(String name) { - String old = this.fullyQualifiedTypeName; - this.fullyQualifiedTypeName = name; - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedTypeName(CompilationUnit astRoot) { - return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot)); - } - - - //*********** NestableAnnotation implementation **************** - - /** - * convenience implementation of method from NestableAnnotation interface - * for subclasses - */ - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } - - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java deleted file mode 100644 index b50d5e1fcc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java +++ /dev/null @@ -1,313 +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.jaxb.core.internal.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.ElementAnnotationAdapter; -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.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.MethodAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementDecl - */ -public final class SourceXmlElementDeclAnnotation - extends SourceAnnotation<MethodAttribute> - implements XmlElementDeclAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); - private final AnnotationElementAdapter<String> nameAdapter; - private String name; - - private static final DeclarationAnnotationElementAdapter<String> NAMESPACE_ADAPTER = buildNamespaceAdapter(); - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - private static final DeclarationAnnotationElementAdapter<String> DEFAULT_VALUE_ADAPTER = buildDefaultValueAdapter(); - private final AnnotationElementAdapter<String> defaultValueAdapter; - private String defaultValue; - - private static final DeclarationAnnotationElementAdapter<String> SCOPE_ADAPTER = buildScopeAdapter(); - private final AnnotationElementAdapter<String> scopeAdapter; - private String scope; - private String fullyQualifiedScopeClassName; - - private static final DeclarationAnnotationElementAdapter<String> SUBSTITUTION_HEAD_NAME_ADAPTER = buildSubstitutionHeadNameAdapter(); - private final AnnotationElementAdapter<String> substitutionHeadNameAdapter; - private String substitutionHeadName; - - private static final DeclarationAnnotationElementAdapter<String> SUBSTITUTION_HEAD_NAMESPACE_ADAPTER = buildSubstitutionHeadNamespaceAdapter(); - private final AnnotationElementAdapter<String> substitutionHeadNamespaceAdapter; - private String substitutionHeadNamespace; - - - // ********** constructors ********** - - public SourceXmlElementDeclAnnotation(JavaResourceMethod parent, MethodAttribute method) { - super(parent, method, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(method, DECLARATION_ANNOTATION_ADAPTER)); - this.nameAdapter = this.buildAnnotationElementAdapter(NAME_ADAPTER); - this.namespaceAdapter = this.buildAnnotationElementAdapter(NAMESPACE_ADAPTER); - this.defaultValueAdapter = this.buildAnnotationElementAdapter(DEFAULT_VALUE_ADAPTER); - this.scopeAdapter = this.buildAnnotationElementAdapter(SCOPE_ADAPTER); - this.substitutionHeadNameAdapter = this.buildAnnotationElementAdapter(SUBSTITUTION_HEAD_NAME_ADAPTER); - this.substitutionHeadNamespaceAdapter = this.buildAnnotationElementAdapter(SUBSTITUTION_HEAD_NAMESPACE_ADAPTER); - } - - private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.defaultValue = this.buildDefaultValue(astRoot); - this.scope = this.buildScope(astRoot); - this.fullyQualifiedScopeClassName = this.buildFullyQualifiedScopeClassName(astRoot); - this.substitutionHeadName = this.buildSubstitutionHeadName(astRoot); - this.substitutionHeadNamespace = this.buildSubstitutionHeadNamespace(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncDefaultValue(this.buildDefaultValue(astRoot)); - this.syncScope(this.buildScope(astRoot)); - this.syncFullyQualifiedScopeClassName(this.buildFullyQualifiedScopeClassName(astRoot)); - this.syncSubstitutionHeadName(this.buildSubstitutionHeadName(astRoot)); - this.syncSubstitutionHeadNamespace(this.buildSubstitutionHeadNamespace(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementDeclAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAME_ADAPTER, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astRoot); - } - - // ***** defaultValue - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - if (this.attributeValueHasChanged(this.defaultValue, defaultValue)) { - this.defaultValue = defaultValue; - this.defaultValueAdapter.setValue(defaultValue); - } - } - - private void syncDefaultValue(String astDefaultValue) { - String old = this.defaultValue; - this.defaultValue = astDefaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, astDefaultValue); - } - - private String buildDefaultValue(CompilationUnit astRoot) { - return this.defaultValueAdapter.getValue(astRoot); - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(DEFAULT_VALUE_ADAPTER, astRoot); - } - - // ***** scope - public String getScope() { - return this.scope; - } - - public void setScope(String scope) { - if (this.attributeValueHasChanged(this.scope, scope)) { - this.scope = scope; - this.scopeAdapter.setValue(scope); - } - } - - private void syncScope(String astScope) { - String old = this.scope; - this.scope = astScope; - this.firePropertyChanged(SCOPE_PROPERTY, old, astScope); - } - - private String buildScope(CompilationUnit astRoot) { - return this.scopeAdapter.getValue(astRoot); - } - - public TextRange getScopeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SCOPE_ADAPTER, astRoot); - } - - // ***** fully-qualified scope class name - public String getFullyQualifiedScopeClassName() { - return this.fullyQualifiedScopeClassName; - } - - private void syncFullyQualifiedScopeClassName(String name) { - String old = this.fullyQualifiedScopeClassName; - this.fullyQualifiedScopeClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_SCOPE_CLASS_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedScopeClassName(CompilationUnit astRoot) { - return (this.scope == null) ? null : ASTTools.resolveFullyQualifiedName(this.scopeAdapter.getExpression(astRoot)); - } - - // ***** substitutionHeadName - public String getSubstitutionHeadName() { - return this.substitutionHeadName; - } - - public void setSubstitutionHeadName(String substitutionHeadName) { - if (this.attributeValueHasChanged(this.substitutionHeadName, substitutionHeadName)) { - this.substitutionHeadName = substitutionHeadName; - this.substitutionHeadNameAdapter.setValue(substitutionHeadName); - } - } - - private void syncSubstitutionHeadName(String astSubstitutionHeadName) { - String old = this.substitutionHeadName; - this.substitutionHeadName = astSubstitutionHeadName; - this.firePropertyChanged(SUBSTITUTION_HEAD_NAME_PROPERTY, old, astSubstitutionHeadName); - } - - private String buildSubstitutionHeadName(CompilationUnit astRoot) { - return this.substitutionHeadNameAdapter.getValue(astRoot); - } - - public TextRange getSubstitutionHeadNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SUBSTITUTION_HEAD_NAME_ADAPTER, astRoot); - } - - // ***** substitutionHeadNamespace - public String getSubstitutionHeadNamespace() { - return this.substitutionHeadNamespace; - } - - public void setSubstitutionHeadNamespace(String substitutionHeadNamespace) { - if (this.attributeValueHasChanged(this.substitutionHeadNamespace, substitutionHeadNamespace)) { - this.substitutionHeadNamespace = substitutionHeadNamespace; - this.substitutionHeadNamespaceAdapter.setValue(substitutionHeadNamespace); - } - } - - private void syncSubstitutionHeadNamespace(String astSubstitutionHeadNamespace) { - String old = this.substitutionHeadNamespace; - this.substitutionHeadNamespace = astSubstitutionHeadNamespace; - this.firePropertyChanged(SUBSTITUTION_HEAD_NAMESPACE_PROPERTY, old, astSubstitutionHeadNamespace); - } - - private String buildSubstitutionHeadNamespace(CompilationUnit astRoot) { - return this.substitutionHeadNamespaceAdapter.getValue(astRoot); - } - - public TextRange getSubstitutionHeadNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SUBSTITUTION_HEAD_NAMESPACE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__NAME); - } - - private static DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__NAMESPACE); - } - - private static DeclarationAnnotationElementAdapter<String> buildDefaultValueAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__DEFAULT_VALUE); - } - - private static DeclarationAnnotationElementAdapter<String> buildScopeAdapter() { - return buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__SCOPE, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildSubstitutionHeadNameAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAME); - } - - private static DeclarationAnnotationElementAdapter<String> buildSubstitutionHeadNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAMESPACE); - } - - private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java deleted file mode 100644 index 33971cf6d2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java +++ /dev/null @@ -1,253 +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.jaxb.core.internal.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.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -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.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -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.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementRef - */ -public final class SourceXmlElementRefAnnotation - extends SourceAnnotation<Attribute> - implements XmlElementRefAnnotation -{ - public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - public static final SimpleDeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_ELEMENT_REFS); - - private String fullyQualifiedTypeName; - - private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; - private final AnnotationElementAdapter<String> nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter; - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter<String> typeDeclarationAdapter; - private final AnnotationElementAdapter<String> typeAdapter; - private String type; - - // ********** constructors ********** - public static SourceXmlElementRefAnnotation buildSourceXmlElementRefAnnotation(JavaResourceField parent, Attribute attribute, int index) { - IndexedDeclarationAnnotationAdapter idaa = buildXmlElementRefDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildXmlElementRefAnnotationAdapter(attribute, idaa); - return new SourceXmlElementRefAnnotation( - parent, - attribute, - idaa, - iaa); - } - - private SourceXmlElementRefAnnotation( - JavaResourceField parent, - Attribute attribute, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.nameDeclarationAdapter = this.buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.typeDeclarationAdapter = this.buildTypeAdapter(daa); - this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_REF__NAME); - } - - private DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_REF__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter<String> buildTypeAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_ELEMENT_REF__TYPE, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); - } - - private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.type = this.buildType(astRoot); - this.fullyQualifiedTypeName = this.buildFullyQualifiedTypeName(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncType(this.buildType(astRoot)); - this.syncFullyQualifiedTypeName(this.buildFullyQualifiedTypeName(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementRefAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.typeAdapter.setValue(type); - } - } - - private void syncType(String astType) { - String old = this.type; - this.type = astType; - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private String buildType(CompilationUnit astRoot) { - return this.typeAdapter.getValue(astRoot); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.typeDeclarationAdapter, astRoot); - } - - // ***** fully-qualified type name - public String getFullyQualifiedTypeName() { - return this.fullyQualifiedTypeName; - } - - private void syncFullyQualifiedTypeName(String name) { - String old = this.fullyQualifiedTypeName; - this.fullyQualifiedTypeName = name; - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedTypeName(CompilationUnit astRoot) { - return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot)); - } - - - //*********** NestableAnnotation implementation **************** - - /** - * convenience implementation of method from NestableAnnotation interface - * for subclasses - */ - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } - - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildXmlElementRefAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildXmlElementRefDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - JAXB.XML_ELEMENT_REF); - return idaa; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java deleted file mode 100644 index 79bfc80693..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java +++ /dev/null @@ -1,223 +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.jaxb.core.internal.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.ElementAnnotationAdapter; -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.AnnotationAdapter; -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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementWrapper - */ -public final class SourceXmlElementWrapperAnnotation - extends SourceAnnotation<Attribute> - implements XmlElementWrapperAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; - private final AnnotationElementAdapter<String> nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter; - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter<Boolean> nillableDeclarationAdapter; - private final AnnotationElementAdapter<Boolean> nillableAdapter; - private Boolean nillable; - - private final DeclarationAnnotationElementAdapter<Boolean> requiredDeclarationAdapter; - private final AnnotationElementAdapter<Boolean> requiredAdapter; - private Boolean required; - - - // ********** constructors ********** - public SourceXmlElementWrapperAnnotation(JavaResourceMember parent, Attribute attribute) { - this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(attribute, DECLARATION_ANNOTATION_ADAPTER)); - } - - public SourceXmlElementWrapperAnnotation(JavaResourceMember parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.nameDeclarationAdapter = this.buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.nillableDeclarationAdapter = this.buildNillableAdapter(daa); - this.nillableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nillableDeclarationAdapter); - this.requiredDeclarationAdapter = this.buildRequiredAdapter(daa); - this.requiredAdapter = this.buildShortCircuitBooleanElementAdapter(this.requiredDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_WRAPPER__NAME); - } - - private DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_WRAPPER__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildNillableAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT_WRAPPER__NILLABLE); - } - - private DeclarationAnnotationElementAdapter<Boolean> buildRequiredAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT_WRAPPER__REQUIRED); - } - - private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - private AnnotationElementAdapter<Boolean> buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) { - return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.nillable = this.buildNillable(astRoot); - this.required = this.buildRequired(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncNillable(this.buildNillable(astRoot)); - this.syncRequired(this.buildRequired(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementWrapperAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - // ***** nillable - public Boolean getNillable() { - return this.nillable; - } - - public void setNillable(Boolean nillable) { - if (this.attributeValueHasChanged(this.nillable, nillable)) { - this.nillable = nillable; - this.nillableAdapter.setValue(nillable); - } - } - - private void syncNillable(Boolean astNillable) { - Boolean old = this.nillable; - this.nillable = astNillable; - this.firePropertyChanged(NILLABLE_PROPERTY, old, astNillable); - } - - private Boolean buildNillable(CompilationUnit astRoot) { - return this.nillableAdapter.getValue(astRoot); - } - - public TextRange getNillableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nillableDeclarationAdapter, astRoot); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - if (this.attributeValueHasChanged(this.required, required)) { - this.required = required; - this.requiredAdapter.setValue(required); - } - } - - private void syncRequired(Boolean astRequired) { - Boolean old = this.required; - this.required = astRequired; - this.firePropertyChanged(REQUIRED_PROPERTY, old, astRequired); - } - - private Boolean buildRequired(CompilationUnit astRoot) { - return this.requiredAdapter.getValue(astRoot); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.requiredDeclarationAdapter, astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java deleted file mode 100644 index a938c23116..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -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.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation; - -/** - * javax.xml.bind.annotation.XmlElements - */ -public class SourceXmlElementsAnnotation - extends SourceAnnotation<Attribute> - implements XmlElementsAnnotation { - - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER - = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - private final XmlElementsAnnotationContainer xmlElementsContainer = new XmlElementsAnnotationContainer(); - - public SourceXmlElementsAnnotation(JavaResourceAttribute parent, Attribute attribute) { - this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public SourceXmlElementsAnnotation(JavaResourceAttribute parent, Attribute attribute, DeclarationAnnotationAdapter daa) { - super(parent, attribute, daa); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.xmlElementsContainer.initialize(this.getAstAnnotation(astRoot)); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.xmlElementsContainer.synchronize(this.getAstAnnotation(astRoot)); - } - - - // **************** xmlns ************************************************* - - public ListIterable<XmlElementAnnotation> getXmlElements() { - return this.xmlElementsContainer.getNestedAnnotations(); - } - - public int getXmlElementsSize() { - return this.xmlElementsContainer.getNestedAnnotationsSize(); - } - - public XmlElementAnnotation xmlElementAt(int index) { - return this.xmlElementsContainer.nestedAnnotationAt(index); - } - - public XmlElementAnnotation addXmlElement(int index) { - return this.xmlElementsContainer.addNestedAnnotation(index); - } - - private XmlElementAnnotation buildXmlElement(int index) { - return SourceXmlElementAnnotation.buildNestedSourceXmlElementAnnotation(this, this.annotatedElement, buildXmlElementIndexedDeclarationAnnotationAdapter(index)); - } - - private IndexedDeclarationAnnotationAdapter buildXmlElementIndexedDeclarationAnnotationAdapter(int index) { - return new NestedIndexedDeclarationAnnotationAdapter( - this.daa, JAXB.XML_ELEMENTS__VALUE, index, JAXB.XML_ELEMENT); - } - - public void moveXmlElement(int targetIndex, int sourceIndex) { - this.xmlElementsContainer.moveNestedAnnotation(targetIndex, sourceIndex); - } - - public void removeXmlElement(int index) { - this.xmlElementsContainer.removeNestedAnnotation(index); - } - - /** - * adapt the AnnotationContainer interface to the xml schema's xmlns - */ - class XmlElementsAnnotationContainer - extends AnnotationContainer<XmlElementAnnotation> - { - @Override - protected String getAnnotationsPropertyName() { - return XML_ELEMENTS_LIST; - } - @Override - protected String getElementName() { - return JAXB.XML_ELEMENTS__VALUE; - } - @Override - protected String getNestedAnnotationName() { - return JAXB.XML_ELEMENT; - } - @Override - protected XmlElementAnnotation buildNestedAnnotation(int index) { - return SourceXmlElementsAnnotation.this.buildXmlElement(index); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java deleted file mode 100644 index 797de4e8e4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java +++ /dev/null @@ -1,125 +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.jaxb.core.internal.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.AbstractType; -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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnum - */ -public final class SourceXmlEnumAnnotation - extends SourceAnnotation<AbstractType> - implements XmlEnumAnnotation -{ - 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 String value; - - private String fullyQualifiedValueClassName; - - public SourceXmlEnumAnnotation(JavaResourceAbstractType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); - } - - protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.fullyQualifiedValueClassName = this.buildFullyQualifiedValueClassName(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.syncFullyQualifiedValueClassName(this.buildFullyQualifiedValueClassName(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlEnumAnnotation implementation ********** - - // ***** value - 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); - } - - // ***** fully-qualified value class name - public String getFullyQualifiedValueClassName() { - return this.fullyQualifiedValueClassName; - } - - private void syncFullyQualifiedValueClassName(String name) { - String old = this.fullyQualifiedValueClassName; - this.fullyQualifiedValueClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedValueClassName(CompilationUnit astRoot) { - return (this.value == null) ? null : ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot)); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ENUM__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - - static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java deleted file mode 100644 index 5d3bab34a1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java +++ /dev/null @@ -1,99 +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.jaxb.core.internal.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.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.EnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnumValue - */ -public final class SourceXmlEnumValueAnnotation - extends SourceAnnotation<EnumConstant> - implements XmlEnumValueAnnotation -{ - 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 String value; - - public SourceXmlEnumValueAnnotation(JavaResourceEnumConstant parent, EnumConstant enumConstant) { - super(parent, enumConstant, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); - } - - protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - 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 void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlEnumValueAnnotation implementation ********** - // ***** value - 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); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ENUM_VALUE__VALUE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java deleted file mode 100644 index 8968a82695..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; - -/** - * javax.xml.bind.annotation.XmlID - */ -public final class SourceXmlIDAnnotation - extends SourceAnnotation<Attribute> - implements XmlIDAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlIDAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java deleted file mode 100644 index d2f96423b4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; - -/** - * javax.xml.bind.annotation.XmlIDREF - */ -public final class SourceXmlIDREFAnnotation - extends SourceAnnotation<Attribute> - implements XmlIDREFAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlIDREFAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlInlineBinaryDataAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlInlineBinaryDataAnnotation.java deleted file mode 100644 index e017397b69..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlInlineBinaryDataAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; - -/** - * javax.xml.bind.annotation.XmlInlineBinaryDataAnnotation - */ -public final class SourceXmlInlineBinaryDataAnnotation - extends SourceAnnotation<Member> - implements XmlInlineBinaryDataAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlInlineBinaryDataAnnotation(JavaResourceMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java deleted file mode 100644 index 8409f6df44..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java +++ /dev/null @@ -1,246 +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.jaxb.core.internal.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.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -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.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -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.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -/** - * javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter - */ -public final class SourceXmlJavaTypeAdapterAnnotation - extends SourceAnnotation<AnnotatedElement> - implements XmlJavaTypeAdapterAnnotation -{ - public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - public static final SimpleDeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_JAVA_TYPE_ADAPTERS); - - private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter; - private final AnnotationElementAdapter<String> valueAdapter; - private String value; - private String fullyQualifiedValue; - - private final DeclarationAnnotationElementAdapter<String> typeDeclarationAdapter; - private final AnnotationElementAdapter<String> typeAdapter; - private String type; - private String fullyQualifiedType; - - /* - * We want these events fired when the fq classes change by themselves, not as a result - * of the non-fq classes changing. - */ - private boolean suppressFQClassesEventNotification = false; - - - // ********** constructors ********** - public static SourceXmlJavaTypeAdapterAnnotation buildSourceXmlJavaTypeAdapterAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - IndexedDeclarationAnnotationAdapter idaa = buildXmlJavaTypeAdapterDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildXmlJavaTypeAdapterAnnotationAdapter(annotatedElement, idaa); - return new SourceXmlJavaTypeAdapterAnnotation( - parent, - annotatedElement, - idaa, - iaa); - } - - private SourceXmlJavaTypeAdapterAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.valueDeclarationAdapter = buildValueAdapter(daa); - this.valueAdapter = this.buildAnnotationElementAdapter(this.valueDeclarationAdapter); - this.typeDeclarationAdapter = buildTypeAdapter(daa); - this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter<String> buildValueAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - - private DeclarationAnnotationElementAdapter<String> buildTypeAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, SimpleTypeStringExpressionConverter.instance()); - } - - static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); - } - - protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = buildValue(astRoot); - this.fullyQualifiedValue = buildFullyQualifiedValue(astRoot); - this.type = buildType(astRoot); - this.fullyQualifiedType = buildFullyQualifiedType(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - syncValue(buildValue(astRoot)); - syncType(buildType(astRoot)); - syncFullyQualifiedValue(buildFullyQualifiedValue(astRoot)); - syncFullyQualifiedType(buildFullyQualifiedType(astRoot)); - - this.suppressFQClassesEventNotification = false; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlJavaTypeAdapterAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.suppressFQClassesEventNotification = true; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.suppressFQClassesEventNotification |= StringTools.stringsAreEqual(old, 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(this.valueDeclarationAdapter, astRoot); - } - - public String getFullyQualifiedValue() { - return this.fullyQualifiedValue; - } - - private void syncFullyQualifiedValue(String name) { - String old = this.fullyQualifiedValue; - this.fullyQualifiedValue = name; - if (! this.suppressFQClassesEventNotification) { - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_PROPERTY, old, name); - } - } - - private String buildFullyQualifiedValue(CompilationUnit astRoot) { - return (this.value == null) ? null : ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot)); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.suppressFQClassesEventNotification = true; - this.typeAdapter.setValue(type); - } - } - - private void syncType(String astType) { - String old = this.type; - this.type = astType; - this.suppressFQClassesEventNotification |= StringTools.stringsAreEqual(old, astType); - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private String buildType(CompilationUnit astRoot) { - return this.typeAdapter.getValue(astRoot); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.typeDeclarationAdapter, astRoot); - } - - public String getFullyQualifiedType() { - return this.fullyQualifiedType; - } - - private void syncFullyQualifiedType(String name) { - String old = this.fullyQualifiedType; - this.fullyQualifiedType = name; - if (! this.suppressFQClassesEventNotification) { - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_PROPERTY, old, name); - } - } - - private String buildFullyQualifiedType(CompilationUnit astRoot) { - return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot)); - } - - - //*********** NestableAnnotation implementation **************** - - /** - * convenience implementation of method from NestableAnnotation interface - * for subclasses - */ - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } - - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildXmlJavaTypeAdapterAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildXmlJavaTypeAdapterDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - JAXB.XML_JAVA_TYPE_ADAPTER); - return idaa; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java deleted file mode 100644 index 1d66e39a9b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; - -/** - * javax.xml.bind.annotation.XmlList - */ -public final class SourceXmlListAnnotation - extends SourceAnnotation<Attribute> - implements XmlListAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlListAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java deleted file mode 100644 index 6465642f3d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java +++ /dev/null @@ -1,98 +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.jaxb.core.internal.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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlMimeType - */ -public final class SourceXmlMimeTypeAnnotation - extends SourceAnnotation<Attribute> - implements XmlMimeTypeAnnotation -{ - 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 String value; - - public SourceXmlMimeTypeAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); - } - - protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - 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 void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlMimeTypeAnnotation implementation ********** - // ***** value - 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); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_MIME_TYPE__VALUE); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java deleted file mode 100644 index 06db802a49..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation; - -/** - * javax.xml.bind.annotation.XmlMixed - */ -public final class SourceXmlMixedAnnotation - extends SourceAnnotation<Attribute> - implements XmlMixedAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlMixedAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlNsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlNsAnnotation.java deleted file mode 100644 index 945b367265..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlNsAnnotation.java +++ /dev/null @@ -1,151 +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.jaxb.core.internal.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.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -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.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; - - -public class SourceXmlNsAnnotation - extends SourceAnnotation<AnnotatedPackage> - implements XmlNsAnnotation { - - private final DeclarationAnnotationElementAdapter<String> namespaceURIDeclarationAdapter; - private final AnnotationElementAdapter<String> namespaceURIAdapter; - private String namespaceURI; - - private final DeclarationAnnotationElementAdapter<String> prefixDeclarationAdapter; - private final AnnotationElementAdapter<String> prefixAdapter; - private String prefix; - - - public SourceXmlNsAnnotation(JavaResourceNode parent, AnnotatedPackage pack, IndexedDeclarationAnnotationAdapter idaa) { - super(parent, pack, idaa, new ElementIndexedAnnotationAdapter(pack, idaa)); - this.namespaceURIDeclarationAdapter = this.buildNamespaceURIDeclarationAdapter(idaa); - this.namespaceURIAdapter = this.buildAdapter(this.namespaceURIDeclarationAdapter); - this.prefixDeclarationAdapter = this.buildPrefixDeclarationAdapter(idaa); - this.prefixAdapter = buildAdapter(this.prefixDeclarationAdapter); - } - - - protected DeclarationAnnotationElementAdapter<String> buildNamespaceURIDeclarationAdapter( - DeclarationAnnotationAdapter daa) { - - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_NS__NAMESPACE_URI); - } - - protected DeclarationAnnotationElementAdapter<String> buildPrefixDeclarationAdapter( - DeclarationAnnotationAdapter daa) { - - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_NS__PREFIX); - } - - private AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.namespaceURI = buildNamespaceURI(astRoot); - this.prefix = buildPrefix(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - syncNamespaceURI(buildNamespaceURI(astRoot)); - syncPrefix(buildPrefix(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.namespaceURI); - } - - - // **************** namespace ********************************************* - - public String getNamespaceURI() { - return this.namespaceURI; - } - - public void setNamespaceURI(String namespaceURI) { - if (attributeValueHasChanged(this.namespaceURI, namespaceURI)) { - this.namespaceURI = namespaceURI; - this.namespaceURIAdapter.setValue(namespaceURI); - } - } - - private String buildNamespaceURI(CompilationUnit astRoot) { - return this.namespaceURIAdapter.getValue(astRoot); - } - - private void syncNamespaceURI(String namespaceURI) { - String old = this.namespaceURI; - this.namespaceURI = namespaceURI; - firePropertyChanged(NAMESPACE_URI_PROPERTY, old, namespaceURI); - } - - public TextRange getNamespaceURITextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceURIDeclarationAdapter, astRoot); - } - - - // **************** prefix ************************************************ - - public String getPrefix() { - return this.prefix; - } - - public void setPrefix(String prefix) { - if (attributeValueHasChanged(this.prefix, prefix)) { - this.prefix = prefix; - this.prefixAdapter.setValue(prefix); - } - } - - private String buildPrefix(CompilationUnit astRoot) { - return this.prefixAdapter.getValue(astRoot); - } - - private void syncPrefix(String prefix) { - String old = this.prefix; - this.prefix = prefix; - firePropertyChanged(PREFIX_PROPERTY, old, prefix); - } - - public TextRange getPrefixTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.prefixDeclarationAdapter, astRoot); - } - - - // **************** NestableAnnotation impl ******************************* - - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRegistryAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRegistryAnnotation.java deleted file mode 100644 index dea96474f9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRegistryAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation; - -/** - * javax.xml.bind.annotation.XmlRegistry - */ -public final class SourceXmlRegistryAnnotation - extends SourceAnnotation<AbstractType> - implements XmlRegistryAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlRegistryAnnotation(JavaResourceAbstractType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java deleted file mode 100644 index d9b4f23898..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java +++ /dev/null @@ -1,146 +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.jaxb.core.internal.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.AbstractType; -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.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlRootElement - */ -public final class SourceXmlRootElementAnnotation - extends SourceAnnotation<AbstractType> - implements XmlRootElementAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); - private final AnnotationElementAdapter<String> nameAdapter; - private String name; - - private static final DeclarationAnnotationElementAdapter<String> NAMESPACE_ADAPTER = buildNamespaceAdapter(); - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - public SourceXmlRootElementAnnotation(JavaResourceAbstractType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.nameAdapter = this.buildAnnotationElementAdapter(NAME_ADAPTER); - this.namespaceAdapter = this.buildAnnotationElementAdapter(NAMESPACE_ADAPTER); - } - - protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlRootElementAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAME_ADAPTER, astRoot); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAME_ADAPTER, pos, astRoot); - } - - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astRoot); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAMESPACE_ADAPTER, pos, astRoot); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ROOT_ELEMENT__NAME); - } - - private static DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ROOT_ELEMENT__NAMESPACE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaAnnotation.java deleted file mode 100644 index 76df750769..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaAnnotation.java +++ /dev/null @@ -1,303 +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.jaxb.core.internal.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.EnumDeclarationAnnotationElementAdapter; -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.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -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.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; - - -public class SourceXmlSchemaAnnotation - extends SourceAnnotation<AnnotatedPackage> - implements XmlSchemaAnnotation { - - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER - = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> ATTRIBUTE_FORM_DEFAULT_ADAPTER = - buildAttributeFormDefaultAdapter(); - private final AnnotationElementAdapter<String> attributeFormDefaultAdapter; - private XmlNsForm attributeFormDefault; - - private static final DeclarationAnnotationElementAdapter<String> ELEMENT_FORM_DEFAULT_ADAPTER = - buildElementFormDefaultAdapter(); - private final AnnotationElementAdapter<String> elementFormDefaultAdapter; - private XmlNsForm elementFormDefault; - - private static final DeclarationAnnotationElementAdapter<String> LOCATION_ADAPTER = - buildLocationAdapter(); - private final AnnotationElementAdapter<String> locationAdapter; - private String location; - - private static final DeclarationAnnotationElementAdapter<String> NAMESPACE_ADAPTER = - buildNamespaceAdapter(); - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - private final XmlnsAnnotationContainer xmlnsContainer = new XmlnsAnnotationContainer(); - - - private static DeclarationAnnotationElementAdapter<String> buildAttributeFormDefaultAdapter() { - return new EnumDeclarationAnnotationElementAdapter( - DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SCHEMA__ATTRIBUTE_FORM_DEFAULT); //remove annotation when empty - } - - private static DeclarationAnnotationElementAdapter<String> buildElementFormDefaultAdapter() { - return new EnumDeclarationAnnotationElementAdapter( - DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SCHEMA__ELEMENT_FORM_DEFAULT); // remove annotation when empty - } - - private static DeclarationAnnotationElementAdapter<String> buildLocationAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings( - DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SCHEMA__LOCATION); // remove annotation when empty - } - - private static DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings( - DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SCHEMA__NAMESPACE); // remove annotation when empty - } - - - public SourceXmlSchemaAnnotation(JavaResourcePackage parent, AnnotatedPackage pack) { - this(parent, pack, DECLARATION_ANNOTATION_ADAPTER); - } - - public SourceXmlSchemaAnnotation(JavaResourcePackage parent, AnnotatedPackage pack, DeclarationAnnotationAdapter daa) { - super(parent, pack, daa); - this.attributeFormDefaultAdapter = buildAnnotationElementAdapter(ATTRIBUTE_FORM_DEFAULT_ADAPTER); - this.elementFormDefaultAdapter = buildAnnotationElementAdapter(ELEMENT_FORM_DEFAULT_ADAPTER); - this.locationAdapter = buildAnnotationElementAdapter(LOCATION_ADAPTER); - this.namespaceAdapter = buildAnnotationElementAdapter(NAMESPACE_ADAPTER); - } - - - protected AnnotationElementAdapter<String> buildAnnotationElementAdapter( - DeclarationAnnotationElementAdapter<String> daea) { - - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.attributeFormDefault = buildAttributeFormDefault(astRoot); - this.elementFormDefault = buildElementFormDefault(astRoot); - this.location = buildLocation(astRoot); - this.namespace = buildNamespace(astRoot); - this.xmlnsContainer.initialize(this.getAstAnnotation(astRoot)); - } - - public void synchronizeWith(CompilationUnit astRoot) { - syncAttributeFormDefault(buildAttributeFormDefault(astRoot)); - syncElementFormDefault(buildElementFormDefault(astRoot)); - syncLocation(buildLocation(astRoot)); - syncNamespace(buildNamespace(astRoot)); - this.xmlnsContainer.synchronize(this.getAstAnnotation(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.namespace); - } - - - // **************** attribute form default ******************************** - - public XmlNsForm getAttributeFormDefault() { - return this.attributeFormDefault; - } - - public void setAttributeFormDefault(XmlNsForm attributeFormDefault) { - if (attributeValueHasChanged(this.attributeFormDefault, attributeFormDefault)) { - this.attributeFormDefault = attributeFormDefault; - this.attributeFormDefaultAdapter.setValue(XmlNsForm.toJavaAnnotationValue(attributeFormDefault)); - } - } - - private XmlNsForm buildAttributeFormDefault(CompilationUnit astRoot) { - return XmlNsForm.fromJavaAnnotationValue(this.attributeFormDefaultAdapter.getValue(astRoot)); - } - - private void syncAttributeFormDefault(XmlNsForm attributeFormDefault) { - XmlNsForm old = this.attributeFormDefault; - this.attributeFormDefault = attributeFormDefault; - firePropertyChanged(ATTRIBUTE_FORM_DEFAULT_PROPERTY, old, attributeFormDefault); - } - - public TextRange getAttributeFormDefaultTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(ATTRIBUTE_FORM_DEFAULT_ADAPTER, astRoot); - } - - - // **************** element form default ******************************** - - public XmlNsForm getElementFormDefault() { - return this.elementFormDefault; - } - - public void setElementFormDefault(XmlNsForm elementFormDefault) { - if (attributeValueHasChanged(this.elementFormDefault, elementFormDefault)) { - this.elementFormDefault = elementFormDefault; - this.elementFormDefaultAdapter.setValue(XmlNsForm.toJavaAnnotationValue(elementFormDefault)); - } - } - - private XmlNsForm buildElementFormDefault(CompilationUnit astRoot) { - return XmlNsForm.fromJavaAnnotationValue(this.elementFormDefaultAdapter.getValue(astRoot)); - } - - private void syncElementFormDefault(XmlNsForm elementFormDefault) { - XmlNsForm old = this.elementFormDefault; - this.elementFormDefault = elementFormDefault; - firePropertyChanged(ELEMENT_FORM_DEFAULT_PROPERTY, old, elementFormDefault); - } - - public TextRange getElementFormDefaultTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(ELEMENT_FORM_DEFAULT_ADAPTER, astRoot); - } - - - // **************** location ********************************************** - - public String getLocation() { - return this.location; - } - - public void setLocation(String location) { - if (attributeValueHasChanged(this.location, location)) { - this.location = location; - this.locationAdapter.setValue(location); - } - } - - private String buildLocation(CompilationUnit astRoot) { - return this.locationAdapter.getValue(astRoot); - } - - private void syncLocation(String location) { - String old = this.location; - this.location = location; - firePropertyChanged(LOCATION_PROPERTY, old, location); - } - - public TextRange getLocationTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(LOCATION_ADAPTER, astRoot); - } - - - // **************** namespace ********************************************* - - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - private void syncNamespace(String namespace) { - String old = this.namespace; - this.namespace = namespace; - firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astRoot); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAMESPACE_ADAPTER, pos, astRoot); - } - - - // **************** xmlns ************************************************* - - public ListIterable<XmlNsAnnotation> getXmlns() { - return this.xmlnsContainer.getNestedAnnotations(); - } - - public int getXmlnsSize() { - return this.xmlnsContainer.getNestedAnnotationsSize(); - } - - public XmlNsAnnotation xmlnsAt(int index) { - return this.xmlnsContainer.nestedAnnotationAt(index); - } - - public XmlNsAnnotation addXmlns(int index) { - return this.xmlnsContainer.addNestedAnnotation(index); - } - - private XmlNsAnnotation buildXmlns(int index) { - return new SourceXmlNsAnnotation( - this, this.annotatedElement, buildXmlnsIndexedDeclarationAnnotationAdapter(index)); - } - - private IndexedDeclarationAnnotationAdapter buildXmlnsIndexedDeclarationAnnotationAdapter(int index) { - return new NestedIndexedDeclarationAnnotationAdapter( - this.daa, JAXB.XML_SCHEMA__XMLNS, index, JAXB.XML_NS); - } - - public void moveXmlns(int targetIndex, int sourceIndex) { - this.xmlnsContainer.moveNestedAnnotation(targetIndex, sourceIndex); - } - - public void removeXmlns(int index) { - this.xmlnsContainer.removeNestedAnnotation(index); - } - - /** - * adapt the AnnotationContainer interface to the xml schema's xmlns - */ - class XmlnsAnnotationContainer - extends AnnotationContainer<XmlNsAnnotation> - { - @Override - protected String getAnnotationsPropertyName() { - return XMLNS_LIST; - } - @Override - protected String getElementName() { - return JAXB.XML_SCHEMA__XMLNS; - } - @Override - protected String getNestedAnnotationName() { - return JAXB.XML_NS; - } - @Override - protected XmlNsAnnotation buildNestedAnnotation(int index) { - return SourceXmlSchemaAnnotation.this.buildXmlns(index); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java deleted file mode 100644 index 4fdd5507ab..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java +++ /dev/null @@ -1,272 +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.jaxb.core.internal.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.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -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.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -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.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlSchemaType - */ -public class SourceXmlSchemaTypeAnnotation - extends SourceAnnotation<AnnotatedElement> - implements XmlSchemaTypeAnnotation { - - public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - public static final SimpleDeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_SCHEMA_TYPES); - - private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; - private final AnnotationElementAdapter<String> nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter<String> namespaceDeclarationAdapter; - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter<String> typeDeclarationAdapter; - private final AnnotationElementAdapter<String> typeAdapter; - private String type; - private String fullyQualifiedType; - - - // ********** constructors ********** - - public static SourceXmlSchemaTypeAnnotation buildSourceXmlSchemaTypeAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement annotatedElement, - int index) { - - IndexedDeclarationAnnotationAdapter idaa = buildXmlSchemaTypeDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildXmlSchemaTypeAnnotationAdapter(annotatedElement, idaa); - return new SourceXmlSchemaTypeAnnotation( - parent, - annotatedElement, - idaa, - iaa); - } - - private SourceXmlSchemaTypeAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement annotatedElement, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - - super(parent, annotatedElement, daa, annotationAdapter); - this.nameDeclarationAdapter = buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.typeDeclarationAdapter = buildTypeAdapter(daa); - this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter); - } - - - private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_SCHEMA_TYPE__NAME); - } - - private DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_SCHEMA_TYPE__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter<String> buildTypeAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_SCHEMA_TYPE__TYPE, - SimpleTypeStringExpressionConverter.instance()); - } - - static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter( - DeclarationAnnotationAdapter annotationAdapter, String elementName, - ExpressionConverter<String> converter) { - - return new ConversionDeclarationAnnotationElementAdapter<String>( - annotationAdapter, elementName, converter); - } - - protected AnnotationElementAdapter<String> buildAnnotationElementAdapter( - DeclarationAnnotationElementAdapter<String> daea) { - - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = buildName(astRoot); - this.namespace = buildNamespace(astRoot); - this.type = buildType(astRoot); - this.fullyQualifiedType = buildFullyQualifiedType(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - syncName(buildName(astRoot)); - syncNamespace(buildNamespace(astRoot)); - syncType(buildType(astRoot)); - syncFullyQualifiedType(buildFullyQualifiedType(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // **************** XmlSchemaTypeAnnotation impl ************************** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return elementTouches(this.nameDeclarationAdapter, pos, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(this.namespaceDeclarationAdapter, pos, astRoot); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.typeAdapter.setValue(type); - } - } - - private void syncType(String astType) { - String old = this.type; - this.type = astType; - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private String buildType(CompilationUnit astRoot) { - return this.typeAdapter.getValue(astRoot); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.typeDeclarationAdapter, astRoot); - } - - public String getFullyQualifiedType() { - return this.fullyQualifiedType; - } - - private void syncFullyQualifiedType(String name) { - String old = this.fullyQualifiedType; - this.fullyQualifiedType = name; - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_PROPERTY, old, name); - } - - private String buildFullyQualifiedType(CompilationUnit astRoot) { - return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot)); - } - - - //*********** NestableAnnotation implementation **************** - - /** - * convenience implementation of method from NestableAnnotation interface - * for subclasses - */ - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } - - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildXmlSchemaTypeAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildXmlSchemaTypeDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - JAXB.XML_SCHEMA_TYPE); - return idaa; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSeeAlsoAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSeeAlsoAnnotation.java deleted file mode 100644 index c79dda09bb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSeeAlsoAnnotation.java +++ /dev/null @@ -1,168 +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.jaxb.core.internal.resource.java.source; - -import java.util.Arrays; -import java.util.Vector; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -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.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.AbstractType; -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.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation; - -/** - * javax.xml.bind.annotation.XmlSeeAlso - */ -public final class SourceXmlSeeAlsoAnnotation - extends SourceAnnotation<AbstractType> - implements XmlSeeAlsoAnnotation { - - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter<String[]> valueDeclarationAdapter; - - private final AnnotationElementAdapter<String[]> valueAdapter; - - private final Vector<String> classes; - - /* - * We want this event fired when the fq classes change by themselves, not as a result - * of the value changing. - */ - private boolean suppressFQClassesEventNotification = false; - - private final Vector<String> fullyQualifiedClasses; - - - public SourceXmlSeeAlsoAnnotation(JavaResourceAbstractType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueDeclarationAdapter = buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SEE_ALSO__VALUE); - this.valueAdapter = this.buildArrayAnnotationElementAdapter(this.valueDeclarationAdapter); - this.classes = new Vector<String>(); - this.fullyQualifiedClasses = new Vector<String>(); - } - - - private AnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) { - return new AnnotatedElementAnnotationElementAdapter<String[]>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - for (String astClass : this.valueAdapter.getValue(astRoot)) { - this.classes.add(astClass); - } - CollectionTools.addAll(this.fullyQualifiedClasses, buildFullyQualifiedClasses(astRoot)); - } - - public void synchronizeWith(CompilationUnit astRoot) { - String[] astClasses = this.valueAdapter.getValue(astRoot); - synchronizeList(Arrays.asList(astClasses), this.classes, CLASSES_LIST); - - if (this.suppressFQClassesEventNotification) { - this.fullyQualifiedClasses.clear(); - CollectionTools.addAll(this.fullyQualifiedClasses, buildFullyQualifiedClasses(astRoot)); - this.suppressFQClassesEventNotification = false; - } - else { - synchronizeList(buildFullyQualifiedClasses(astRoot), this.fullyQualifiedClasses, FULLY_QUALIFIED_CLASSES_LIST); - } - } - - protected Iterable<String> buildFullyQualifiedClasses(final CompilationUnit astRoot) { - Expression expression = this.valueAdapter.getExpression(astRoot); - if (expression == null) { - return EmptyIterable.<String>instance(); - } - if (expression.getNodeType() == ASTNode.TYPE_LITERAL) { - return new SingleElementIterable<String>(ASTTools.resolveFullyQualifiedName(expression)); - } - else { - return ASTTools.resolveFullyQualifiedNames(expression); - } - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.classes); - } - - - // ********** XmlSeeAlsoAnnotation implementation ********** - - // ***** classes - public ListIterable<String> getClasses() { - return new LiveCloneListIterable<String>(this.classes); - } - - public int getClassesSize() { - return this.classes.size(); - } - - public void addClass(String clazz) { - this.addClass(this.classes.size(), clazz); - } - - public void addClass(int index, String clazz) { - this.classes.add(index, clazz); - this.suppressFQClassesEventNotification = true; - this.writeClasses(); - } - - public void moveClass(int targetIndex, int sourceIndex) { - CollectionTools.move(this.classes, targetIndex, sourceIndex); - this.suppressFQClassesEventNotification = true; - this.writeClasses(); - } - - public void removeClass(int index) { - this.classes.remove(index); - this.suppressFQClassesEventNotification = true; - this.writeClasses(); - } - - public ListIterable<String> getFullyQualifiedClasses() { - return new LiveCloneListIterable<String>(this.fullyQualifiedClasses); - } - - private void writeClasses() { - this.valueAdapter.setValue(this.classes.toArray(new String[this.classes.size()])); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forTypes()); - } - - private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, converter); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTransientAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTransientAnnotation.java deleted file mode 100644 index d4a89c124b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTransientAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -/** - * javax.xml.bind.annotation.XmlTransient - */ -public final class SourceXmlTransientAnnotation - extends SourceAnnotation<Member> - implements XmlTransientAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlTransientAnnotation(JavaResourceMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java deleted file mode 100644 index 5da847ba3a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java +++ /dev/null @@ -1,322 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb.core.internal.resource.java.source; - -import java.util.Arrays; -import java.util.Vector; -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.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.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -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.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlType - */ -public final class SourceXmlTypeAnnotation - extends SourceAnnotation<AbstractType> - implements XmlTypeAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter<String> FACTORY_CLASS_ADAPTER = buildFactoryClassAdapter(); - private final AnnotationElementAdapter<String> factoryClassAdapter; - private String factoryClass; - - private String fullyQualifiedFactoryClassName; - - private static final DeclarationAnnotationElementAdapter<String> FACTORY_METHOD_ADAPTER = buildFactoryMethodAdapter(); - private final AnnotationElementAdapter<String> factoryMethodAdapter; - private String factoryMethod; - - private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter(); - private final AnnotationElementAdapter<String> nameAdapter; - private String name; - - private static final DeclarationAnnotationElementAdapter<String> NAMESPACE_ADAPTER = buildNamespaceAdapter(); - private final AnnotationElementAdapter<String> namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter<String[]> propOrderDeclarationAdapter; - private final AnnotationElementAdapter<String[]> propOrderAdapter; - private final Vector<String> propOrder = new Vector<String>(); - - public SourceXmlTypeAnnotation(JavaResourceAbstractType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.factoryClassAdapter = this.buildAnnotationElementAdapter(FACTORY_CLASS_ADAPTER); - this.factoryMethodAdapter = this.buildAnnotationElementAdapter(FACTORY_METHOD_ADAPTER); - this.nameAdapter = this.buildAnnotationElementAdapter(NAME_ADAPTER); - this.namespaceAdapter = this.buildAnnotationElementAdapter(NAMESPACE_ADAPTER); - this.propOrderDeclarationAdapter = buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__PROP_ORDER); - this.propOrderAdapter = this.buildArrayAnnotationElementAdapter(this.propOrderDeclarationAdapter); - } - - protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - 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); - } - - private AnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) { - return new AnnotatedElementAnnotationElementAdapter<String[]>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.factoryClass = this.buildFactoryClass(astRoot); - this.fullyQualifiedFactoryClassName = this.buildFullyQualifiedFactoryClassName(astRoot); - this.factoryMethod = this.buildFactoryMethod(astRoot); - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.initializePropOrder(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncFactoryClass(this.buildFactoryClass(astRoot)); - this.syncFullyQualifiedFactoryClassName(this.buildFullyQualifiedFactoryClassName(astRoot)); - this.syncFactoryMethod(this.buildFactoryMethod(astRoot)); - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncPropOrder(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlTypeAnnotation implementation ********** - - // ***** factoryClass - public String getFactoryClass() { - return this.factoryClass; - } - - public void setFactoryClass(String factoryClass) { - if (this.attributeValueHasChanged(this.factoryClass, factoryClass)) { - this.factoryClass = factoryClass; - this.factoryClassAdapter.setValue(factoryClass); - } - } - - private void syncFactoryClass(String astFactoryClass) { - String old = this.factoryClass; - this.factoryClass = astFactoryClass; - this.firePropertyChanged(FACTORY_CLASS_PROPERTY, old, astFactoryClass); - } - - private String buildFactoryClass(CompilationUnit astRoot) { - return this.factoryClassAdapter.getValue(astRoot); - } - - public TextRange getFactoryClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(FACTORY_CLASS_ADAPTER, astRoot); - } - - // ***** fully-qualified factory class name - public String getFullyQualifiedFactoryClassName() { - return this.fullyQualifiedFactoryClassName; - } - - private void syncFullyQualifiedFactoryClassName(String name) { - String old = this.fullyQualifiedFactoryClassName; - this.fullyQualifiedFactoryClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_FACTORY_CLASS_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedFactoryClassName(CompilationUnit astRoot) { - return (this.factoryClass == null) ? null : ASTTools.resolveFullyQualifiedName(this.factoryClassAdapter.getExpression(astRoot)); - } - - // ***** factoryMethod - public String getFactoryMethod() { - return this.factoryMethod; - } - - public void setFactoryMethod(String factoryMethod) { - if (this.attributeValueHasChanged(this.factoryMethod, factoryMethod)) { - this.factoryMethod = factoryMethod; - this.factoryMethodAdapter.setValue(factoryMethod); - } - } - - private void syncFactoryMethod(String astFactoryMethod) { - String old = this.factoryMethod; - this.factoryMethod = astFactoryMethod; - this.firePropertyChanged(FACTORY_METHOD_PROPERTY, old, astFactoryMethod); - } - - private String buildFactoryMethod(CompilationUnit astRoot) { - return this.factoryMethodAdapter.getValue(astRoot); - } - - public TextRange getFactoryMethodTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(FACTORY_METHOD_ADAPTER, astRoot); - } - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return getElementTextRange(NAME_ADAPTER, astRoot); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAME_ADAPTER, pos, astRoot); - } - - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astRoot); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAMESPACE_ADAPTER, pos, astRoot); - } - - - // ***** prop order - public ListIterable<String> getPropOrder() { - return new LiveCloneListIterable<String>(this.propOrder); - } - - public int getPropOrderSize() { - return this.propOrder.size(); - } - - public void addProp(String prop) { - this.addProp(this.propOrder.size(), prop); - } - - public void addProp(int index, String prop) { - this.propOrder.add(index, prop); - this.writePropOrder(); - } - - public void moveProp(int targetIndex, int sourceIndex) { - CollectionTools.move(this.propOrder, targetIndex, sourceIndex); - this.writePropOrder(); - } - - public void removeProp(String prop) { - this.propOrder.remove(prop); - this.writePropOrder(); - } - - public void removeProp(int index) { - this.propOrder.remove(index); - this.writePropOrder(); - } - - private void writePropOrder() { - this.propOrderAdapter.setValue(this.propOrder.toArray(new String[this.propOrder.size()])); - } - - private void initializePropOrder(CompilationUnit astRoot) { - String[] astPropOrder = this.propOrderAdapter.getValue(astRoot); - for (int i = 0; i < astPropOrder.length; i++) { - this.propOrder.add(astPropOrder[i]); - } - } - - private void syncPropOrder(CompilationUnit astRoot) { - String[] astPropOrder = this.propOrderAdapter.getValue(astRoot); - this.synchronizeList(Arrays.asList(astPropOrder), this.propOrder, PROP_ORDER_LIST); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter<String> buildFactoryClassAdapter() { - return buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__FACTORY_CLASS, SimpleTypeStringExpressionConverter.instance()); - } - - static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) { - return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter); - } - - private static DeclarationAnnotationElementAdapter<String> buildFactoryMethodAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__FACTORY_METHOD); - } - - private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__NAME); - } - - private static DeclarationAnnotationElementAdapter<String> buildNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__NAMESPACE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java deleted file mode 100644 index 72621e49b0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java +++ /dev/null @@ -1,43 +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.jaxb.core.internal.resource.java.source; - -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.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlValue - */ -public final class SourceXmlValueAnnotation - extends SourceAnnotation<Attribute> - implements XmlValueAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlValueAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java deleted file mode 100644 index 151a3b10f3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jaxb.core.internal.resource.jaxbindex; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.JptResourceModelListener; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.resource.jaxbindex.JaxbIndexResource; - - -public class JaxbIndexResourceImpl - implements JaxbIndexResource { - - protected final ListenerList<JptResourceModelListener> resourceModelListenerList = - new ListenerList<JptResourceModelListener>(JptResourceModelListener.class); - - - protected final List<String> classNames = new Vector<String>(); - - protected IFile file; - - - public JaxbIndexResourceImpl(IFile file) { - super(); - if (file == null) { - throw new IllegalArgumentException("file cannot be null"); - } - this.file = file; - buildClassNames(); - } - - - private void buildClassNames() { - InputStream stream = null; - - try { - stream = file.getContents(); - } - catch (CoreException ce) { - JptJaxbCorePlugin.log(ce); - return; - } - - if (stream != null) { - BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); - try { - String line = reader.readLine(); - while (line != null) { - String className = line.trim(); - this.classNames.add(className); - line = reader.readLine(); - } - } - catch (Exception ex) { - JptJaxbCorePlugin.log(ex); - } - finally { - try { - reader.close(); - } - catch (IOException ioe) { - JptJaxbCorePlugin.log(ioe); - } - } - } - } - - public Iterable<String> getFullyQualifiedClassNames() { - String packageName = getPackageName(); - final String packagePrefix = StringTools.stringIsEmpty(packageName) ? "" : packageName + "."; - return new TransformationIterable<String, String>( - new SnapshotCloneIterable<String>(this.classNames)) { - @Override - protected String transform(String shortClassName) { - return packagePrefix + shortClassName; - } - }; - } - - protected String getPackageName() { - IJavaElement javaElement = JavaCore.create(this.file.getParent()); - if (javaElement != null && javaElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT) { - return ((IPackageFragment) javaElement).getElementName(); - } - return null; - } - - void update() { - this.classNames.clear(); - buildClassNames(); - resourceModelChanged(); - } - - - // ********** JptResourceModel implementation ********** - - public JptResourceType getResourceType() { - return JptJaxbCorePlugin.JAXB_INDEX_RESOURCE_TYPE; - } - - public void addResourceModelListener(JptResourceModelListener listener) { - this.resourceModelListenerList.add(listener); - } - - public void removeResourceModelListener(JptResourceModelListener listener) { - this.resourceModelListenerList.remove(listener); - } - - protected void resourceModelChanged() { - for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) { - listener.resourceModelChanged(this); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceModelProvider.java deleted file mode 100644 index f1600741da..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceModelProvider.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jaxb.core.internal.resource.jaxbindex; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbResourceModelProvider; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.resource.jaxbindex.JaxbIndexResource; - - -public class JaxbIndexResourceModelProvider - implements JaxbResourceModelProvider { - - // singleton - private static final JaxbIndexResourceModelProvider INSTANCE = new JaxbIndexResourceModelProvider(); - - /** - * Return the singleton. - */ - public static JaxbIndexResourceModelProvider instance() { - return INSTANCE; - } - - - private final Map<IFile, JaxbIndexResourceImpl> models = new HashMap<IFile, JaxbIndexResourceImpl>(); - - private final IResourceChangeListener resourceChangeListener; - - - /** - * Enforce singleton usage - */ - private JaxbIndexResourceModelProvider() { - super(); - this.resourceChangeListener = buildResourceChangeListener(); - ResourcesPlugin.getWorkspace().addResourceChangeListener(this.resourceChangeListener); - } - - - protected IResourceChangeListener buildResourceChangeListener() { - return new IResourceChangeListener() { - public void resourceChanged(IResourceChangeEvent event) { - handleResourceChangeEvent(event); - } - }; - } - - public IContentType getContentType() { - return JptJaxbCorePlugin.JAXB_INDEX_CONTENT_TYPE; - } - - public JptResourceModel buildResourceModel(JaxbProject jaxbProject, IFile file) { - return buildResourceModel(file); - } - - public JaxbIndexResource buildResourceModel(IFile file) { - JaxbIndexResourceImpl resource = this.models.get(file); - if (resource != null) { - return resource; - } - resource = new JaxbIndexResourceImpl(file); - this.models.put(file, resource); - return resource; - } - - protected void handleResourceChangeEvent(IResourceChangeEvent event) { - switch (event.getType()) { - case IResourceChangeEvent.PRE_CLOSE : - case IResourceChangeEvent.PRE_DELETE : - removeProjectResources((IProject) event.getResource()); - return; - - case IResourceChangeEvent.POST_CHANGE : - updateResources(event.getDelta()); - } - } - - protected void removeProjectResources(IProject removedProject) { - for (IFile file : new SnapshotCloneIterable<IFile>(this.models.keySet())) { - if (file.getProject().equals(removedProject)) { - removeResource(file); - } - } - } - - protected void updateResources(IResourceDelta delta) { - try { - delta.accept(new ResourceDeltaVisitor()); - } - catch (CoreException ce) { - // shouldn't happen - JptJaxbCorePlugin.log(ce); - } - } - - protected void removeResource(IFile file) { - this.models.remove(file); - } - - protected void updateResource(IFile file) { - JaxbIndexResourceImpl resource = this.models.get(file); - if (resource != null) { - resource.update(); - } - } - - - protected class ResourceDeltaVisitor - implements IResourceDeltaVisitor { - - public boolean visit(IResourceDelta delta) { - IResource res = delta.getResource(); - switch (res.getType()) { - case IResource.ROOT : - return true; // visit children - case IResource.PROJECT : - return true; // visit children - case IResource.FOLDER : - return true; // visit children - case IResource.FILE : - fileChanged((IFile) res, delta.getKind()); - return false; // no children - default : - return false; // no children (probably shouldn't get here...) - } - } - - protected void fileChanged(IFile file, int deltaKind) { - if (deltaKind == IResourceDelta.REMOVED) { - JaxbIndexResourceModelProvider.this.removeResource(file); - } - else if (deltaKind == IResourceDelta.CHANGED) { - JaxbIndexResourceModelProvider.this.updateResource(file); - } - } - } -} |