FileDocCategorySizeDatePackage
TypeEntry.javaAPI DocApache Axis 1.415010Sat Apr 22 18:57:28 BST 2006org.apache.axis.wsdl.symbolTable

TypeEntry

public abstract class TypeEntry extends SymTabEntry implements Serializable
This class represents a wsdl types entry that is supported by the WSDL2Java emitter. A TypeEntry has a QName representing its XML name and a name, which in the WSDL2Java back end is its full java name. The TypeEntry may also have a Node, which locates the definition of the emit type in the xml. A TypeEntry object extends SymTabEntry and is built by the SymbolTable class for each supported root complexType, simpleType, and elements that are defined or encountered.

SymTabEntry | TypeEntry / \ Type Element | | (BaseType, (DefinedElement, CollectionType CollectionElement, DefinedType, UndefinedElement) UndefinedType)

UndefinedType and UndefinedElement are placeholders when the real type or element is not encountered yet. Both of these implement the Undefined interface.

A TypeEntry whose java (or other language) name depends on an Undefined type, will have its name initialization deferred until the Undefined type is replaced with a defined type. The updateUndefined() method is invoked by the UndefinedDelegate to update the information.

Each TypeEntry whose language name depends on another TypeEntry will have the refType field set. For example: The TypeEntry for "foo" will have a refType set to the TypeEntry of "bar".

Another Example: The TypeEntry for "hobbyArray" will have a refType that locates the TypeEntry for xsd:string and the dims field will be "[]"

author
Rich Scheuerle (scheu@us.ibm.com)

Fields Summary
protected Node
node
Field node
protected TypeEntry
refType
Field refType
protected String
dims
Field dims
protected boolean
underlTypeNillable
protected QName
componentType
protected QName
itemQName
If this TypeEntry represents an array with elements inside a "wrapper" this field can optionally change the inner QName (default is ).
protected boolean
undefined
Field undefined
protected boolean
isBaseType
Field isBaseType
protected boolean
isSimpleType
Field isSimpleType
protected boolean
onlyLiteralReference
Field onlyLiteralReference
protected HashSet
types
Field types
protected Vector
containedElements
contained elements in the schema's type definition
protected Vector
containedAttributes
contained attributes in the schema's type definition
Constructors Summary
protected TypeEntry(QName pqName, TypeEntry refType, Node pNode, String dims)
Create a TypeEntry object for an xml construct that references another type. Defer processing until refType is known.

param
pqName
param
refType
param
pNode
param
dims


    // whether this type is only referenced
    // via a binding's literal use.

                                              
          
                          

        super(pqName);

        node = pNode;
        this.undefined = refType.undefined;
        this.refType = refType;

        if (dims == null) {
            dims = "";
        }

        this.dims = dims;

        if (refType.undefined) {

            // Need to defer processing until known.
            TypeEntry uType = refType;

            while (!(uType instanceof Undefined)) {
                uType = uType.refType;
            }

            ((Undefined) uType).register(this);
        } else {
            isBaseType = (refType.isBaseType && refType.dims.equals("")
                    && dims.equals(""));
        }
    
protected TypeEntry(QName pqName, Node pNode)
Create a TypeEntry object for an xml construct that is not a base type

param
pqName
param
pNode


        super(pqName);

        node = pNode;
        refType = null;
        undefined = false;
        dims = "";
        isBaseType = false;
    
protected TypeEntry(QName pqName)
Create a TypeEntry object for an xml construct name that represents a base type

param
pqName


        super(pqName);

        node = null;
        undefined = false;
        dims = "";
        isBaseType = true;
    
Methods Summary
public java.lang.StringgetBaseType()
Returns the Base Type Name. For example if the Type represents a schema integer, "int" is returned. If this is a user defined type, null is returned.

return


        if (isBaseType) {
            return name;
        } else {
            return null;
        }
    
public javax.xml.namespace.QNamegetComponentType()
Return the QName of the component if this is an array type

return
QName of array elements or null

        return componentType;
    
public java.util.VectorgetContainedAttributes()

return
Returns the containedAttributes.

        return containedAttributes;
    
public java.util.VectorgetContainedElements()

return
Returns the containedElements.

        return containedElements;
    
public java.lang.StringgetDimensions()
Return the dimensions of this type, which can be 0 or more "[]".

return

        return dims;
    
public javax.xml.namespace.QNamegetItemQName()

        return itemQName;
    
public java.util.HashSetgetNestedTypes(SymbolTable symbolTable, boolean derivedFlag)
This method returns a set of all the nested types. Nested types are types declared within this TypeEntry (or descendents) plus any extended types and the extended type nested types The elements of the returned HashSet are Types.

param
symbolTable is the symbolTable
param
derivedFlag should be set if all dependendent derived types should also be returned.
return

        if( types == null) {
            types = Utils.getNestedTypes(this, symbolTable, derivedFlag);
        }
        return types;
    
public org.w3c.dom.NodegetNode()
Query the node for this type.

return

        return node;
    
