src/share/jaxws_classes/com/sun/tools/internal/xjc/model/CPropertyInfo.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 397
b99d7e355d4b
equal deleted inserted replaced
366:8c0b6bccfe47 368:0989ad8c0860
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
27 27
28 import java.lang.annotation.Annotation; 28 import java.lang.annotation.Annotation;
29 import java.util.Collection; 29 import java.util.Collection;
30 import java.util.Map; 30 import java.util.Map;
31 31
32 import javax.xml.bind.annotation.XmlSchemaType;
33 import javax.xml.bind.annotation.XmlTransient; 32 import javax.xml.bind.annotation.XmlTransient;
34 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 33 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
35 import javax.xml.namespace.QName; 34 import javax.xml.namespace.QName;
36 35
37 import com.sun.codemodel.internal.JClass; 36 import com.sun.codemodel.internal.JClass;
38 import com.sun.codemodel.internal.JJavaName; 37 import com.sun.codemodel.internal.JJavaName;
39 import com.sun.codemodel.internal.JType; 38 import com.sun.codemodel.internal.JType;
40 import com.sun.tools.internal.xjc.Plugin;
41 import com.sun.tools.internal.xjc.generator.bean.field.FieldRenderer; 39 import com.sun.tools.internal.xjc.generator.bean.field.FieldRenderer;
42 import com.sun.tools.internal.xjc.model.nav.NClass; 40 import com.sun.tools.internal.xjc.model.nav.NClass;
43 import com.sun.tools.internal.xjc.model.nav.NType; 41 import com.sun.tools.internal.xjc.model.nav.NType;
42 import com.sun.tools.internal.xjc.reader.Ring;
44 import com.sun.xml.internal.bind.api.impl.NameConverter; 43 import com.sun.xml.internal.bind.api.impl.NameConverter;
45 import com.sun.xml.internal.bind.v2.WellKnownNamespace; 44 import com.sun.xml.internal.bind.v2.WellKnownNamespace;
46 import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; 45 import com.sun.xml.internal.bind.v2.model.core.PropertyInfo;
47 import com.sun.xml.internal.bind.v2.runtime.RuntimeUtil; 46 import com.sun.xml.internal.bind.v2.runtime.RuntimeUtil;
48 import com.sun.xml.internal.xsom.XSComponent; 47 import com.sun.xml.internal.xsom.XSComponent;
103 private final CCustomizations customizations; 102 private final CCustomizations customizations;
104 103
105 protected CPropertyInfo(String name, boolean collection, XSComponent source, 104 protected CPropertyInfo(String name, boolean collection, XSComponent source,
106 CCustomizations customizations, Locator locator) { 105 CCustomizations customizations, Locator locator) {
107 this.publicName = name; 106 this.publicName = name;
108 String n = NameConverter.standard.toVariableName(name); 107 String n = null;
108
109 Model m = Ring.get(Model.class);
110 if (m != null) {
111 n = m.getNameConverter().toVariableName(name);
112 } else {
113 n = NameConverter.standard.toVariableName(name);
114 }
115
109 if(!JJavaName.isJavaIdentifier(n)) 116 if(!JJavaName.isJavaIdentifier(n))
110 n = '_'+n; // avoid colliding with the reserved names like 'abstract'. 117 n = '_'+n; // avoid colliding with the reserved names like 'abstract'.
111 this.privateName = n; 118 this.privateName = n;
112 119
113 this.isCollection = collection; 120 this.isCollection = collection;

mercurial