All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudfoundry.multiapps.controller.process.variables.CommaSeparatedValuesVariable Maven / Gradle / Ivy

There is a newer version: 1.183.0
Show newest version
package org.cloudfoundry.multiapps.controller.process.variables;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.flowable.common.engine.api.variable.VariableContainer;
import org.immutables.value.Value;

@Value.Immutable
public abstract class CommaSeparatedValuesVariable implements ListVariable> {

    @Override
    public Serializer> getSerializer() {
        return new Serializer>() {

            @Override
            public Object serialize(List values) {
                return String.join(",", values);
            }

            @Override
            public List deserialize(Object serializedValue) {
                return split((String) serializedValue);
            }

            private List split(String serializedValue) {
                return serializedValue.isEmpty() ? Collections.emptyList() : Arrays.asList(serializedValue.split(","));
            }

            @Override
            public List deserialize(Object serializedValue, VariableContainer container) {
                return deserialize(serializedValue);
            }

        };
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy