FileDocCategorySizeDatePackage
IdentityConstraint.javaAPI DocApache Xerces 3.0.17734Fri Sep 14 20:33:52 BST 2007org.apache.xerces.impl.xs.identity

IdentityConstraint

public abstract class IdentityConstraint extends Object implements org.apache.xerces.xs.XSIDCDefinition
Base class of Schema identity constraint.
xerces.internal
author
Andy Clark, IBM
version
$Id: IdentityConstraint.java 572110 2007-09-02 19:04:44Z mrglavas $

Fields Summary
protected short
type
type
protected final String
fNamespace
target namespace
protected final String
fIdentityConstraintName
Identity constraint name.
protected final String
fElementName
name of owning element
protected Selector
fSelector
Selector.
protected int
fFieldCount
Field count.
protected Field[]
fFields
Fields.
protected org.apache.xerces.impl.xs.XSAnnotationImpl[]
fAnnotations
protected int
fNumAnnotations
Constructors Summary
protected IdentityConstraint(String namespace, String identityConstraintName, String elemName)
Default constructor.


    //
    // Constructors
    //

       
           
        fNamespace = namespace;
        fIdentityConstraintName = identityConstraintName;
        fElementName = elemName;
    
Methods Summary
public voidaddAnnotation(org.apache.xerces.impl.xs.XSAnnotationImpl annotation)

        if(annotation == null)
            return;
        if(fAnnotations == null) {
            fAnnotations = new XSAnnotationImpl[2];
        } else if(fNumAnnotations == fAnnotations.length) {
            XSAnnotationImpl[] newArray = new XSAnnotationImpl[fNumAnnotations << 1];
            System.arraycopy(fAnnotations, 0, newArray, 0, fNumAnnotations);
            fAnnotations = newArray;
        }
        fAnnotations[fNumAnnotations++] = annotation;
    
public voidaddField(Field field)
Adds a field.

        if (fFields == null)
            fFields = new Field[4];
        else if (fFieldCount == fFields.length)
            fFields = resize(fFields, fFieldCount*2);
        fFields[fFieldCount++] = field;
    
public booleanequals(org.apache.xerces.impl.xs.identity.IdentityConstraint id)

        boolean areEqual = fIdentityConstraintName.equals(id.fIdentityConstraintName);
        if(!areEqual) return false;
        areEqual = fSelector.toString().equals(id.fSelector.toString());
        if(!areEqual) return false;
        areEqual = (fFieldCount == id.fFieldCount);
        if(!areEqual) return false;
        for(int i=0; i<fFieldCount; i++)
            if(!fFields[i].toString().equals(id.fFields[i].toString())) return false;
        return true;
    
public org.apache.xerces.xs.XSObjectListgetAnnotations()
Optional. Annotation.

        return new XSObjectListImpl(fAnnotations, fNumAnnotations);
    
public shortgetCategory()
{identity-constraint category} One of key, keyref or unique.

        return type;
    
public java.lang.StringgetElementName()

        return fElementName;
    
public FieldgetFieldAt(int index)
Returns the field at the specified index.

        return fFields[index];
    
public intgetFieldCount()
Returns the field count.

        return fFieldCount;
    
public org.apache.xerces.xs.StringListgetFieldStrs()
{fields} A non-empty list of restricted XPath ([XPath]) expressions.

        String[] strs = new String[fFieldCount];
        for (int i = 0; i < fFieldCount; i++)
            strs[i] = fFields[i].toString();
        return new StringListImpl(strs, fFieldCount);
    
public java.lang.StringgetIdentityConstraintName()
Returns the identity constraint name.

        return fIdentityConstraintName;
    
public java.lang.StringgetName()
The name of this XSObject depending on the XSObject type.

        return fIdentityConstraintName;
    
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 fNamespace;
    
public org.apache.xerces.xs.XSNamespaceItemgetNamespaceItem()

see
org.apache.xerces.xs.XSObject#getNamespaceItem()

        // REVISIT: implement
		return null;
	
public org.apache.xerces.xs.XSIDCDefinitiongetRefKey()
{referenced key} Required if {identity-constraint category} is keyref, forbidden otherwise. An identity-constraint definition with {identity-constraint category} equal to key or unique.

        return null;
    
public SelectorgetSelector()
Returns the selector.

        return fSelector;
    
public java.lang.StringgetSelectorStr()
{selector} A restricted XPath ([XPath]) expression

        return (fSelector != null) ? fSelector.toString() : null;
    
public shortgetType()
Get the type of the object, i.e ELEMENT_DECLARATION.

        return XSConstants.IDENTITY_CONSTRAINT;
    
static final Field[]resize(Field[] oldArray, int newSize)

        Field[] newArray = new Field[newSize];
        System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
        return newArray;
    
public voidsetSelector(Selector selector)
Sets the selector.

        fSelector = selector;
    
public java.lang.StringtoString()
Returns a string representation of this object.

        String s = super.toString();
        int index1 = s.lastIndexOf('$");
        if (index1 != -1) {
            return s.substring(index1 + 1);
        }
        int index2 = s.lastIndexOf('.");
        if (index2 != -1) {
            return s.substring(index2 + 1);
        }
        return s;