Class FEELCodeMarshaller

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

    public class FEELCodeMarshaller
    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 given value into FEEL code that can be executed to reconstruct the value. For instance, here are some examples of the marshalling process:

        * number 10 marshalls as: 10 * string foo marshalls as: "foo" * duration P1D marshalls as: duration( "P1D" ) * context { x : 10, y : foo } marshalls as: { x : 10, y : "foo" }

        Specified by:
        marshall in interface org.kie.dmn.feel.marshaller.FEELMarshaller<String>
        Parameters:
        value - the FEEL value to be marshalled
        Returns:
        a string representing the FEEL code that needs to be executed to reconstruct the value
      • unmarshall

        public Object unmarshall​(org.kie.dmn.feel.lang.Type feelType,
                                 String value)
        Unmarshalls the string into a FEEL value by executing it.
        Specified by:
        unmarshall in interface org.kie.dmn.feel.marshaller.FEELMarshaller<String>
        Parameters:
        feelType - this parameter is ignored by this marshaller and can be set to null
        value - the FEEL code to execute for unmarshalling
        Returns:
        the value resulting from executing the code