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

com.kenshoo.pl.entity.converters.StringSetValueConverter Maven / Gradle / Ivy

Go to download

A Java persistence layer based on JOOQ for high performance and business flow support.

There is a newer version: 0.1.121-jooq-3.16.3
Show newest version
package com.kenshoo.pl.entity.converters;

import com.google.common.collect.ImmutableSet;
import com.kenshoo.pl.entity.ValueConverter;

import java.util.Set;

public class StringSetValueConverter implements ValueConverter, String> {

    public final static StringSetValueConverter INSTANCE = new StringSetValueConverter();

    @Override
    public String convertTo(Set value) {
        return value == null ? null : String.join(",", value);
    }

    @Override
    public Set convertFrom(String value) {
        return value == null ? null : ImmutableSet.copyOf(value.split(","));
    }

    @Override
    public Class> getValueClass() {
        //noinspection unchecked
        return (Class) Set.class;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy