Package org.kie.dmn.feel.marshaller
Class FEELStringMarshaller
- java.lang.Object
-
- org.kie.dmn.feel.marshaller.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
-
-
Field Summary
Fields Modifier and Type Field Description static FEELStringMarshallerINSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringmarshall(Object value)Marshalls the give FEEL value into a String.Objectunmarshall(org.kie.dmn.feel.lang.Type feelType, String value)Unmarshalls the given string into a FEEL value.
-
-
-
Field Detail
-
INSTANCE
public static final FEELStringMarshaller INSTANCE
-
-
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:
marshallin interfaceorg.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:
unmarshallin interfaceorg.kie.dmn.feel.marshaller.FEELMarshaller<String>- Parameters:
feelType- the expected type of the value to be unmarshalledvalue- 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.
-
-