Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 49   Methods: 3
NCLOC: 33   Classes: 1
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
TypeKeyOrUniqueConstraintElement.java 16,7% 50% 100% 47,8%
 1   
 /*
 2   
  * JBind
 3   
  *
 4   
  * Copyright (c) by Stefan Wachter. All rights reserved.
 5   
  *
 6   
  * Usage, modification, and redistribution is subject to license terms that are
 7   
  * available at 'http://www.jbind.org'. The JBind license is like the
 8   
  * 'Apache Software License V 1.1'.
 9   
  */
 10   
 package org.jbind.xml.schema.element;
 11   
 
 12   
 import org.jbind.xml.base.IAttribute;
 13   
 import org.jbind.xml.core.constraint.ITypeInstanceConstraint;
 14   
 import org.jbind.xml.msg.XmlException;
 15   
 import org.jbind.xml.msg.XmlMessages;
 16   
 import org.jbind.xml.schema.constraint.TypeInstanceConstraint;
 17   
 
 18   
 public abstract class TypeKeyOrUniqueConstraintElement extends TypeIdentityConstraintElement {
 19   
 
 20   
   private TypeInstanceConstraint.IScope myScope = TypeInstanceConstraint.GLOBAL;
 21   
 
 22  8
   public TypeKeyOrUniqueConstraintElement(CreationParams aCreationParams) {
 23  8
     super(aCreationParams);
 24   
   }
 25   
 
 26  8
   protected IAttribute doCreateAttribute(ACParams anACParams) throws XmlException {
 27  8
     IAttribute res = null;
 28  8
     String an = NameUtil.getSchemaAttributeName(anACParams);
 29  8
     if ("scope".equals(an)) {
 30  0
       res = new Attribute(anACParams);
 31  0
       String s = res.getStringValue();
 32  0
       if ("local".equals(s)) {
 33  0
         myScope = ITypeInstanceConstraint.LOCAL;
 34  0
       } else if ("global".equals(s)) {
 35  0
         myScope = ITypeInstanceConstraint.GLOBAL;
 36   
       } else {
 37  0
         throw new XmlException(XmlMessages.unknownScope(s, this));
 38   
       }
 39   
     } else {
 40  8
       res = super.doCreateAttribute(anACParams);
 41   
     }
 42  8
     return res;
 43   
   }
 44   
 
 45  8
   protected TypeInstanceConstraint.IScope getScope() {
 46  8
     return myScope;
 47   
   }
 48   
 }
 49