Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 52   Methods: 2
NCLOC: 32   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
RefAttribute.java 66,7% 84,6% 100% 81%
 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.INamespaces;
 13   
 import org.jbind.xml.base.IRef;
 14   
 import org.jbind.xml.base.ISymbolspace;
 15   
 import org.jbind.xml.base.QName;
 16   
 import org.jbind.xml.base.Ref;
 17   
 import org.jbind.xml.msg.XmlException;
 18   
 import org.jbind.xml.msg.XmlMessages;
 19   
 
 20   
 public class RefAttribute extends Attribute {
 21   
 
 22   
   private IRef myRef = null;
 23   
 
 24  1862
   public RefAttribute(ACParams anACParams, ISymbolspace aSymbolSpace) throws XmlException {
 25  1862
     super(anACParams);
 26  1862
     QName qName = QName.create(anACParams.value, anACParams.prefixMappings);
 27  1862
     if (null == qName) {
 28  0
       throw new XmlException(XmlMessages.invalidQName(anACParams.value, this));
 29   
     }
 30   
     // Determine the namespace of the reference.
 31   
     // References without a prefix or with a prefix that maps to the NO-Namespace
 32   
     // are chameleon references if the schema element is a chameleon.
 33   
     // In this case the references take the target namespace of the schema element.
 34  1862
     String namespace = null;
 35  1862
     String prefix = qName.getPrefix();
 36  1862
     if ("".equals(prefix) && anACParams.schemaElement.isChameleon()) {
 37  5
       namespace = anACParams.schemaElement.getTargetNamespace();
 38   
     } else {
 39  1857
       namespace = qName.getNamespace();
 40  1857
       if (INamespaces.NO.equals(namespace) && anACParams.schemaElement.isChameleon()) {
 41  0
         namespace = anACParams.schemaElement.getTargetNamespace();
 42   
       }
 43   
     }
 44  1862
     myRef = new Ref(namespace, aSymbolSpace, qName.getLocalPart());
 45   
   }
 46   
 
 47  1862
   public IRef getRef() {
 48  1862
     return myRef;
 49   
   }
 50   
 
 51   
 }
 52