org.jproggy.snippetory
Enum Syntaxes

java.lang.Object
  extended by java.lang.Enum<Syntaxes>
      extended by org.jproggy.snippetory.Syntaxes
All Implemented Interfaces:
Serializable, Comparable<Syntaxes>, SyntaxID

public enum Syntaxes
extends Enum<Syntaxes>
implements SyntaxID

Provides direct access to the predefined syntaxes. For more information see syntaxes in official documentation .


Enum Constant Summary
C_COMMENTS
           
HIDDEN_BLOCKS
          This syntax allows template markup, that is invisible to the parser of many output formats.
XML_ALIKE
          This is the default syntax.
 
Method Summary
 TemplateContext context()
          a template context pre-configured for selected syntax
 String getName()
           
 Template parse(CharSequence data)
          parse with selected syntax
static Syntaxes valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Syntaxes[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

XML_ALIKE

public static final Syntaxes XML_ALIKE
This is the default syntax. It is used if no syntax is defined. It looks like this:

<t:name default='def'>{v:other_name}</t:name>

It integrates fine in xml-based formats and is very visible in many others. It provides low risk of incompatibility to a certain output format.


C_COMMENTS

public static final Syntaxes C_COMMENTS

HIDDEN_BLOCKS

public static final Syntaxes HIDDEN_BLOCKS
This syntax allows template markup, that is invisible to the parser of many output formats. There are variants based on <!-- --> and on /* */ that can be mixed freely as needed:

/*t:name1-->{v:name2}<!--t:name3 default='def'-->/*!t:name3*/ <--!t:name1*/

Method Detail

values

public static Syntaxes[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Syntaxes c : Syntaxes.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Syntaxes valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getName

public String getName()
Specified by:
getName in interface SyntaxID
Returns:
a name identifying the syntax uniquely.

context

public TemplateContext context()
a template context pre-configured for selected syntax


parse

public Template parse(CharSequence data)
parse with selected syntax

Parameters:
data - input data to parse
Returns:
the template for the parsed data