kawigi.template
Class TagLibrary

java.lang.Object
  |
  +--kawigi.template.TagLibrary
All Implemented Interfaces:
java.io.Serializable

public class TagLibrary
extends java.lang.Object
implements java.io.Serializable

Class representing a generic tag library, with methods to quickly look up tags by name.

See Also:
Serialized Form

Field Summary
protected  java.util.Map map
          Maps method names to MethodInfo objects.
 
Constructor Summary
TagLibrary()
          Creates an empty tag library.
 
Method Summary
 void addMethod(kawigi.template.MethodInfo method)
          Adds the given MethodInfo object to the mapping of tags.
 void addMethod(java.lang.String name, java.lang.String[] methodCode, java.lang.String[] callCode)
          Creates a MethodInfo object with the given values and adds it to the mapping of tags.
 boolean defines(java.lang.String tagname)
          Determines if this tag library defines a method with the given name.
 kawigi.template.MethodInfo getMethod(java.lang.String tagname)
          Returns the MethodInfo with the given name.
 kawigi.template.MethodInfo[] getMethods()
          Returns the methods mapped in this tag library as an array.
 int getSize()
          Returns the number of tags in this library.
static kawigi.template.TagLibrary read(java.io.File filename)
          Reads a TagLibrary from disk.
 void remove(kawigi.template.MethodInfo method)
          Removes the given tag from the library, if it exists.
 void save(java.io.File filename)
          Saves this tag library at the given location.
 void setMethods(kawigi.template.MethodInfo[] methods)
          Erases any existing tags in the library and adds of the elements in methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected java.util.Map map
Maps method names to MethodInfo objects.

Constructor Detail

TagLibrary

public TagLibrary()
Creates an empty tag library.

Method Detail

addMethod

public void addMethod(kawigi.template.MethodInfo method)
Adds the given MethodInfo object to the mapping of tags.


remove

public void remove(kawigi.template.MethodInfo method)
Removes the given tag from the library, if it exists.


addMethod

public void addMethod(java.lang.String name,
                      java.lang.String[] methodCode,
                      java.lang.String[] callCode)
Creates a MethodInfo object with the given values and adds it to the mapping of tags.


defines

public boolean defines(java.lang.String tagname)
Determines if this tag library defines a method with the given name.


getMethod

public kawigi.template.MethodInfo getMethod(java.lang.String tagname)
Returns the MethodInfo with the given name.


getMethods

public kawigi.template.MethodInfo[] getMethods()
Returns the methods mapped in this tag library as an array.


setMethods

public void setMethods(kawigi.template.MethodInfo[] methods)
Erases any existing tags in the library and adds of the elements in methods.


getSize

public int getSize()
Returns the number of tags in this library.


save

public void save(java.io.File filename)
Saves this tag library at the given location. filename should preferrably have a .tlb (for Tag LiBrary) extention.


read

public static kawigi.template.TagLibrary read(java.io.File filename)
Reads a TagLibrary from disk.