325N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. Oracle designates this 325N/A * particular file as subject to the "Classpath" exception as provided 325N/A * by Oracle in the LICENSE file that accompanied this code. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 325N/A * or visit www.oracle.com if you need additional information or have any 325N/A * Property customization. 325N/A * This customization turns an arbitrary schema component 325N/A * into a Java property (some restrictions apply.) 325N/A * All the getter methods (such as <code>getBaseType</code> or 325N/A * <code>getBindStyle</code>) honors the delegation chain of 325N/A * property customization specified in the spec. Namely, 325N/A * if two property customizations are attached to an attribute 325N/A * use and an attribute decl, then anything unspecified in the 325N/A * attribute use defaults to attribute decl. 325N/A * Property customizations are acknowledged 325N/A * (1) when they are actually used, and 325N/A * (2) when they are given at the component, which is mapped to a class. 325N/A * (so-called "point of declaration" customization) 325N/A * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) 325N/A // TODO: report 'unsupported' error if this is true 325N/A * Returns the customized property name. 325N/A * This method honors the "enableJavaNamingConvention" customization 325N/A * and formats the property name accordingly if necessary. 325N/A * Thus the caller should <em>NOT</em> apply the XML-to-Java name 325N/A * conversion algorithm to the value returned from this method. 325N/A * If the property name is intended for a constant property name, 325N/A * set to true. This will change the result 325N/A * This method can return null if the customization doesn't 325N/A // apply XML->Java conversion 325N/A return name;
// ... or don't change the value 325N/A * Gets the associated javadoc. 325N/A * null if none is specfieid. 325N/A * Gets the realization of this field. 325N/A * @return Always return non-null. 325N/A // virtual property for @generateIsSetMethod 325N/A * If true, the property will automatically be a reference property. 325N/A * (Talk about confusing names!) 325N/A // true, false, or null (which means the value should be inherited.) 325N/A * Gets the inherited value of the "fixedAttrToConstantProperty" customization. 325N/A * Note that returning true from this method doesn't necessarily mean 325N/A * that a property needs to be mapped to a constant property. 325N/A * It just means that it's mapped to a constant property 325N/A * <b>if an attribute use carries a fixed value.</b> 325N/A * I don't like this semantics but that's what the spec implies. 325N/A // globalBinding always has true or false in this property, 325N/A // so this can't happen 325N/A * If the name is not customized, this name will be used 325N/A * as the default. Note that the name conversion <b>MUST</b> 325N/A * be applied before this method is called if necessary. 325N/A * Source schema component from which a field is built. 325N/A // if this property is empty, don't acknowleedge the customization 325N/A // this allows pointless property customization to be reported as an error 325N/A 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 325N/A // if this property is empty, don't acknowleedge the customization 325N/A // this allows pointless property customization to be reported as an error 325N/A else // use the value user gave us 325N/A * Common finalization of {@link CPropertyInfo} for the create***Property methods. 325N/A // decide the realization. 325N/A // the property type can be primitive type if we are to ignore absence 325N/A // force the wrapper type 325N/A // only isSet is allowed on a collection. these 3 modes aren't really symmetric. 325N/A // if the property is a primitive type, we need an explicit unset because 325N/A // we can't overload the meaning of set(null). 325N/A // if it's a collection, we need to be able to unset it so that we can distinguish 325N/A // null list and empty list. 325N/A // customizations for an attribute use should include those defined in the local attribute. 325N/A // this is so that the schema like: 325N/A // <xs:attribute name="foo" type="xs:int"> 325N/A // <xs:annotation><xs:appinfo> 325N/A // customizations for a particle should include those defined in the term unless it's global 325N/A // this is so that the schema like: 325N/A // <xs:element name="foo" type="xs:int"> 325N/A // <xs:annotation><xs:appinfo> 325N/A // mark the parent as well. 325N/A // run additional check on the isCOnstantProperty value. 325N/A // this value is not allowed if the schema component doesn't have 325N/A // a fixed value constraint. 325N/A // the setParent method associates a customization with the rest of 325N/A // XSOM object graph, so this is the earliest possible moment where 325N/A // set this value to null to avoid the same error to be reported more than once. 325N/A * Function object that returns true if a component has 325N/A * a fixed value constraint. 325N/A // we allow globalBindings to have isConstantProperty==true, 325N/A // so this method returns true to allow this. 325N/A * Finds a BIProperty which this object should delegate to. 325N/A * always return non-null for normal BIProperties. 325N/A * If this object is contained in the BIGlobalBinding, then 325N/A * this method returns null to indicate that there's no more default. 325N/A // default to the global one 325N/A * Finds a property customization that describes how the given 325N/A * component should be mapped to a property (if it's mapped to 325N/A * Consider an attribute use that does NOT carry a property 325N/A * customization. This schema component is nonetheless considered 325N/A * to carry a (sort of) implicit property customization, whose values 325N/A * This method can be think of the method that returns this implied 325N/A * property customization. 325N/A * Note that this doesn't mean the given component needs to be 325N/A * mapped to a property. But if it does map to a property, it needs 325N/A * to follow this customization. 325N/A * I think this semantics is next to non-sense but I couldn't think 325N/A * of any other way to follow the spec. 325N/A * A customization effective on this component will be returned. 325N/A * Can be null just to get the global customization. 325N/A * Always return non-null valid object. 325N/A // look for a customization on this component 325N/A // if no such thing exists, defeault. 325N/A // delegates to the context schema object 325N/A // property customizations are not allowed on these components. 325N/A /** Name of this declaration. */ 325N/A * If there's a nested javaType customization, this field 325N/A * will keep that customization. Otherwise null. 325N/A * This customization, if present, is used to customize 325N/A * the simple type mapping at the point of reference.