jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/BIProperty.java
author mkos
Sun, 30 Dec 2012 00:00:00 +0100
changeset 22678 ac1ea46be942
parent 12009 4abb694f273a
child 23782 953bfc3fbe31
permissions -rw-r--r--
8029237: Update copyright year to match last edit in jaxws repository for 2012 Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     1
/*
22678
ac1ea46be942 8029237: Update copyright year to match last edit in jaxws repository for 2012
mkos
parents: 12009
diff changeset
     2
 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
12009
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     4
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    10
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    15
 * accompanied this code).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    16
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    20
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    23
 * questions.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    24
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    25
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    26
package com.sun.tools.internal.xjc.reader.xmlschema.bindinfo;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    27
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    28
import java.util.Collection;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    29
import java.util.Collections;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    30
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    31
import javax.xml.bind.annotation.XmlAttribute;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    32
import javax.xml.bind.annotation.XmlElement;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    33
import javax.xml.bind.annotation.XmlElementRef;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    34
import javax.xml.bind.annotation.XmlRootElement;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    35
import javax.xml.namespace.QName;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    36
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    37
import com.sun.codemodel.internal.JJavaName;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    38
import com.sun.codemodel.internal.JType;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    39
import com.sun.tools.internal.xjc.ErrorReceiver;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    40
import com.sun.tools.internal.xjc.generator.bean.field.FieldRenderer;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    41
import com.sun.tools.internal.xjc.generator.bean.field.FieldRendererFactory;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    42
import com.sun.tools.internal.xjc.generator.bean.field.IsSetFieldRenderer;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    43
import com.sun.tools.internal.xjc.model.CAttributePropertyInfo;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    44
import com.sun.tools.internal.xjc.model.CCustomizations;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    45
import com.sun.tools.internal.xjc.model.CElementPropertyInfo;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    46
import com.sun.tools.internal.xjc.model.CPropertyInfo;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    47
import com.sun.tools.internal.xjc.model.CReferencePropertyInfo;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    48
import com.sun.tools.internal.xjc.model.CValuePropertyInfo;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    49
import com.sun.tools.internal.xjc.model.TypeUse;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    50
import com.sun.tools.internal.xjc.reader.Const;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    51
import com.sun.tools.internal.xjc.reader.RawTypeSet;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    52
import com.sun.tools.internal.xjc.reader.Ring;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    53
import com.sun.tools.internal.xjc.reader.TypeUtil;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    54
import com.sun.tools.internal.xjc.reader.xmlschema.BGMBuilder;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    55
import com.sun.xml.internal.bind.api.impl.NameConverter;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    56
import com.sun.xml.internal.xsom.XSAnnotation;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    57
import com.sun.xml.internal.xsom.XSAttGroupDecl;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    58
import com.sun.xml.internal.xsom.XSAttributeDecl;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    59
import com.sun.xml.internal.xsom.XSAttributeUse;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    60
import com.sun.xml.internal.xsom.XSComplexType;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    61
import com.sun.xml.internal.xsom.XSComponent;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    62
import com.sun.xml.internal.xsom.XSContentType;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    63
import com.sun.xml.internal.xsom.XSElementDecl;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    64
import com.sun.xml.internal.xsom.XSFacet;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    65
import com.sun.xml.internal.xsom.XSIdentityConstraint;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    66
import com.sun.xml.internal.xsom.XSModelGroup;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    67
import com.sun.xml.internal.xsom.XSModelGroupDecl;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    68
import com.sun.xml.internal.xsom.XSNotation;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    69
import com.sun.xml.internal.xsom.XSParticle;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    70
import com.sun.xml.internal.xsom.XSSchema;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    71
import com.sun.xml.internal.xsom.XSSimpleType;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    72
import com.sun.xml.internal.xsom.XSWildcard;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    73
import com.sun.xml.internal.xsom.XSXPath;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    74
import com.sun.xml.internal.xsom.util.XSFinder;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    75
import com.sun.xml.internal.xsom.visitor.XSFunction;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    76
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    77
import org.xml.sax.Locator;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    78
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    79
/**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    80
 * Property customization.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    81
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    82
 * This customization turns an arbitrary schema component
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    83
 * into a Java property (some restrictions apply.)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    84
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    85
 * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    86
 * All the getter methods (such as <code>getBaseType</code> or
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    87
 * <code>getBindStyle</code>) honors the delegation chain of
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    88
 * property customization specified in the spec. Namely,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    89
 * if two property customizations are attached to an attribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    90
 * use and an attribute decl, then anything unspecified in the
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    91
 * attribute use defaults to attribute decl.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    92
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    93
 * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    94
 * Property customizations are acknowledged
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    95
 * (1) when they are actually used, and
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    96
 * (2) when they are given at the component, which is mapped to a class.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    97
 *     (so-called "point of declaration" customization)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    98
 *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
    99
 * @author
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   100
 *     Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   101
 */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   102
