Class FormalArgument


  • public class FormalArgument
    extends java.lang.Object
    Represents the name of a formal argument defined in a template: group test; test(a,b) : "$a$ $b$" t() : "blort" Each template has a set of these formal arguments or uses a placeholder object: UNKNOWN (indicating that no arguments were specified such as when a template is loaded from a file.st). Note: originally, I tracked cardinality as well as the name of an attribute. I'm leaving the code here as I suspect something may come of it later. Currently, though, cardinality is not used.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      StringTemplate defaultValueST
      If they specified name="value", store the template here
      java.lang.String name  
      static int ONE_OR_MORE  
      static int OPTIONAL  
      static int REQUIRED  
      static java.lang.String[] suffixes  
      static java.util.LinkedHashMap UNKNOWN
      When template arguments are not available such as when the user uses "new StringTemplate(...)", then the list of formal arguments must be distinguished from the case where a template can specify args and there just aren't any such as the t() template above.
      static int ZERO_OR_MORE  
    • Field Detail

      • suffixes

        public static final java.lang.String[] suffixes
      • UNKNOWN

        public static final java.util.LinkedHashMap UNKNOWN
        When template arguments are not available such as when the user uses "new StringTemplate(...)", then the list of formal arguments must be distinguished from the case where a template can specify args and there just aren't any such as the t() template above.
      • name

        public java.lang.String name
      • defaultValueST

        public StringTemplate defaultValueST
        If they specified name="value", store the template here
    • Constructor Detail

      • FormalArgument

        public FormalArgument​(java.lang.String name)
      • FormalArgument

        public FormalArgument​(java.lang.String name,
                              StringTemplate defaultValueST)
    • Method Detail

      • getCardinalityName

        public static java.lang.String getCardinalityName​(int cardinality)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object