/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Mutable {@link ClassInfo} represenatation.
*
* <p>
* Schema parsers build these objects.
*
* @author Kohsuke Kawaguchi
*/
public final class CClassInfo extends AbstractCElement implements ClassInfo<NType,NClass>, CClassInfoParent, CClass, NClass {
/**
* List of all subclasses, together with {@link #nextSibling}.
*
* If this class has no sub-class, this field is null. Otherwise,
* this field points to a sub-class of this class. From there you can enumerate
* all the sub-classes by using {@link #nextSibling}.
*/
/**
* @see #firstSubclass
*/
/**
* @see #getTypeName()
*/
/**
* Custom {@link #getSqueezedName() squeezed name}, if any.
*/
/**
* If this class also gets {@link XmlRootElement}, the class name.
*/
private boolean isOrdered = true;
/**
* TODO: revisit this design.
* we should at least do a basic encapsulation to avoid careless
* mistakes. Maybe we should even differ the javadoc generation
* by queueing runners.
*/
/**
* short name.
*/
/**
* Optional user-specified implementation override class.
*/
/**
* The {@link Model} object to which this bean belongs.
*/
/**
* @see #hasAttributeWildcard()
*/
private boolean hasAttributeWildcard;
public CClassInfo(Model model,JPackage pkg, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations) {
}
public CClassInfo(Model model,CClassInfoParent p, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations) {
this.parent = p;
this.elementName = elementName;
if ((schemaLanguage != null) &&
BIFactoryMethod factoryMethod = Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class);
if(factoryMethod!=null) {
}
}
}
public CClassInfo(Model model,JCodeModel cm, String fullName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations) {
if(idx<0) {
} else {
}
this.elementName = elementName;
}
public boolean hasAttributeWildcard() {
return hasAttributeWildcard;
}
}
public boolean hasSubClasses() {
return firstSubclass!=null;
}
/**
* Returns true if a new attribute wildcard property needs to be
* declared on this class.
*/
public boolean declaresAttributeWildcard() {
return hasAttributeWildcard && !inheritsAttributeWildcard();
}
/**
* Returns true if this class inherits a wildcard attribute property
* from its ancestor classes.
*/
public boolean inheritsAttributeWildcard() {
if (getRefBaseClass() != null) {
return true;
}
} else {
if(c.hasAttributeWildcard)
return true;
}
}
return false;
}
return this;
}
return null;
}
return fullName();
}
/**
* Returns the "squeezed name" of this bean token.
* <p>
* The squeezed name of a bean is the concatenation of
* the names of its outer classes and itself.
* <p>
* Thus if the bean is "org.acme.foo.Bean", then the squeezed name is "Bean",
* if the bean is "org.acme.foo.Outer1.Outer2.Bean", then "Outer1Outer2Bean".
* <p>
* This is used by the code generator
*/
return calcSqueezedName.onBean(this);
}
}
}
return "";
}
};
/**
* Returns a mutable list.
*/
return properties;
}
public boolean hasValueProperty() {
throw new UnsupportedOperationException();
}
/**
* Gets a propery by name.
*/
// TODO: does this method need to be fast?
for( CPropertyInfo p : properties )
return p;
return null;
}
public boolean hasProperties() {
return !getProperties().isEmpty();
}
public boolean isElement() {
return elementName!=null;
}
/**
* Guaranteed to return this.
*/
return this;
}
if(isElement())
return this;
else
return null;
}
public boolean isOrdered() {
return isOrdered;
}
/**
* @deprecated
* if you are calling this method directly, you must be doing something wrong.
*/
public boolean isFinal() {
return false;
}
}
return elementName;
}
return typeName;
}
public boolean isSimpleType() {
throw new UnsupportedOperationException();
}
/**
* Returns the FQCN of this bean.
*/
else return r+'.'+shortName;
}
return parent;
}
}
return implClass;
}
/**
* Adds a new property.
*/
// this property isn't contributing anything
// this happens when you try to map an empty sequence to a property
return;
}
/**
* This method accepts both {@link CClassInfo} (which means the base class
* is also generated), or {@link CClassRef} (which means the base class is
* already generated and simply referenced.)
*
* The latter is treated somewhat special --- from the rest of the model
* this external base class is invisible. This modeling might need more
* thoughts to get right.
*/
assert nextSibling==null;
if (base instanceof CClassInfo) {
realBase.firstSubclass = this;
}
}
/**
* This inherited version returns null if this class extends from {@link CClassRef}.
*
* @see #getRefBaseClass()
*/
if (baseClass instanceof CClassInfo) {
return (CClassInfo) baseClass;
} else {
return null;
}
}
} else {
return null;
}
}
/**
* Enumerates all the sub-classes of this class.
*/
return new Iterator<CClassInfo>() {
public boolean hasNext() {
}
public CClassInfo next() {
CClassInfo r = cur;
return r;
}
public void remove() {
throw new UnsupportedOperationException();
}
};
}
CClassInfo c=getBaseClass();
c=c.getBaseClass();
return c;
}
/**
* Interfaces to be implemented.
* Lazily constructed.
*/
if(_implements==null)
_implements.add(c);
}
/** Constructor declarations. array of {@link Constructor}s. */
/** Creates a new constructor declaration and adds it. */
}
/** list all constructor declarations. */
return constructors;
}
}
return parent.getOwnerPackage();
}
return this;
}
switch(aspect) {
case IMPLEMENTATION:
case EXPOSED:
default:
throw new IllegalStateException();
}
}
public boolean isBoxedType() {
return false;
}
return fullName();
}
}