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

io.lindstrom.mpd.support.ProfilesSerializer Maven / Gradle / Ivy

There is a newer version: 0.13
Show newest version
package io.lindstrom.mpd.support;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import io.lindstrom.mpd.data.Profiles;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ProfilesSerializer extends JsonSerializer {
    @Override
    public void serialize(Profiles value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        List list = new ArrayList<>();
        value.getProfiles().forEach(profile -> list.add(profile.toString()));
        list.addAll(value.getInteroperabilityPointsAndExtensions());
        gen.writeString(String.join(",", list));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy