Coverage Report - uk.co.badgersinfoil.asxsd.components.AttributeGroupReferenceComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
AttributeGroupReferenceComponent
100% 
100% 
1
 
 1  
 package uk.co.badgersinfoil.asxsd.components;
 2  
 
 3  
 import org.eclipse.xsd.XSDAttributeGroupDefinition;
 4  
 import org.eclipse.xsd.XSDConcreteComponent;
 5  
 import uk.co.badgersinfoil.asxsd.CodegenContext;
 6  
 import uk.co.badgersinfoil.asxsd.CodegenRole;
 7  
 
 8  
 // TODO: a reference to an attribute group would ideally cause the given type to implement a shared interface, and delegate to shared marshal/unmarshal functions
 9  
 
 10  15
 public class AttributeGroupReferenceComponent extends AbstractMappingComponent {
 11  
 
 12  
         public void generateCode(CodegenContext context,
 13  
                                  XSDConcreteComponent component)
 14  
         {
 15  3
                 CodegenRole role = context.getCurrentRole();
 16  3
                 context.generateCode(resolve(component));
 17  3
         }
 18  
         
 19  
         private static XSDAttributeGroupDefinition resolve(XSDConcreteComponent component) {
 20  3
                 return ((XSDAttributeGroupDefinition)component).getResolvedAttributeGroupDefinition();
 21  
         }
 22  
 
 23  
         public boolean willAccept(XSDConcreteComponent component) {
 24  61
                 return component instanceof XSDAttributeGroupDefinition
 25  
                     && ((XSDAttributeGroupDefinition)component).isAttributeGroupDefinitionReference();
 26  
         }
 27  
 }