Clover coverage report - Code Coverage for hivemind release 1.1-alpha-3
Coverage timestamp: Tue Mar 22 2005 09:10:26 EST
file stats: LOC: 75   Methods: 6
NCLOC: 35   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
CreateObjectRule.java - 100% 100% 100%
coverage
 1   
 // Copyright 2004, 2005 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   
 package org.apache.hivemind.schema.rules;
 16   
 
 17   
 import org.apache.hivemind.Element;
 18   
 import org.apache.hivemind.LocationHolder;
 19   
 import org.apache.hivemind.schema.SchemaProcessor;
 20   
 import org.apache.hivemind.util.InstanceCreationUtils;
 21   
 
 22   
 /**
 23   
  * Basic {@link org.apache.hivemind.schema.Rule}for creating a new object. Created from the the
 24   
  * <code>&lt;create-object&gt;</code> element. Generally, this is the first rule in a sequence of
 25   
  * rules.
 26   
  * 
 27   
  * @author Howard Lewis Ship
 28   
  */
 29   
 public class CreateObjectRule extends BaseRule
 30   
 {
 31   
     private String _className;
 32   
 
 33  3408
     public CreateObjectRule()
 34   
     {
 35   
     }
 36   
 
 37  466
     public CreateObjectRule(String className)
 38   
     {
 39  466
         _className = className;
 40   
     }
 41   
 
 42   
     /**
 43   
      * Creates the new object and pushes it onto the processor's stack. If the object implement
 44   
      * {@link LocationHolder}then the {@link org.apache.hivemind.Location}of the element is
 45   
      * assigned to the object.
 46   
      */
 47  5018
     public void begin(SchemaProcessor processor, Element element)
 48   
     {
 49  5018
         Object object = InstanceCreationUtils.createInstance(
 50   
                 processor.getDefiningModule(),
 51   
                 _className,
 52   
                 element.getLocation());
 53   
 
 54  5018
         processor.push(object);
 55   
     }
 56   
 
 57   
     /**
 58   
      * Pops the object off of the processor's stack.
 59   
      */
 60  5017
     public void end(SchemaProcessor processor, Element element)
 61   
     {
 62  5017
         processor.pop();
 63   
     }
 64   
 
 65  82
     public String getClassName()
 66   
     {
 67  82
         return _className;
 68   
     }
 69   
 
 70  3408
     public void setClassName(String string)
 71   
     {
 72  3408
         _className = string;
 73   
     }
 74   
 
 75   
 }