Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Hauge2013-01-21 18:34:23 -0500
committerNeil Hauge2013-01-21 18:44:16 -0500
commitd64a166c7e027eecf5db82407110af01af2ceaa3 (patch)
tree60f7e83fdc712c503bd7b24ae46b4269545de2b7
parente80ad5d4deb2f61e805df1354e27b6fbde6a6aa5 (diff)
downloadwebtools.dali-d64a166c7e027eecf5db82407110af01af2ceaa3.tar.gz
webtools.dali-d64a166c7e027eecf5db82407110af01af2ceaa3.tar.xz
webtools.dali-d64a166c7e027eecf5db82407110af01af2ceaa3.zip
398686 - Update/finish binary resource model for JAXB core.
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlNsAnnotation.java90
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaAnnotation.java179
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaTypeAnnotation.java126
3 files changed, 395 insertions, 0 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlNsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlNsAnnotation.java
new file mode 100644
index 0000000000..a977a46cfa
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlNsAnnotation.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+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.XmlNsAnnotation;
+
+
+public class BinaryXmlNsAnnotation
+ extends BinaryAnnotation
+ implements XmlNsAnnotation {
+
+ private String namespaceURI;
+
+ private String prefix;
+
+
+ public BinaryXmlNsAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.namespaceURI = this.buildNamespaceURI();
+ this.prefix = this.buildPrefix();
+ }
+
+ public String getAnnotationName() {
+ return JAXB.XML_NS;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.namespaceURI);
+ }
+
+
+ // ***** namespace *****
+
+ public String getNamespaceURI() {
+ return this.namespaceURI;
+ }
+
+ public void setNamespaceURI(String namespaceURI) {
+ throw new UnsupportedOperationException();
+ }
+
+ private String buildNamespaceURI() {
+ return (String) this.getJdtMemberValue(JAXB.XML_NS__NAMESPACE_URI);
+ }
+
+ public TextRange getNamespaceURITextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean namespaceURITouches(int pos) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ***** prefix *****
+
+ public String getPrefix() {
+ return this.prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ throw new UnsupportedOperationException();
+ }
+
+ private String buildPrefix() {
+ return (String) this.getJdtMemberValue(JAXB.XML_NS__PREFIX);
+ }
+
+ public TextRange getPrefixTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean prefixTouches(int pos) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaAnnotation.java
new file mode 100644
index 0000000000..dc81abd1e7
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaAnnotation.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.iterable.LiveCloneListIterable;
+import org.eclipse.jpt.common.utility.iterable.ListIterable;
+import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
+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 BinaryXmlSchemaAnnotation
+ extends BinaryAnnotation
+ implements XmlSchemaAnnotation {
+
+
+ private XmlNsForm attributeFormDefault;
+
+ private XmlNsForm elementFormDefault;
+
+ private String location;
+
+ private String namespace;
+
+ private final Vector<XmlNsAnnotation> xmlNses;
+
+
+ public BinaryXmlSchemaAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.attributeFormDefault = buildAttributeFormDefault();
+ this.elementFormDefault = buildElementFormDefault();
+ this.location = buildLocation();
+ this.namespace = buildNamespace();
+ this.xmlNses = buildXmlNses();
+ }
+
+
+ public String getAnnotationName() {
+ return JAXB.XML_SCHEMA;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.namespace);
+ }
+
+
+ // **************** attribute form default ********************************
+
+ public XmlNsForm getAttributeFormDefault() {
+ return this.attributeFormDefault;
+ }
+
+ public void setAttributeFormDefault(XmlNsForm attributeFormDefault) {
+ throw new UnsupportedOperationException();
+ }
+
+ private XmlNsForm buildAttributeFormDefault() {
+ return XmlNsForm.fromJavaAnnotationValue(this.getJdtMemberValue(JAXB.XML_SCHEMA__ATTRIBUTE_FORM_DEFAULT));
+ }
+
+ public TextRange getAttributeFormDefaultTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // **************** element form default ********************************
+
+ public XmlNsForm getElementFormDefault() {
+ return this.elementFormDefault;
+ }
+
+ public void setElementFormDefault(XmlNsForm elementFormDefault) {
+ throw new UnsupportedOperationException();
+ }
+
+ private XmlNsForm buildElementFormDefault() {
+ return XmlNsForm.fromJavaAnnotationValue(this.getJdtMemberValue(JAXB.XML_SCHEMA__ELEMENT_FORM_DEFAULT));
+ }
+
+ public TextRange getElementFormDefaultTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // **************** location **********************************************
+
+ public String getLocation() {
+ return this.location;
+ }
+
+ public void setLocation(String location) {
+ throw new UnsupportedOperationException();
+ }
+
+ private String buildLocation() {
+ return (String) this.getJdtMemberValue(JAXB.XML_SCHEMA__LOCATION);
+ }
+
+
+ public TextRange getLocationTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // **************** namespace *********************************************
+
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ throw new UnsupportedOperationException();
+ }
+
+ private String buildNamespace() {
+ return (String) getJdtMemberValue(JAXB.XML_SCHEMA__NAMESPACE);
+ }
+
+ public TextRange getNamespaceTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean namespaceTouches(int pos) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // **************** xmlns *************************************************
+
+ private Vector<XmlNsAnnotation> buildXmlNses() {
+ Object[] jdtXmlNses = this.getJdtMemberValues(JAXB.XML_SCHEMA__XMLNS);
+ Vector<XmlNsAnnotation> result = new Vector<XmlNsAnnotation>(jdtXmlNses.length);
+ for (Object jdtXmlNs : jdtXmlNses) {
+ result.add(new BinaryXmlNsAnnotation(this, (IAnnotation) jdtXmlNs));
+ }
+ return result;
+ }
+
+
+ public ListIterable<XmlNsAnnotation> getXmlns() {
+ return new LiveCloneListIterable<XmlNsAnnotation>(this.xmlNses);
+ }
+
+ public int getXmlnsSize() {
+ return this.xmlNses.size();
+ }
+
+ public XmlNsAnnotation xmlnsAt(int index) {
+ return this.xmlNses.get(index);
+ }
+
+ public XmlNsAnnotation addXmlns(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ 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/binary/BinaryXmlSchemaTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaTypeAnnotation.java
new file mode 100644
index 0000000000..62dd540c8c
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSchemaTypeAnnotation.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.common.core.internal.utility.JDTTools;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
+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.XmlSchemaTypeAnnotation;
+
+/**
+ * javax.xml.bind.annotation.XmlSchemaType
+ */
+public class BinaryXmlSchemaTypeAnnotation
+ extends BinaryAnnotation
+ implements XmlSchemaTypeAnnotation {
+
+ private String name;
+
+ private String namespace;
+
+ private String type;
+ private String fullyQualifiedType;
+
+
+ private BinaryXmlSchemaTypeAnnotation(
+ JavaResourceAnnotatedElement parent,
+ IAnnotation jdtAnnotation) {
+
+ super(parent, jdtAnnotation);
+ this.name = this.buildName();
+ this.namespace= buildNamespace();
+ this.type = buildType();
+ this.fullyQualifiedType = buildFullyQualifiedType(jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return JAXB.XML_SCHEMA_TYPE;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+ // **************** XmlSchemaTypeAnnotation impl **************************
+
+ // ***** name
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ private String buildName() {
+ return (String) this.getJdtMemberValue(JAXB.XML_SCHEMA_TYPE__NAME);
+ }
+
+ public TextRange getNameTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean nameTouches(int pos) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** namespace
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ throw new UnsupportedOperationException();
+ }
+
+ private String buildNamespace() {
+ return (String) this.getJdtMemberValue(JAXB.XML_SCHEMA_TYPE__NAMESPACE);
+ }
+
+ public TextRange getNamespaceTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean namespaceTouches(int pos) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** type
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ throw new UnsupportedOperationException();
+ }
+
+ private String buildType() {
+ return (String) this.getJdtMemberValue(JAXB.XML_SCHEMA_TYPE__TYPE);
+ }
+
+ public TextRange getTypeTextRange() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getFullyQualifiedType() {
+ return this.fullyQualifiedType;
+ }
+
+ private String buildFullyQualifiedType(IAnnotation jdtAnnotation) {
+ return JDTTools.resolveType((IType)jdtAnnotation.getAncestor(IJavaElement.TYPE), this.type);
+ }
+
+}

Back to the top