Coverage Report - org.webslinger.rules.CSSLookupValue
 
Classes in this File Line Coverage Branch Coverage Complexity
CSSLookupValue
75%
12/16
100%
2/2
1.444
 
 1  
 package org.webslinger.rules;
 2  
 
 3  
 import java.io.IOException;
 4  
 import javax.servlet.ServletRequest;
 5  
 
 6  
 import org.webslinger.Webslinger;
 7  
 import org.webslinger.PathContext;
 8  
 
 9  
 public class CSSLookupValue extends AbstractSingleValue {
 10  
     private String attribute;
 11  
     private String def;
 12  
 
 13  
     public CSSLookupValue(int id) {
 14  0
         super(id);
 15  0
     }
 16  
 
 17  
     public CSSLookupValue(Rules p, int id) {
 18  87
         super(p, id);
 19  87
     }
 20  
 
 21  
     /** Accept the visitor. **/
 22  
     public Object jjtAccept(RulesVisitor visitor, Object data) {
 23  0
         return visitor.visit(this, data);
 24  
     }
 25  
 
 26  
     void setAttribute(String attribute) {
 27  87
         this.attribute = attribute;
 28  87
     }
 29  
 
 30  
     public String getAttribute() {
 31  23
         return attribute;
 32  
     }
 33  
 
 34  
     void setDefault(String def) {
 35  21
         this.def = def;
 36  21
     }
 37  
 
 38  
     public String getDefault() {
 39  23
         return def;
 40  
     }
 41  
 
 42  
     public String getValue(ServletRequest request, Webslinger top) throws IOException {
 43  686
         String value = (String) top.getAttribute(attribute);
 44  686
         if (value != null) return value;
 45  640
         if (def == null) return null;
 46  83
         return def;
 47  
     }
 48  
 
 49  
     public String toString() {
 50  0
         return "LookupValue(" + getAttribute() + ":" + getDefault() + ")";
 51  
     }
 52  
 }