FileDocCategorySizeDatePackage
XSElementDecl.javaAPI DocJava SE 6 API11602Tue Jun 10 00:22:44 BST 2008com.sun.org.apache.xerces.internal.impl.xs

XSElementDecl

public class XSElementDecl extends Object implements XSElementDeclaration
The XML representation for an element declaration schema component is an element information item
xerces.internal
author
Elena Litani, IBM
author
Sandy Gao, IBM
version
$Id: XSElementDecl.java,v 1.2.6.1 2005/09/09 07:30:55 sunithareddy Exp $

Fields Summary
public static final short
SCOPE_ABSENT
public static final short
SCOPE_GLOBAL
public static final short
SCOPE_LOCAL
public String
fName
public String
fTargetNamespace
public XSTypeDefinition
fType
short
fMiscFlags
public short
fScope
XSComplexTypeDecl
fEnclosingCT
public short
fBlock
public short
fFinal
public XSAnnotationImpl
fAnnotation
public ValidatedInfo
fDefault
public XSElementDecl
fSubGroup
static final int
INITIAL_SIZE
int
fIDCPos
IdentityConstraint[]
fIDConstraints
private static final short
CONSTRAINT_MASK
private static final short
NILLABLE
private static final short
ABSTRACT
private String
fDescription
get the string description of this element
Constructors Summary
Methods Summary
public voidaddIDConstraint(com.sun.org.apache.xerces.internal.impl.xs.identity.IdentityConstraint idc)

        if (fIDCPos == fIDConstraints.length) {
            fIDConstraints = resize(fIDConstraints, fIDCPos*2);
        }
        fIDConstraints[fIDCPos++] = idc;
    
public booleanequals(java.lang.Object o)
whether two decls are the same

        return o == this;
    
public booleangetAbstract()
{abstract} A boolean.

        return ((fMiscFlags & ABSTRACT) != 0);
    
public java.lang.ObjectgetActualVC()

        return getConstraintType() == XSConstants.VC_NONE ?
               null :
               fDefault.actualValue;
    
public shortgetActualVCType()

        return getConstraintType() == XSConstants.VC_NONE ?
               XSConstants.UNAVAILABLE_DT :
               fDefault.actualValueType;
    
public com.sun.org.apache.xerces.internal.xs.XSAnnotationgetAnnotation()
Optional. Annotation.

        return fAnnotation;
    
public shortgetConstraintType()
A value constraint: one of default, fixed.

        return (short)(fMiscFlags & CONSTRAINT_MASK);
    
public java.lang.StringgetConstraintValue()
A value constraint: The actual value (with respect to the {type definition})

        // REVISIT: SCAPI: what's the proper representation
        return getConstraintType() == XSConstants.VC_NONE ?
               null :
               fDefault.stringValue();
    
public shortgetDisallowedSubstitutions()
The supplied values for {disallowed substitutions}

return
A bit flag representing {substitution, extension, restriction} or NONE.

        return fBlock;
    
public com.sun.org.apache.xerces.internal.xs.XSComplexTypeDefinitiongetEnclosingCTDefinition()
Locally scoped declarations are available for use only within the complex type definition identified by the scope property.

        return fEnclosingCT;
    
public com.sun.org.apache.xerces.internal.impl.xs.identity.IdentityConstraint[]getIDConstraints()

        if (fIDCPos == 0) {
            return null;
        }
        if (fIDCPos < fIDConstraints.length) {
            fIDConstraints = resize(fIDConstraints, fIDCPos);
        }
        return fIDConstraints;
    
public com.sun.org.apache.xerces.internal.xs.XSNamedMapgetIdentityConstraints()
{identity-constraint definitions} A set of constraint definitions.

        return new XSNamedMapImpl(fIDConstraints, fIDCPos);
    
public com.sun.org.apache.xerces.internal.xs.ShortListgetItemValueTypes()

        return getConstraintType() == XSConstants.VC_NONE ?
               null :
               fDefault.itemValueTypes;
    
public java.lang.StringgetName()
The name of this XSObject depending on the XSObject type.

        return fName;
    
public java.lang.StringgetNamespace()
The namespace URI of this node, or null if it is unspecified. defines how a namespace URI is attached to schema components.

        return fTargetNamespace;
    
public com.sun.org.apache.xerces.internal.xs.XSNamespaceItemgetNamespaceItem()

see
com.sun.org.apache.xerces.internal.xs.XSObject#getNamespaceItem()

        // REVISIT: implement
        return null;
    
