org.barracudamvc.core.comp
Class TemplateDirective

java.lang.Object
  extended byorg.barracudamvc.core.comp.TemplateDirective

public class TemplateDirective
extends Object

This class defines a TemplateDirective. A TemplateDirective is created from a string (usually in the HTML class attribute) and takes the form Dir::<command>.<model>.<key>.<props>... where:

As an example, the following are valid directives:


Field Summary
static String BLOCK_ITERATE
           
static String BLOCK_ITERATE_END
           
static String BLOCK_ITERATE_START
           
protected  String cmd
           
static String DIR_PREFIX
           
static String DISCARD
           
static String GET_DATA
           
static String HAS_BLOCK_ITERATOR
           
static String ITERATE_END
           
static String ITERATE_NEXT
           
static String ITERATE_START
           
protected  String keyData
           
protected  String keyName
           
protected  String modelName
           
static String SET_ATTR
           
 
Constructor Summary
protected TemplateDirective()
           
  TemplateDirective(String icmd, String imodelName, String ikeyName, String ikeyData)
           
 
Method Summary
 boolean equals(Object o)
           
static List getAllInstances(String sourceStr)
          Given a space delimited string of directive commands, convert each segment into a TemplateDirective and return all the valid directives in a List.
 String getCommand()
           
static TemplateDirective getInstance(String sourceStr)
          Given a string of the form Dir::<command>.
 String getKeyData()
           
 String getKeyName()
           
 String getModelName()
           
static void main(String[] args)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIR_PREFIX

public static final String DIR_PREFIX
See Also:
Constant Field Values

ITERATE_START

public static final String ITERATE_START
See Also:
Constant Field Values

ITERATE_NEXT

public static final String ITERATE_NEXT
See Also:
Constant Field Values

ITERATE_END

public static final String ITERATE_END
See Also:
Constant Field Values

GET_DATA

public static final String GET_DATA
See Also:
Constant Field Values

SET_ATTR

public static final String SET_ATTR
See Also:
Constant Field Values

DISCARD

public static final String DISCARD
See Also:
Constant Field Values

BLOCK_ITERATE

public static final String BLOCK_ITERATE
See Also:
Constant Field Values

BLOCK_ITERATE_START

public static final String BLOCK_ITERATE_START
See Also:
Constant Field Values

BLOCK_ITERATE_END

public static final String BLOCK_ITERATE_END
See Also:
Constant Field Values

HAS_BLOCK_ITERATOR

public static final String HAS_BLOCK_ITERATOR

cmd

protected String cmd

modelName

protected String modelName

keyName

protected String keyName

keyData

protected String keyData
Constructor Detail

TemplateDirective

protected TemplateDirective()

TemplateDirective

public TemplateDirective(String icmd,
                         String imodelName,
                         String ikeyName,
                         String ikeyData)
Method Detail

getCommand

public String getCommand()

getModelName

public String getModelName()

getKeyName

public String getKeyName()

getKeyData

public String getKeyData()

toString

public String toString()

equals

public boolean equals(Object o)

getAllInstances

public static List getAllInstances(String sourceStr)
Given a space delimited string of directive commands, convert each segment into a TemplateDirective and return all the valid directives in a List. Invalid directives and block iterator specific directives are silently ignored.

Parameters:
sourceStr - a space delimited string of directive commands
Returns:
a List of TemplateDirectives

getInstance

public static TemplateDirective getInstance(String sourceStr)
                                     throws InvalidDirectiveException
Given a string of the form Dir::<command>.<model>.<key>.<props>... convert it into a TemplateDirective and return that object.

Parameters:
sourceStr - a space delimited string of directive commands
Returns:
the corresponding TemplateDirectives
Throws:
InvalidDirectiveException - if the String cannot be converted

main

public static void main(String[] args)


Copyright © 2004 BarracudaMVC.org All Rights Reserved.