Clover coverage report - Code Coverage for hivemind release 1.0-rc-2
Coverage timestamp: Sat Sep 11 2004 09:09:48 EDT
file stats: LOC: 70   Methods: 4
NCLOC: 32   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
PushAttributeRule.java - 100% 100% 100%
coverage
 1   
 //  Copyright 2004 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.schema.SchemaProcessor;
 19   
 import org.apache.hivemind.schema.Translator;
 20   
 
 21   
 /**
 22   
  * A rule that reads an attribute, passes it through a translator, then pushes the result
 23   
  * onto the processor stack.
 24   
  *
 25   
  * @author Howard Lewis Ship
 26   
  */
 27   
 public class PushAttributeRule extends BaseRule
 28   
 {
 29   
     private String _attributeName;
 30   
 
 31   
     /**
 32   
      * Uses the translator to convert the specified attribute into an object and pushes
 33   
      * that object onto the processor stack.
 34   
      */
 35  102
     public void begin(SchemaProcessor processor, Element element)
 36   
     {
 37  102
         Translator t = processor.getAttributeTranslator(_attributeName);
 38   
 
 39  102
         String attributeValue = element.getAttributeValue(_attributeName);
 40   
 
 41  102
         Object finalValue =
 42   
             t.translate(
 43   
                 processor.getContributingModule(),
 44   
                 Object.class,
 45   
                 attributeValue,
 46   
                 element.getLocation());
 47   
 
 48  102
         processor.push(finalValue);
 49   
     }
 50   
 
 51   
     /**
 52   
      * Invokes {@link SchemaProcessor#pop()}.
 53   
      */
 54  102
     public void end(SchemaProcessor processor, Element element)
 55   
     {
 56  102
         processor.pop();
 57   
     }
 58   
 
 59  194
     public void setAttributeName(String string)
 60   
     {
 61  194
         _attributeName = string;
 62   
     }
 63   
 
 64  1
     public String getAttributeName()
 65   
     {
 66  1
         return _attributeName;
 67   
     }
 68   
 
 69   
 }
 70