Class FEELStringMarshaller

  • All Implemented Interfaces:
    org.kie.dmn.feel.marshaller.FEELMarshaller<String>

    public class FEELStringMarshaller
    extends Object
    implements org.kie.dmn.feel.marshaller.FEELMarshaller<String>
    An implementation of the FEEL marshaller interface that converts FEEL objects into it's string representation and vice versa
    • Method Detail

      • marshall

        public String marshall​(Object value)
        Marshalls the give FEEL value into a String. The result is similar to calling the string() function in a FEEL expression, with the difference that a null value is returned as the "null" string instead of the null value itself.
        Specified by:
        marshall in interface org.kie.dmn.feel.marshaller.FEELMarshaller<String>
        Parameters:
        value - the FEEL value to be marshalled
        Returns:
        the string representation of the value
      • unmarshall

        public Object unmarshall​(org.kie.dmn.feel.lang.Type feelType,
                                 String value)
        Unmarshalls the given string into a FEEL value.

        IMPORTANT: please note that it is only possible to unmarshall simple values, like strings and numbers. Complex values like lists and contexts don't have enough metadata marshalled in the string to enable them to be unmarshalled.

        Specified by:
        unmarshall in interface org.kie.dmn.feel.marshaller.FEELMarshaller<String>
        Parameters:
        feelType - the expected type of the value to be unmarshalled
        value - the marshalled value to unmarshall
        Returns:
        the value resulting from the unmarshalling of the string
        Throws:
        UnsupportedOperationException - in case the type is a complex type, i.e. RANGE, FUNCTION, CONTEXT, LIST or UNARY_TEST, the implementation raises the exception.