Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 59   Methods: 5
NCLOC: 40   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
Redefine.java 90% 94,4% 100% 93,9%
 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 java.util.Iterator;
 13   
 
 14   
 import org.jbind.xml.msg.IConstraintViolations;
 15   
 import org.jbind.xml.msg.XmlException;
 16   
 import org.jbind.xml.msg.XmlMessages;
 17   
 import org.jbind.xml.schema.instantiation.IElemValHelper;
 18   
 import org.jbind.xml.schema.instantiation.IHasTopLevelJobs;
 19   
 
 20   
 public class Redefine extends AdditionalSource implements IRedefine {
 21   
 
 22  13
   public Redefine(CreationParams aCreationParams) {
 23  13
     super(aCreationParams);
 24   
   }
 25   
 
 26  17
   public IElement doCreateChild(CreationParams aCreationParams) throws XmlException {
 27  17
     IElement res = null;
 28  17
     String componentName = NameUtil.getSchemaComponentName(aCreationParams);
 29  17
     if ("simpleType".equals(componentName)) {
 30  3
       res = new SimpleTypeDef(aCreationParams, null);
 31  14
     } else if ("complexType".equals(componentName)) {
 32  3
       res = new ComplexTypeDef(aCreationParams, null);
 33  11
     } else if ("group".equals(componentName)) {
 34  3
       res = new ModelGroupDeclaration(aCreationParams);
 35  8
     } else if ("attributeGroup".equals(componentName)) {
 36  6
       res = new AttributeGroupDeclaration(aCreationParams);
 37   
     } else {
 38  2
       res = super.doCreateChild(aCreationParams);
 39   
     }
 40  17
     return res;
 41   
   }
 42   
 
 43  13
   public void validateElement(IElemValHelper aHelper, IConstraintViolations aViolations) {
 44  13
     super.validateElement(aHelper, aViolations);
 45  13
     if (null == getSchemaLocation()) {
 46  0
       aViolations.add(XmlMessages.missingAttribute("schemaLocation", this));
 47   
     }
 48   
   }
 49   
 
 50  10
   public Iterator iterRedefinables() {
 51  10
     return iterChildrenByClass(IRedefinable.class);
 52   
   }
 53   
 
 54  10
   public void createAndAddJob(IHasTopLevelJobs aSchemaJob) {
 55  10
     aSchemaJob.addRedefineJob(this);
 56   
   }
 57   
 
 58   
 }
 59