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

io.lindstrom.m3u8.parser.AttributeListBuilder Maven / Gradle / Ivy

There is a newer version: 0.28
Show newest version
package io.lindstrom.m3u8.parser;

import java.util.ArrayList;
import java.util.List;

import static io.lindstrom.m3u8.parser.Tags.NO;
import static io.lindstrom.m3u8.parser.Tags.YES;

class AttributeListBuilder {
    private final List attributes = new ArrayList<>();

    public void add(String key, Enum value) {
        attributes.add(String.format("%s=%s", key, value));
    }

    public void add(String key, String value) {
        attributes.add(String.format("%s=%s", key, value));
    }

    public void add(String key, boolean value) {
        attributes.add(String.format("%s=%s", key, value ? YES : NO));
    }

    public void addQuoted(String key, Object value) {
        attributes.add(String.format("%s=\"%s\"", key, value));
    }

    @Override
    public String toString() {
        return String.join(",", attributes);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy