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

nl.vpro.domain.media.LiveStream Maven / Gradle / Ivy

Go to download

The basic domain classes for 'media', the core of POMS. Also, the 'update' XML bindings for it. It also contains some closely related domain classes like the enum to contain NICAM kijkwijzer settings.

There is a newer version: 8.3.1
Show newest version
package nl.vpro.domain.media;

import lombok.Getter;

import java.io.Serial;
import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;

import nl.vpro.i18n.Displayable;
import nl.vpro.util.URLResource;

/**
 * @author Michiel Meeuwissen
 * @since 5.5
 */
@Getter
public class LiveStream implements Displayable, Serializable {

    @Serial
    private static final long serialVersionUID = -7342555628196300139L;

    static LiveStream[] values;
    static {
        URLResource.map(
            URI.create("classpath:/livestreams.properties"),
            (m) -> {
                List result = new ArrayList<>();
                m.forEach((key, value) -> {
                        String[] array = value.trim().split("\\s*,\\s*", 2);
                        result.add(new LiveStream(key, array[0], Channel.valueOf(array[1])));
                    }
                );
                values = result.toArray(new LiveStream[0]);
            }
        ).get();
    }

    private final String name;
    private final String id;
    private final Channel channel;

    LiveStream(String name, String id, Channel channel) {
        this.name = name;
        this.id = id;
        this.channel = channel;
    }

    @Override
    public String getDisplayName() {
        return channel.getDisplayName();
    }

    public static LiveStream[] values() {
        return values;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy