1 16 package org.apache.commons.jelly.tags.define; 17 18 import org.apache.commons.jelly.JellyTagException; 19 import org.apache.commons.jelly.Script; 20 import org.apache.commons.jelly.XMLOutput; 21 import org.apache.commons.jelly.impl.DynamicTagLibrary; 22 23 32 public class ExtendTag extends DefineTagSupport { 33 34 private String name; 35 36 private Script superScript; 37 38 public ExtendTag() { 39 } 40 41 public void doTag(XMLOutput output) throws JellyTagException { 44 DynamicTagLibrary library = getTagLibrary(); 45 DynamicTagLibrary owner = library.find(getName()); 46 if (owner == null) { 47 throw new JellyTagException( 48 "Cannot extend " + getName() + ": dynamic tag not defined"); 49 } 50 if (owner == library) { 51 throw new JellyTagException("Cannot extend " + getName() + 54 ": dynamic tag defined locally"); 55 } 56 superScript = owner.getDynamicTag(name); 57 if (superScript == null) { 58 throw new JellyTagException("Cannot extend " + getName() + 60 ": tag is not a dynamic tag"); 61 } 62 63 owner.registerDynamicTag(getName() , getBody()); 64 } 65 66 69 72 public String getName() { 73 return name; 74 } 75 76 79 public void setName(String name) { 80 this.name = name; 81 } 82 83 86 public Script getSuperScript() { 87 return superScript; 88 } 89 } 90 91 | Popular Tags |