Class KeywordAlternativeConverter

    • Constructor Detail

      • KeywordAlternativeConverter

        public KeywordAlternativeConverter()
    • Method Detail

      • toValue

        public java.lang.String toValue​(java.lang.String string,
                                        INode node)
                                 throws ValueConverterException
        Description copied from interface: IValueConverter

        Creates a value from the given input. The input is conformant to a data type or terminal rule.

        The given string or node may be null but not both of them.

        Specified by:
        toValue in interface IValueConverter<java.lang.String>
        Parameters:
        string - the string that was inferred from the node. Usually the node's text but may be reduced to the parts of the node that are not hidden.
        node - the parsed node including hidden parts.
        Returns:
        the new value or null.
        Throws:
        ValueConverterException - indicates that the string or node did not fulfil the expected format.
      • toString

        public java.lang.String toString​(java.lang.String value)
                                  throws ValueConverterException
        Description copied from interface: IValueConverter
        Transforms the given value to a string that is conformant to the expected terminal or data type rule.
        Specified by:
        toString in interface IValueConverter<java.lang.String>
        Parameters:
        value - the to-be-transformed value
        Returns:
        a string represenation for that value.
        Throws:
        ValueConverterException - indicates that the value cannot be converted to a valid string.
      • keywordToString

        protected java.lang.String keywordToString​(Keyword keyword)
      • setRule

        public void setRule​(AbstractRule rule)
        Specified by:
        setRule in interface IValueConverter.RuleSpecific
        Throws:
        java.lang.IllegalArgumentException - if the rule is not a datatype rule or does not match the pattern
        RuleName: 'keyword' | 'other';
      • processElement

        protected void processElement​(AbstractElement element,
                                      AbstractRule rule,
                                      com.google.common.collect.ImmutableSet.Builder<java.lang.String> result)
        Since:
        2.9
      • mismatchedRuleBody

        protected java.lang.IllegalArgumentException mismatchedRuleBody​(AbstractRule rule)
        Since:
        2.9