1 14 15 package com.sun.facelets.tag; 16 17 import com.sun.facelets.FaceletContext; 18 import com.sun.facelets.util.ParameterCheck; 19 20 27 public abstract class MetaTagHandler extends TagHandler { 28 29 private Class lastType = Object .class; 30 31 private Metadata mapper; 32 33 public MetaTagHandler(TagConfig config) { 34 super(config); 35 } 36 37 43 protected MetaRuleset createMetaRuleset(Class type) { 44 ParameterCheck.notNull("type", type); 45 return new MetaRulesetImpl(this.tag, type); 46 } 47 48 55 protected void setAttributes(FaceletContext ctx, Object instance) { 56 if (instance != null) { 57 Class type = instance.getClass(); 58 if (mapper == null || !this.lastType.equals(type)) { 59 this.lastType = type; 60 this.mapper = this.createMetaRuleset(type).finish(); 61 } 62 this.mapper.applyMetadata(ctx, instance); 63 } 64 } 65 } 66 | Popular Tags |