Coverage report

  %line %branch
org.apache.commons.jelly.tags.jsl.XPathPatternExpression
67% 
100% 

 1  
 /*
 2  
  * Copyright 2002,2004 The Apache Software Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.commons.jelly.tags.jsl;
 17  
 
 18  
 import org.apache.commons.jelly.JellyContext;
 19  
 import org.apache.commons.jelly.expression.ExpressionSupport;
 20  
 import org.dom4j.rule.Pattern;
 21  
 import org.jaxen.VariableContext;
 22  
 
 23  
 /** An expression which returns an XPath based Pattern (like an XSLT pattern).
 24  
   *
 25  
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 26  
   * @version $Revision: 155420 $
 27  
   */
 28  
 public class XPathPatternExpression extends ExpressionSupport implements VariableContext {
 29  
 
 30  
     private String text;
 31  
     private Pattern pattern;
 32  
     private JellyContext context;
 33  
 
 34  78
     public XPathPatternExpression(String text, Pattern pattern) {
 35  78
         this.text = text;
 36  78
         this.pattern = pattern;
 37  78
     }
 38  
 
 39  
     // Expression interface
 40  
     //-------------------------------------------------------------------------
 41  
     public String getExpressionText() {
 42  0
         return text;
 43  
     }
 44  
 
 45  
     public Object evaluate(JellyContext context) {
 46  72
         this.context = context;
 47  
         //pattern.setVariableContext(this);
 48  72
         return pattern;
 49  
     }
 50  
 
 51  
     // VariableContext interface
 52  
     //-------------------------------------------------------------------------
 53  
     public Object getVariableValue(
 54  
         String namespaceURI,
 55  
         String prefix,
 56  
         String localName) {
 57  
 
 58  0
         Object value = context.getVariable(localName);
 59  
 
 60  
         //log.info( "Looking up XPath variable of name: " + localName + " value is: " + value );
 61  
 
 62  0
         return value;
 63  
     }
 64  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.