org.barracudamvc.core.comp
Class TemplateDirective
java.lang.Object
org.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:
- <command> = the name of the command (custom directives are allowed)
- <model> = the name of the model
- <key> = the name of the key within the model
- <data> = any additional data (in any format) that may be associated with the directive
As an example, the following are valid directives:
- Dir::Get_Data.UserData.FirstName
- Dir::Get_Data.UserData.LastName
- Dir::Get_Data.Iterate_Start.UserData..max=50&min=25&foo=bar
- Dir::Get_Data.Iterate_End
- Dir::Custom_Directive.UserData..do=something
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
TemplateDirective
protected TemplateDirective()
TemplateDirective
public TemplateDirective(String icmd,
String imodelName,
String ikeyName,
String ikeyData)
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.