Class CelMacro

  • All Implemented Interfaces:
    java.lang.Comparable<CelMacro>

    @Immutable
    public abstract class CelMacro
    extends java.lang.Object
    implements java.lang.Comparable<CelMacro>
    Describes a function signature to match and the CelMacroExpander to apply.
    • Method Detail

      • getFunction

        public abstract java.lang.String getFunction()
        Returns the function name for this macro.
      • getArgumentCount

        public abstract int getArgumentCount()
        Returns the number of arguments this macro expects. For variadic macros, this is 0.
      • isReceiverStyle

        public final boolean isReceiverStyle()
        True if this macro is receiver-style, false if it is global.
      • getKey

        public abstract java.lang.String getKey()
        Returns the unique string used to identify this macro.
      • isVariadic

        public final boolean isVariadic()
        Returns true if this macro accepts any number of arguments, false otherwise.
      • getExpander

        public abstract CelMacroExpander getExpander()
        Returns the expander for this macro.
      • compareTo

        public final int compareTo​(CelMacro other)
        Specified by:
        compareTo in interface java.lang.Comparable<CelMacro>
      • toString

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

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • newGlobalMacro

        public static CelMacro newGlobalMacro​(java.lang.String function,
                                              int argCount,
                                              CelMacroExpander expander)
        Creates a new global macro that accepts a fixed number of arguments.
      • newGlobalVarArgMacro

        public static CelMacro newGlobalVarArgMacro​(java.lang.String function,
                                                    CelMacroExpander expander)
        Creates a new global macro that accepts a variable number of arguments.
      • newReceiverMacro

        public static CelMacro newReceiverMacro​(java.lang.String function,
                                                int argCount,
                                                CelMacroExpander expander)
        Creates a new receiver-style macro that accepts a fixed number of arguments.
      • newReceiverVarArgMacro

        public static CelMacro newReceiverVarArgMacro​(java.lang.String function,
                                                      CelMacroExpander expander)
        Creates a new receiver-style macro that accepts a variable number of arguments.