public org.apache.axis.wsdl.symbolTable.TypeEntrygetRefType()
If this type references another type, return that type, otherwise return null.

return

        return refType;
    
protected org.apache.axis.wsdl.symbolTable.TypeEntrygetUndefinedTypeRef()
getUndefinedTypeRef returns the Undefined TypeEntry that this entry depends on or NULL.

return


        if (this instanceof Undefined) {
            return this;
        }

        if (undefined && (refType != null)) {
            if (refType.undefined) {
                TypeEntry uType = refType;

                while (!(uType instanceof Undefined)) {
                    uType = uType.refType;
                }

                return uType;
            }
        }

        return null;
    
public booleangetUnderlTypeNillable()
Return whether the underlying type is nillable if this is an array type.

return
true if it is an array and nillable

	    // refType could refer to array with underlying nillable
	    // type - set the underlTypeNillable to true if this is 
	    // the case.
        if (!underlTypeNillable 
            && !getDimensions().equals("")
            && refType != null) {
            underlTypeNillable = refType.getUnderlTypeNillable();
	    }
	    return underlTypeNillable;
    
public booleanisBaseType()
Method isBaseType

return

        return isBaseType;
    
public booleanisOnlyLiteralReferenced()
Is this type references ONLY as a literal type? If a binding's message's soapBody says: use="literal", then a type is referenced literally. Note that that type's contained types (ie., an address contains a phone#) are not referenced literally. Since a type that is ONLY referenced as a literal may cause a generator to act differently (like WSDL2Java), this extra reference distinction is needed.

return

        return onlyLiteralReference;
    
public booleanisSimpleType()
Method isSimpleType

return

        return isSimpleType;
    
public voidsetBaseType(boolean baseType)
Method setBaseType

param
baseType

        isBaseType = baseType;
    
public voidsetComponentType(javax.xml.namespace.QName componentType)
Set the QName of the component if this is an array type

        this.componentType = componentType;
    
public voidsetContainedAttributes(java.util.Vector containedAttributes)

param
containedAttributes The containedAttributes to set.

        this.containedAttributes = containedAttributes;
    
public voidsetContainedElements(java.util.Vector containedElements)

param
containedElements The containedElements to set.

        this.containedElements = containedElements;
    
public voidsetItemQName(javax.xml.namespace.QName itemQName)

        this.itemQName = itemQName;
    
public voidsetOnlyLiteralReference(boolean set)
Set the isOnlyLiteralReference flag.

param
set

        onlyLiteralReference = set;
    
public voidsetRefType(org.apache.axis.wsdl.symbolTable.TypeEntry refType)
Method setRefType

param
refType

        this.refType = refType;
    
public voidsetSimpleType(boolean simpleType)
Method setSimpleType

param
simpleType

        isSimpleType = simpleType;
    
public voidsetUnderlTypeNillable(boolean underlTypeNillable)
Set the boolean indicating whether underlying type of array is nillable.

        this.underlTypeNillable = underlTypeNillable;
    
public java.lang.StringtoString()
Get string representation.

return

        return toString("");
    
protected java.lang.StringtoString(java.lang.String indent)
Get string representation with indentation

param
indent
return


        String refString = indent + "RefType:       null \n";

        if (refType != null) {
            refString = indent + "RefType:\n" + refType.toString(indent + "  ")
                    + "\n";
        }

        return super.toString(indent) 
                + indent + "Class:         " + this.getClass().getName() + "\n" 
                + indent + "Base?:         " + isBaseType + "\n" 
                + indent + "Undefined?:    " + undefined + "\n" 
                + indent + "isSimpleType?  " + isSimpleType + "\n"
                + indent + "Node:          " + getNode() + "\n" 
                + indent + "Dims:          " + dims + "\n"              
                + indent + "isOnlyLiteralReferenced: " + onlyLiteralReference + "\n"
                + refString;
    
protected booleanupdateUndefined(org.apache.axis.wsdl.symbolTable.TypeEntry oldRef, org.apache.axis.wsdl.symbolTable.TypeEntry newRef)
UpdateUndefined is called when the ref TypeEntry is finally known.

param
oldRef The TypeEntry representing the Undefined TypeEntry
param
newRef The replacement TypeEntry
return
true if TypeEntry is changed in any way.
throws
IOException


        boolean changedState = false;

        // Replace refType with the new one if applicable
        if (refType == oldRef) {
            refType = newRef;
            changedState = true;

            // Detect a loop
            TypeEntry te = refType;

            while ((te != null) && (te != this)) {
                te = te.refType;
            }

            if (te == this) {

                // Detected a loop.
                undefined = false;
                isBaseType = false;
                node = null;

                throw new IOException(
                        Messages.getMessage(
                                "undefinedloop00", getQName().toString()));
            }
        }

        // Update information if refType is now defined
        if ((refType != null) && undefined && (refType.undefined == false)) {
            undefined = false;
            changedState = true;
            isBaseType = (refType.isBaseType && refType.dims.equals("")
                    && dims.equals(""));
        }

        return changedState;