@XmlRootElement(name="property")
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   103
public final class BIProperty extends AbstractDeclarationImpl {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   104
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   105
    // can be null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   106
    @XmlAttribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   107
    private String name = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   108
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   109
    // can be null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   110
    @XmlElement
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   111
    private String javadoc = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   112
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   113
    // can be null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   114
    @XmlElement
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   115
    private BaseTypeBean baseType = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   116
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   117
    // TODO: report 'unsupported' error if this is true
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   118
    @XmlAttribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   119
    private boolean generateFailFastSetterMethod = false;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   120
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   121
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   122
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   123
    public BIProperty(Locator loc, String _propName, String _javadoc,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   124
                      BaseTypeBean _baseType, CollectionTypeAttribute collectionType, Boolean isConst,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   125
                      OptionalPropertyMode optionalProperty, Boolean genElemProp) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   126
        super(loc);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   127
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   128
        this.name = _propName;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   129
        this.javadoc = _javadoc;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   130
        this.baseType = _baseType;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   131
        this.collectionType = collectionType;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   132
        this.isConstantProperty = isConst;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   133
        this.optionalProperty = optionalProperty;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   134
        this.generateElementProperty = genElemProp;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   135
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   136
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   137
    protected BIProperty() {}
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   138
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   139
    @Override
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   140
    public Collection<BIDeclaration> getChildren() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   141
        BIConversion conv = getConv();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   142
        if(conv==null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   143
            return super.getChildren();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   144
        else
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   145
            return Collections.<BIDeclaration>singleton(conv);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   146
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   147
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   148
    public void setParent( BindInfo parent ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   149
        super.setParent(parent);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   150
        if(baseType!=null && baseType.conv!=null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   151
            baseType.conv.setParent(parent);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   152
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   153
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   154
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   155
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   156
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   157
     * Returns the customized property name.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   158
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   159
     * This method honors the "enableJavaNamingConvention" customization
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   160
     * and formats the property name accordingly if necessary.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   161
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   162
     * Thus the caller should <em>NOT</em> apply the XML-to-Java name
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   163
     * conversion algorithm to the value returned from this method.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   164
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   165
     * @param forConstant
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   166
     *      If the property name is intended for a constant property name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   167
     *      set to true. This will change the result
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   168
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   169
     * @return
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   170
     *      This method can return null if the customization doesn't
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   171
     *      specify the name.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   172
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   173
    public String getPropertyName( boolean forConstant ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   174
        if(name!=null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   175
            BIGlobalBinding gb = getBuilder().getGlobalBinding();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   176
            NameConverter nc = getBuilder().model.getNameConverter();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   177
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   178
            if( gb.isJavaNamingConventionEnabled() && !forConstant )
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   179
                // apply XML->Java conversion
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   180
                return nc.toPropertyName(name);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   181
            else
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   182
                return name;    // ... or don't change the value
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   183
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   184
        BIProperty next = getDefault();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   185
        if(next!=null)  return next.getPropertyName(forConstant);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   186
        else            return null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   187
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   188
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   189
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   190
     * Gets the associated javadoc.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   191
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   192
     * @return
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   193
     *      null if none is specfieid.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   194
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   195
    public String getJavadoc() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   196
        return javadoc;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   197
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   198
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   199
    // can be null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   200
    public JType getBaseType() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   201
        if(baseType!=null && baseType.name!=null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   202
            return TypeUtil.getType(getCodeModel(),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   203
                    baseType.name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   204
                    Ring.get(ErrorReceiver.class),getLocation());
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   205
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   206
        BIProperty next = getDefault();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   207
        if(next!=null)  return next.getBaseType();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   208
        else            return null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   209
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   210
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   211
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   212
    // can be null
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   213
    @XmlAttribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   214
    private CollectionTypeAttribute collectionType = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   215
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   216
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   217
     * Gets the realization of this field.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   218
     * @return Always return non-null.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   219
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   220
    CollectionTypeAttribute getCollectionType() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   221
        if(collectionType!=null)   return collectionType;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   222
        return getDefault().getCollectionType();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   223
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   224
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   225
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   226
    @XmlAttribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   227
    private OptionalPropertyMode optionalProperty = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   228
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   229
    // virtual property for @generateIsSetMethod
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   230
    @XmlAttribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   231
    void setGenerateIsSetMethod(boolean b) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   232
        optionalProperty = b ? OptionalPropertyMode.ISSET : OptionalPropertyMode.WRAPPER;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   233
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   234
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   235
    public OptionalPropertyMode getOptionalPropertyMode() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   236
        if(optionalProperty!=null)   return optionalProperty;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   237
        return getDefault().getOptionalPropertyMode();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   238
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   239
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   240
    // null if delegated
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   241
    @XmlAttribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   242
    private Boolean generateElementProperty = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   243
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   244
     * If true, the property will automatically be a reference property.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   245
     * (Talk about confusing names!)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   246
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   247
    private Boolean generateElementProperty() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   248
        if(generateElementProperty!=null)   return generateElementProperty;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   249
        BIProperty next = getDefault();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   250
        if(next!=null)      return next.generateElementProperty();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   251
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   252
        return null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   253
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   254
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   255
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   256
    // true, false, or null (which means the value should be inherited.)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   257
    @XmlAttribute(name="fixedAttributeAsConstantProperty")
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   258
    private Boolean isConstantProperty;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   259
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   260
     * Gets the inherited value of the "fixedAttrToConstantProperty" customization.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   261
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   262
     * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   263
     * Note that returning true from this method doesn't necessarily mean
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   264
     * that a property needs to be mapped to a constant property.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   265
     * It just means that it's mapped to a constant property
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   266
     * <b>if an attribute use carries a fixed value.</b>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   267
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   268
     * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   269
     * I don't like this semantics but that's what the spec implies.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   270
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   271
    public boolean isConstantProperty() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   272
        if(isConstantProperty!=null)    return isConstantProperty;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   273
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   274
        BIProperty next = getDefault();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   275
        if(next!=null)      return next.isConstantProperty();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   276
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   277
        // globalBinding always has true or false in this property,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   278
        // so this can't happen
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   279
        throw new AssertionError();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   280
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   281
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   282
    public CValuePropertyInfo createValueProperty(String defaultName,boolean forConstant,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   283
        XSComponent source,TypeUse tu, QName typeName) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   284
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   285
        markAsAcknowledged();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   286
        constantPropertyErrorCheck();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   287
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   288
        String name = getPropertyName(forConstant);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   289
        if(name==null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   290
            name = defaultName;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   291
            if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode())
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   292
                name = JJavaName.getPluralForm(name);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   293
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   294
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   295
        CValuePropertyInfo prop = wrapUp(new CValuePropertyInfo(name, source, getCustomizations(source), source.getLocator(), tu, typeName), source);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   296
        BIInlineBinaryData.handle(source, prop);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   297
        return prop;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   298
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   299
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   300
    public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   301
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   302
        boolean forConstant =
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   303
            getCustomization(use).isConstantProperty() &&
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   304
            use.getFixedValue()!=null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   305
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   306
        String name = getPropertyName(forConstant);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   307
        if(name==null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   308
            NameConverter conv = getBuilder().getNameConverter();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   309
            if(forConstant)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   310
                name = conv.toConstantName(use.getDecl().getName());
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   311
            else
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   312
                name = conv.toPropertyName(use.getDecl().getName());
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   313
            if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode())
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   314
                name = JJavaName.getPluralForm(name);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   315
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   316
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   317
        markAsAcknowledged();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   318
        constantPropertyErrorCheck();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   319
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   320
        return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   321
                BGMBuilder.getName(use.getDecl()), tu,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   322
                BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   323
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   324
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   325
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   326
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   327
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   328
     * @param defaultName
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   329
     *      If the name is not customized, this name will be used
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   330
     *      as the default. Note that the name conversion <b>MUST</b>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   331
     *      be applied before this method is called if necessary.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   332
     * @param source
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   333
     *      Source schema component from which a field is built.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   334
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   335
    public CElementPropertyInfo createElementProperty(String defaultName, boolean forConstant, XSParticle source,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   336
                                                      RawTypeSet types) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   337
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   338
        if(!types.refs.isEmpty())
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   339
            // if this property is empty, don't acknowleedge the customization
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   340
            // this allows pointless property customization to be reported as an error
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   341
            markAsAcknowledged();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   342
        constantPropertyErrorCheck();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   343
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   344
        String name = getPropertyName(forConstant);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   345
        if(name==null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   346
            name = defaultName;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   347
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   348
        CElementPropertyInfo prop = wrapUp(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   349
            new CElementPropertyInfo(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   350
                name, types.getCollectionMode(),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   351
                types.id(),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   352
                types.getExpectedMimeType(),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   353
                source, getCustomizations(source),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   354
                source.getLocator(), types.isRequired()),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   355
            source);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   356
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   357
        types.addTo(prop);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   358
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   359
        BIInlineBinaryData.handle(source.getTerm(), prop);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   360
        return prop;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   361
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   362
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   363
    public CReferencePropertyInfo createDummyExtendedMixedReferenceProperty(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   364
            String defaultName, XSComponent source, RawTypeSet types) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   365
            return createReferenceProperty(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   366
                    defaultName,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   367
                    false,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   368
                    source,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   369
                    types,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   370
                    true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   371
                    true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   372
                    false,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   373
                    true);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   374
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   375
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   376
    public CReferencePropertyInfo createContentExtendedMixedReferenceProperty(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   377
            String defaultName, XSComponent source, RawTypeSet types) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   378
            return createReferenceProperty(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   379
                    defaultName,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   380
                    false,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   381
                    source,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   382
                    types,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   383
                    true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   384
                    false,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   385
                    true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   386
                    true);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   387
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   388
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   389
    public CReferencePropertyInfo createReferenceProperty(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   390
            String defaultName, boolean forConstant, XSComponent source,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   391
            RawTypeSet types, boolean isMixed, boolean dummy, boolean content, boolean isMixedExtended) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   392
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   393
        if (types == null) {    // this is a special case where we need to generate content because potential subtypes would need to be able to override what's store inside
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   394
            content = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   395
        } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   396
            if(!types.refs.isEmpty())
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   397
                // if this property is empty, don't acknowleedge the customization
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   398
                // this allows pointless property customization to be reported as an error
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   399
                markAsAcknowledged();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   400
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   401
        constantPropertyErrorCheck();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   402
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   403
        String name = getPropertyName(forConstant);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   404
        if(name==null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   405
            name = defaultName;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   406
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   407
        CReferencePropertyInfo prop = wrapUp(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   408
                                            new CReferencePropertyInfo(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   409
                                                name,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   410
                                                (types == null) ? true : types.getCollectionMode().isRepeated()||isMixed,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   411
                                                (types == null) ? false : types.isRequired(),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   412
                                                isMixed,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   413
                                                source,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   414
                                                getCustomizations(source), source.getLocator(), dummy, content, isMixedExtended),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   415
                                        source);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   416
        if (types != null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   417
            types.addTo(prop);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   418
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   419
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   420
        BIInlineBinaryData.handle(source, prop);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   421
        return prop;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   422
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   423
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   424
    public CPropertyInfo createElementOrReferenceProperty(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   425
            String defaultName, boolean forConstant, XSParticle source,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   426
            RawTypeSet types) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   427
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   428
        boolean generateRef;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   429
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   430
        switch(types.canBeTypeRefs) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   431
        case CAN_BE_TYPEREF:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   432
        case SHOULD_BE_TYPEREF:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   433
            // it's up to the use
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   434
            Boolean b = generateElementProperty();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   435
            if(b==null) // follow XJC recommendation
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   436
                generateRef = types.canBeTypeRefs== RawTypeSet.Mode.CAN_BE_TYPEREF;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   437
            else // use the value user gave us
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   438
                generateRef = b;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   439
            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   440
        case MUST_BE_REFERENCE:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   441
            generateRef = true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   442
            break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   443
        default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   444
            throw new AssertionError();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   445
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   446
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   447
        if(generateRef) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   448
            return createReferenceProperty(defaultName,forConstant,source,types, false, false, false, false);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   449
        } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   450
            return createElementProperty(defaultName,forConstant,source,types);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   451
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   452
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   453
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   454
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   455
     * Common finalization of {@link CPropertyInfo} for the create***Property methods.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   456
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   457
    private <T extends CPropertyInfo> T wrapUp(T prop, XSComponent source) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   458
        prop.javadoc = concat(javadoc,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   459
            getBuilder().getBindInfo(source).getDocumentation());
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   460
        if(prop.javadoc==null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   461
            prop.javadoc="";
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   462
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   463
        // decide the realization.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   464
        FieldRenderer r;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   465
        OptionalPropertyMode opm = getOptionalPropertyMode();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   466
        if(prop.isCollection()) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   467
            CollectionTypeAttribute ct = getCollectionType();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   468
            r = ct.get(getBuilder().model);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   469
        } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   470
            FieldRendererFactory frf = getBuilder().fieldRendererFactory;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   471
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   472
            if(prop.isOptionalPrimitive()) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   473
                // the property type can be primitive type if we are to ignore absence
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   474
                switch(opm) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   475
                case PRIMITIVE:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   476
                    r = frf.getRequiredUnboxed();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   477
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   478
                case WRAPPER:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   479
                    // force the wrapper type
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   480
                    r = frf.getSingle();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   481
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   482
                case ISSET:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   483
                    r = frf.getSinglePrimitiveAccess();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   484
                    break;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   485
                default:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   486
                    throw new Error();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   487
                }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   488
            } else {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   489
                r = frf.getDefault();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   490
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   491
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   492
        if(opm==OptionalPropertyMode.ISSET) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   493
            // only isSet is allowed on a collection. these 3 modes aren't really symmetric.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   494
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   495
            // if the property is a primitive type, we need an explicit unset because
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   496
            // we can't overload the meaning of set(null).
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   497
            // if it's a collection, we need to be able to unset it so that we can distinguish
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   498
            // null list and empty list.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   499
            r = new IsSetFieldRenderer( r, prop.isOptionalPrimitive()||prop.isCollection(), true );
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   500
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   501
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   502
        prop.realization = r;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   503
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   504
        JType bt = getBaseType();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   505
        if(bt!=null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   506
            prop.baseType = bt;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   507
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   508
        return prop;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   509
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   510
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   511
    private CCustomizations getCustomizations( XSComponent src ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   512
        return getBuilder().getBindInfo(src).toCustomizationList();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   513
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   514
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   515
    private CCustomizations getCustomizations( XSComponent... src ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   516
        CCustomizations c = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   517
        for (XSComponent s : src) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   518
            CCustomizations r = getCustomizations(s);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   519
            if(c==null)     c = r;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   520
            else            c = CCustomizations.merge(c,r);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   521
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   522
        return c;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   523
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   524
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   525
    private CCustomizations getCustomizations( XSAttributeUse src ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   526
        // customizations for an attribute use should include those defined in the local attribute.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   527
        // this is so that the schema like:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   528
        //
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   529
        // <xs:attribute name="foo" type="xs:int">
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   530
        //   <xs:annotation><xs:appinfo>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   531
        //     <hyperjaxb:... />
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   532
        //
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   533
        // would be picked up
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   534
        if(src.getDecl().isLocal())
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   535
            return getCustomizations(src,src.getDecl());
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   536
        else
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   537
            return getCustomizations((XSComponent)src);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   538
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   539
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   540
    private CCustomizations getCustomizations( XSParticle src ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   541
        // customizations for a particle  should include those defined in the term unless it's global
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   542
        // this is so that the schema like:
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   543
        //
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   544
        // <xs:sequence>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   545
        //   <xs:element name="foo" type="xs:int">
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   546
        //     <xs:annotation><xs:appinfo>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   547
        //       <hyperjaxb:... />
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   548
        //
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   549
        // would be picked up
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   550
        if(src.getTerm().isElementDecl()) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   551
            XSElementDecl xed = src.getTerm().asElementDecl();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   552
            if(xed.isGlobal())
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   553
                return getCustomizations((XSComponent)src);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   554
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   555
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   556
        return getCustomizations(src,src.getTerm());
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   557
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   558
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   559
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   560
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   561
    public void markAsAcknowledged() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   562
        if( isAcknowledged() )  return;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   563
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   564
        // mark the parent as well.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   565
        super.markAsAcknowledged();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   566
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   567
        BIProperty def = getDefault();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   568
        if(def!=null)   def.markAsAcknowledged();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   569
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   570
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   571
    private void constantPropertyErrorCheck() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   572
        if( isConstantProperty!=null && getOwner()!=null ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   573
            // run additional check on the isCOnstantProperty value.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   574
            // this value is not allowed if the schema component doesn't have
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   575
            // a fixed value constraint.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   576
            //
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   577
            // the setParent method associates a customization with the rest of
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   578
            // XSOM object graph, so this is the earliest possible moment where
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   579
            // we can test this.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   580
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   581
            if( !hasFixedValue.find(getOwner()) ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   582
                Ring.get(ErrorReceiver.class).error(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   583
                    getLocation(),
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   584
                    Messages.ERR_ILLEGAL_FIXEDATTR.format()
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   585
                );
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   586
                // set this value to null to avoid the same error to be reported more than once.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   587
                isConstantProperty = null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   588
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   589
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   590
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   591
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   592
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   593
     * Function object that returns true if a component has
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   594
     * a fixed value constraint.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   595
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   596
    private final XSFinder hasFixedValue = new XSFinder() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   597
        public Boolean attributeDecl(XSAttributeDecl decl) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   598
            return decl.getFixedValue()!=null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   599
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   600
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   601
        public Boolean attributeUse(XSAttributeUse use) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   602
            return use.getFixedValue()!=null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   603
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   604
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   605
        public Boolean schema(XSSchema s) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   606
            // we allow globalBindings to have isConstantProperty==true,
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   607
            // so this method returns true to allow this.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   608
            return true;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   609
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   610
    };
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   611
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   612
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   613
     * Finds a BIProperty which this object should delegate to.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   614
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   615
     * @return
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   616
     *      always return non-null for normal BIProperties.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   617
     *      If this object is contained in the BIGlobalBinding, then
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   618
     *      this method returns null to indicate that there's no more default.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   619
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   620
    protected BIProperty getDefault() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   621
        if(getOwner()==null)    return null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   622
        BIProperty next = getDefault(getBuilder(),getOwner());
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   623
        if(next==this)  return null;    // global.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   624
        else            return next;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   625
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   626
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   627
    private static BIProperty getDefault( BGMBuilder builder, XSComponent c ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   628
        while(c!=null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   629
            c = c.apply(defaultCustomizationFinder);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   630
            if(c!=null) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   631
                BIProperty prop = builder.getBindInfo(c).get(BIProperty.class);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   632
                if(prop!=null)  return prop;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   633
            }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   634
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   635
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   636
        // default to the global one
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   637
        return builder.getGlobalBinding().getDefaultProperty();
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   638
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   639
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   640
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   641
    /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   642
     * Finds a property customization that describes how the given
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   643
     * component should be mapped to a property (if it's mapped to
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   644
     * a property at all.)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   645
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   646
     * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   647
     * Consider an attribute use that does NOT carry a property
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   648
     * customization. This schema component is nonetheless considered
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   649
     * to carry a (sort of) implicit property customization, whose values
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   650
     * are defaulted.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   651
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   652
     * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   653
     * This method can be think of the method that returns this implied
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   654
     * property customization.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   655
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   656
     * <p>
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   657
     * Note that this doesn't mean the given component needs to be
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   658
     * mapped to a property. But if it does map to a property, it needs
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   659
     * to follow this customization.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   660
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   661
     * I think this semantics is next to non-sense but I couldn't think
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   662
     * of any other way to follow the spec.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   663
     *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   664
     * @param c
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   665
     *      A customization effective on this component will be returned.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   666
     *      Can be null just to get the global customization.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   667
     * @return
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   668
     *      Always return non-null valid object.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   669
     */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   670
    public static BIProperty getCustomization( XSComponent c ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   671
        BGMBuilder builder = Ring.get(BGMBuilder.class);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   672
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   673
        // look for a customization on this component
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   674
        if( c!=null ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   675
            BIProperty prop = builder.getBindInfo(c).get(BIProperty.class);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   676
            if(prop!=null)  return prop;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   677
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   678
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   679
        // if no such thing exists, defeault.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   680
        return getDefault(builder,c);
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   681
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   682
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   683
    private final static XSFunction<XSComponent> defaultCustomizationFinder = new XSFunction<XSComponent>() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   684
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   685
        public XSComponent attributeUse(XSAttributeUse use) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   686
            return use.getDecl();   // inherit from the declaration
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   687
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   688
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   689
        public XSComponent particle(XSParticle particle) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   690
            return particle.getTerm(); // inherit from the term
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   691
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   692
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   693
        public XSComponent schema(XSSchema schema) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   694
            // no more delegation
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   695
            return null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   696
        }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   697
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   698
        // delegates to the context schema object
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   699
        public XSComponent attributeDecl(XSAttributeDecl decl) { return decl.getOwnerSchema(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   700
        public XSComponent wildcard(XSWildcard wc) { return wc.getOwnerSchema(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   701
        public XSComponent modelGroupDecl(XSModelGroupDecl decl) { return decl.getOwnerSchema(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   702
        public XSComponent modelGroup(XSModelGroup group) { return group.getOwnerSchema(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   703
        public XSComponent elementDecl(XSElementDecl decl) { return decl.getOwnerSchema(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   704
        public XSComponent complexType(XSComplexType type) { return type.getOwnerSchema(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   705
        public XSComponent simpleType(XSSimpleType st) { return st.getOwnerSchema(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   706
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   707
        // property customizations are not allowed on these components.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   708
        public XSComponent attGroupDecl(XSAttGroupDecl decl) { throw new IllegalStateException(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   709
        public XSComponent empty(XSContentType empty) { throw new IllegalStateException(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   710
        public XSComponent annotation(XSAnnotation xsAnnotation) { throw new IllegalStateException(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   711
        public XSComponent facet(XSFacet xsFacet) { throw new IllegalStateException(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   712
        public XSComponent notation(XSNotation xsNotation) { throw new IllegalStateException(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   713
        public XSComponent identityConstraint(XSIdentityConstraint x) { throw new IllegalStateException(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   714
        public XSComponent xpath(XSXPath xsxPath) { throw new IllegalStateException(); }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   715
    };
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   716
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   717
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   718
    private static String concat( String s1, String s2 ) {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   719
        if(s1==null)    return s2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   720
        if(s2==null)    return s1;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   721
        return s1+"\n\n"+s2;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   722
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   723
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   724
    public QName getName() { return NAME; }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   725
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   726
    /** Name of this declaration. */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   727
    public static final QName NAME = new QName(
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   728
        Const.JAXB_NSURI, "property" );
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   729
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   730
    public BIConversion getConv() {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   731
        if(baseType!=null)
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   732
            return baseType.conv;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   733
        else
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   734
            return null;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   735
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   736
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   737
    private static final class BaseTypeBean {
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   738
        /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   739
         * If there's a nested javaType customization, this field
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   740
         * will keep that customization. Otherwise null.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   741
         *
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   742
         * This customization, if present, is used to customize
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   743
         * the simple type mapping at the point of reference.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   744
         */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   745
        @XmlElementRef
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   746
        BIConversion conv;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   747
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   748
        /**
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   749
         * Java type name.
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   750
         */
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   751
        @XmlAttribute
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   752
        String name;
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   753
    }
4abb694f273a 7150322: Stop using drop source bundles in jaxws
ohair
parents:
diff changeset
   754
}