public booleangetNillable()
If {nillable} is true, then an element may also be valid if it carries the namespace qualified attribute with [local name] nil from namespace http://www.w3.org/2001/XMLSchema-instance and value true (see xsi:nil (2.6.2)) even if it has no text or element content despite a {content type} which would otherwise require content.

        return ((fMiscFlags & NILLABLE) != 0);
    
public shortgetScope()
Optional. Either global or a complex type definition ( ctDefinition). This property is absent in the case of declarations within named model groups: their scope will be determined when they are used in the construction of complex type definitions.

        return fScope;
    
public com.sun.org.apache.xerces.internal.xs.XSElementDeclarationgetSubstitutionGroupAffiliation()
{substitution group affiliation} Optional. A top-level element definition.

        return fSubGroup;
    
public shortgetSubstitutionGroupExclusions()
Specifies if this declaration can be nominated as the {substitution group affiliation} of other element declarations having the same {type definition} or types derived therefrom.

return
A bit flag representing {extension, restriction} or NONE.

        return fFinal;
    
public shortgetType()
Get the type of the object, i.e ELEMENT_DECLARATION.

        return XSConstants.ELEMENT_DECLARATION;
    
public com.sun.org.apache.xerces.internal.xs.XSTypeDefinitiongetTypeDefinition()
Either a simple type definition or a complex type definition.

        return fType;
    
public inthashCode()
get the hash code

        int code = fName.hashCode();
        if (fTargetNamespace != null)
            code = (code<<16)+fTargetNamespace.hashCode();
        return code;
    
public booleanisDisallowedSubstitution(short disallowed)
Convenience method. Check if disallowed is a disallowed substitution for this element declaration.

param
disallowed Substitution, extension, restriction or none. Represents a block set for the element.
return
True if disallowed is a part of the substitution group exclusion subset.

        return (fBlock & disallowed) != 0;
    
public booleanisSubstitutionGroupExclusion(short exclusion)
Convenience method. Check if exclusion is a substitution group exclusion for this element declaration.

param
exclusion Extension, restriction or none. Represents final set for the element.
return
True if exclusion is a part of the substitution group exclusion subset.

        return (fFinal & exclusion) != 0;
    
public voidreset()
Reset current element declaration


        fName = null;
        fTargetNamespace = null;
        fType = null;
        fMiscFlags = 0;
        fBlock = XSConstants.DERIVATION_NONE;
        fFinal = XSConstants.DERIVATION_NONE;
        fDefault = null;
        fAnnotation = null;
        fSubGroup = null;
        // reset identity constraints
        for (int i=0;i<fIDCPos;i++) {
            fIDConstraints[i] = null;
        }

        fIDCPos = 0;
    
static final com.sun.org.apache.xerces.internal.impl.xs.identity.IdentityConstraint[]resize(com.sun.org.apache.xerces.internal.impl.xs.identity.IdentityConstraint[] oldArray, int newSize)

        IdentityConstraint[] newArray = new IdentityConstraint[newSize];
        System.arraycopy(oldArray, 0, newArray, 0, Math.min(oldArray.length, newSize));
        return newArray;
    
public voidsetConstraintType(short constraintType)


    // methods to get/set misc flag
        
        // first clear the bits
        fMiscFlags ^= (fMiscFlags & CONSTRAINT_MASK);
        // then set the proper one
        fMiscFlags |= (constraintType & CONSTRAINT_MASK);
    
public voidsetIsAbstract()

        fMiscFlags |= ABSTRACT;
    
public voidsetIsGlobal()

        fScope = SCOPE_GLOBAL;
    
public voidsetIsLocal(com.sun.org.apache.xerces.internal.impl.xs.XSComplexTypeDecl enclosingCT)

        fScope = SCOPE_LOCAL;
        fEnclosingCT = enclosingCT;
    
public voidsetIsNillable()

        fMiscFlags |= NILLABLE;
    
public java.lang.StringtoString()

       
        if (fDescription == null) {
            if (fTargetNamespace != null) {
                StringBuffer buffer = new StringBuffer(
                    fTargetNamespace.length() + 
                    ((fName != null) ? fName.length() : 4) + 3);
                buffer.append('"");
                buffer.append(fTargetNamespace);
                buffer.append('"");
                buffer.append(':");
                buffer.append(fName);
                fDescription = buffer.toString();
            }
            else {
                fDescription = fName;
            }
        }
        return fDescription;