1 /* 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.tools.internal.xjc.model; 27 28 import java.lang.annotation.Annotation; 29 import java.util.Collection; 30 import java.util.Map; 31 32 import javax.xml.XMLConstants; 33 import javax.xml.bind.annotation.XmlTransient; 34 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 35 import javax.xml.namespace.QName; 36 37 import com.sun.codemodel.internal.JClass; 38 import com.sun.codemodel.internal.JJavaName; 39 import com.sun.codemodel.internal.JType; 40 import com.sun.tools.internal.xjc.generator.bean.field.FieldRenderer; 41 import com.sun.tools.internal.xjc.model.nav.NClass; 42 import com.sun.tools.internal.xjc.model.nav.NType; 43 import com.sun.tools.internal.xjc.reader.Ring; 44 import com.sun.xml.internal.bind.api.impl.NameConverter; 45 import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; 46 import com.sun.xml.internal.bind.v2.runtime.RuntimeUtil; 47 import com.sun.xml.internal.xsom.XSComponent; 48 49 import org.xml.sax.Locator; 50 51 /** 52 * Model of a property to be generated. 53 * 54 * @author Kohsuke Kawaguchi 55 */ 56 public abstract class CPropertyInfo implements PropertyInfo<NType,NClass>, CCustomizable { 57 58 @XmlTransient 59 private CClassInfo parent; 60 private String privateName; 61 private String publicName; 62 private final boolean isCollection; 63 64 @XmlTransient 65 public final Locator locator; 66 67 /** 68 * @see #getSchemaComponent() 69 */ 70 private final XSComponent source; 71 72 /** 73 * If the base type of the property is overriden, 74 * this field is set to non-null. 75 */ 76 public JType baseType; 77 78 /** 79 * Javadoc for this property. Must not be null. 80 */ 81 public String javadoc=""; 82 83 /** 84 * Property with {@link @XmlInlineBinaryData}. 85 */ 86 public boolean inlineBinaryData; 87 88 /** 89 * Specifies how the field is generated by the backend. 90 */ 91 @XmlJavaTypeAdapter(RuntimeUtil.ToStringAdapter.class) 92 public FieldRenderer realization; 93 94 /** 95 * If non-null, keeps the default value in Java representation. 96 * 97 * If {@link #isCollection} is true, this field is always null, 98 * for we don't handle default values for a list. 99 */ 100 public CDefaultValue defaultValue; 101 102 private final CCustomizations customizations; 103 104 protected CPropertyInfo(String name, boolean collection, XSComponent source, | 1 /* 2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.tools.internal.xjc.model; 27 28 import java.lang.annotation.Annotation; 29 import java.util.Collection; 30 import java.util.Map; 31 32 import javax.xml.XMLConstants; 33 import javax.xml.bind.annotation.XmlInlineBinaryData; 34 import javax.xml.bind.annotation.XmlSchemaType; 35 import javax.xml.bind.annotation.XmlTransient; 36 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 37 import javax.xml.namespace.QName; 38 39 import com.sun.codemodel.internal.JClass; 40 import com.sun.codemodel.internal.JJavaName; 41 import com.sun.codemodel.internal.JType; 42 import com.sun.tools.internal.xjc.Plugin; 43 import com.sun.tools.internal.xjc.generator.bean.field.FieldRenderer; 44 import com.sun.tools.internal.xjc.model.nav.NClass; 45 import com.sun.tools.internal.xjc.model.nav.NType; 46 import com.sun.tools.internal.xjc.reader.Ring; 47 import com.sun.xml.internal.bind.api.impl.NameConverter; 48 import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; 49 import com.sun.xml.internal.bind.v2.runtime.RuntimeUtil; 50 import com.sun.xml.internal.xsom.XSComponent; 51 52 import org.xml.sax.ErrorHandler; 53 import org.xml.sax.Locator; 54 55 /** 56 * Model of a property to be generated. 57 * 58 * @author Kohsuke Kawaguchi 59 */ 60 public abstract class CPropertyInfo implements PropertyInfo<NType,NClass>, CCustomizable { 61 62 @XmlTransient 63 private CClassInfo parent; 64 private String privateName; 65 private String publicName; 66 private final boolean isCollection; 67 68 @XmlTransient 69 public final Locator locator; 70 71 /** 72 * @see #getSchemaComponent() 73 */ 74 private final XSComponent source; 75 76 /** 77 * If the base type of the property is overriden, 78 * this field is set to non-null. 79 */ 80 public JType baseType; 81 82 /** 83 * Javadoc for this property. Must not be null. 84 */ 85 public String javadoc=""; 86 87 /** 88 * Property with {@link XmlInlineBinaryData}. 89 */ 90 public boolean inlineBinaryData; 91 92 /** 93 * Specifies how the field is generated by the backend. 94 */ 95 @XmlJavaTypeAdapter(RuntimeUtil.ToStringAdapter.class) 96 public FieldRenderer realization; 97 98 /** 99 * If non-null, keeps the default value in Java representation. 100 * 101 * If {@link #isCollection} is true, this field is always null, 102 * for we don't handle default values for a list. 103 */ 104 public CDefaultValue defaultValue; 105 106 private final CCustomizations customizations; 107 108 protected CPropertyInfo(String name, boolean collection, XSComponent source, |