summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.3/modules/databinding-jaxb
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2008-08-14 11:59:11 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2008-08-14 11:59:11 +0000
commit626fdac30ca9826adc39357f6ff55aaebf360a7f (patch)
tree7d1a35c141c270470cdfa845d589793e4a312c9b /branches/sca-java-1.3/modules/databinding-jaxb
parentfa3b39ed720bfe83911996c673b72a608a3c7cbf (diff)
Reverse commit 685307 which should not have been checked into the 1.3 branch
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@685867 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.3/modules/databinding-jaxb')
-rw-r--r--branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java35
1 files changed, 3 insertions, 32 deletions
diff --git a/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java b/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java
index 573e636884..8c7ab2f8cd 100644
--- a/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java
+++ b/branches/sca-java-1.3/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.databinding.jaxb;
+import java.beans.Introspector;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@@ -73,43 +74,13 @@ public class JAXBTypeHelper implements XMLTypeHelper {
xmlType = ((XMLType)logical).getTypeName();
}
if (xmlType == null) {
- xmlType = new QName(jaxbRIDecapitalize(javaType.getSimpleName()));
+ xmlType =
+ new QName(JavaXMLMapper.getNamespace(javaType), Introspector.decapitalize(javaType.getSimpleName()));
}
return new TypeInfo(xmlType, false, null);
}
}
- /**
- * The JAXB RI doesn't implement the decapitalization algorithm in the
- * JAXB spec. See Sun bug 6505643 for details. This means that we need
- * to mimic the incorrect algorithm for references from wrapper schemas.
- */
- private String jaxbRIDecapitalize(String name) {
- // find first lower case char in name
- int lower = name.length();
- for (int i = 0; i < name.length(); i++) {
- if (Character.isLowerCase(name.charAt(i))) {
- lower = i;
- break;
- }
- }
-
- int decap;
- if (name.length() == 0) {
- decap = 0; // empty string: nothing to do
- } else if (lower == 0) {
- decap = 0; // first char is lower case: nothing to do
- } else if (lower == 1) {
- decap = 1; // one upper followed by lower: decapitalize 1 char
- } else if (lower < name.length()) {
- decap = lower - 1; // n uppers followed by at least one lower: decapitalize n-1 chars
- } else {
- decap = name.length(); // all upper case: decapitalize all chars
- }
-
- return name.substring(0, decap).toLowerCase() + name.substring(decap);
- }
-
/*
public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver) {
List<XSDefinition> definitions = new ArrayList<XSDefinition>();