Coverage Report - org.seasar.cubby.tags.DynamicAttributesTagSupport
 
Classes in this File Line Coverage Branch Coverage Complexity
DynamicAttributesTagSupport
100%
6/6
N/A
0
 
 1  
 package org.seasar.cubby.tags;
 2  
 
 3  
 import java.util.HashMap;
 4  
 import java.util.Map;
 5  
 
 6  
 import javax.servlet.http.HttpServletRequest;
 7  
 import javax.servlet.jsp.JspException;
 8  
 import javax.servlet.jsp.PageContext;
 9  
 import javax.servlet.jsp.tagext.DynamicAttributes;
 10  
 import javax.servlet.jsp.tagext.SimpleTagSupport;
 11  
 
 12  
 /**
 13  
  * DynamicAttributesをフィールドに持つタグの基底クラスです??
 14  
  * 
 15  
  * @author agata
 16  
  */
 17  31
 abstract public class DynamicAttributesTagSupport extends SimpleTagSupport
 18  
                 implements DynamicAttributes {
 19  
 
 20  
         /**
 21  
          * DynamicAttributes
 22  
          */
 23  31
         private Map<String, Object> attrs = new HashMap<String, Object>();
 24  
 
 25  
         /**
 26  
          * DynamicAttributesをセ?トします??
 27  
          * FIXME 現在はuriを無視して?る?で、?要であれば対応したほ?がよ?かも
 28  
          */
 29  
         public void setDynamicAttribute(final String uri, final String localName,
 30  
                         final Object value) throws JspException {
 31  57
                 this.attrs.put(localName, value);
 32  57
         }
 33  
 
 34  
         /**
 35  
          * DynamicAttributesを取得します??
 36  
          * 
 37  
          * @return DynamicAttributes
 38  
          */
 39  
         protected Map<String, Object> getDynamicAttribute() {
 40  107
                 return this.attrs;
 41  
         }
 42  
 
 43  
         /**
 44  
          * PageContextを取得します??
 45  
          * 
 46  
          * @return PageContext
 47  
          */
 48  
         protected PageContext getPageContext() {
 49  
                 return (PageContext) getJspContext();
 50  
         }
 51  
 
 52  
         /**
 53  
          * HttpServletRequestを取得します??
 54  
          * 
 55  
          * @return HttpServletRequest
 56  
          */
 57  
         protected HttpServletRequest getRequest() {
 58  
                 return (HttpServletRequest) getPageContext().getRequest();
 59  
         }
 60  
 
 61  
         /**
 62  
          * オブジェクトを?字?に変換します?? オブジェクトが<code>null</code>の場合?空?字を返します??
 63  
          * 
 64  
          * @param object
 65  
          *            対象のオブジェク?
 66  
          * @return オブジェクト?toString結果?
 67  
          */
 68  
         protected static String toString(Object object) {
 69  80
                 return object == null ? "" : object.toString();
 70  
         }
 71  
 
 72  
 }