Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]

    1   /*   Copyright 2004 The Apache Software Foundation
    2    *
    3    *   Licensed under the Apache License, Version 2.0 (the "License");
    4    *   you may not use this file except in compliance with the License.
    5    *   You may obtain a copy of the License at
    6    *
    7    *       http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    *   Unless required by applicable law or agreed to in writing, software
   10    *   distributed under the License is distributed on an "AS IS" BASIS,
   11    *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12    *   See the License for the specific language governing permissions and
   13    *  limitations under the License.
   14    */
   15   
   16   package org.apache.xmlbeans;
   17   
   18   import javax.xml.namespace.QName;
   19   import java.util.Map;
   20   
   21   /**
   22    * Represents an identity constraint definition.
   23    */ 
   24   public interface SchemaIdentityConstraint extends SchemaComponent, SchemaAnnotated
   25   {
   26       /**
   27        * Return the selector xpath as a string.
   28        */
   29       String getSelector();
   30   
   31       /**
   32        * Return a compiled xpath object for the selector.
   33        */
   34       Object getSelectorPath();
   35   
   36       /**
   37        * Return (a copy of) the xpaths for all the fields.
   38        */
   39       String[] getFields();
   40   
   41       /**
   42        * Return a compiled xpath object for the field.
   43        */
   44       Object getFieldPath(int index);
   45   
   46       /**
   47        * Return a read-only copy of the namespace map. This is the 
   48        * set of prefix to URI mappings that were in scope in the
   49        * schema at the point at which this constraint was declared
   50        */
   51       Map getNSMap();
   52   
   53       /** A <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-key">xs:key</a> constraint.  See {@link #getConstraintCategory}. */
   54       public static final int CC_KEY = 1;
   55       /** A <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-key">xs:keyRef</a> constraint.  See {@link #getConstraintCategory}. */
   56       public static final int CC_KEYREF = 2;
   57       /** A <a target="_blank" href="http://www.w3.org/TR/xmlschema-1/#declare-key">xs:unique</a> constraint.  See {@link #getConstraintCategory}. */
   58       public static final int CC_UNIQUE = 3;
   59   
   60       /**
   61        * Return the constraint category. Either {@link #CC_KEY}, {@link #CC_KEYREF},
   62        * or {@link #CC_UNIQUE}.
   63        */
   64       int getConstraintCategory();
   65   
   66       /**
   67        * Returns the key that a key ref refers to. Only valid for
   68        * keyrefs.
   69        */
   70       SchemaIdentityConstraint getReferencedKey();
   71   
   72       /**
   73        * Used to allow on-demand loading of identity constraints.
   74        * 
   75        * @exclude
   76        */
   77       public static final class Ref extends SchemaComponent.Ref
   78       {
   79           public Ref(SchemaIdentityConstraint idc)
   80               { super(idc); }
   81   
   82           public Ref(SchemaTypeSystem system, String handle)
   83               { super(system, handle); }
   84   
   85           public final int getComponentType()
   86               { return SchemaComponent.IDENTITY_CONSTRAINT; }
   87   
   88           public final SchemaIdentityConstraint get()
   89               { return (SchemaIdentityConstraint)getComponent(); }
   90       }
   91   
   92       /**
   93        * Returns user-specific information.
   94        * @see SchemaBookmark
   95        */
   96       Object getUserData();
   97   }

Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]