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

nl.vpro.domain.media.search.SortField 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.search;

import java.util.Optional;

/**
 * @author Michiel Meeuwissen
 * @since 5.0
 */
public interface SortField {

    String NULL_INSTANT = "1970-01-01T00:00:00Z";
    String MIN_INSTANT = "1900-01-01T00:00:00Z";
    String MAX_INSTANT = "2500-01-01T00:00:00Z";


    String name();

    Type type();

    default Optional nulls() {
        return switch(type()) {
            case INSTANT -> Optional.of(NULL_INSTANT);
            case COUNT -> Optional.of("0");
            case STRING -> Optional.empty();
        };
    }

    /**
     * The associated property or null if there is none (this field will require manual mapping)
     *
     */
    default String property() {
        return null;
    }

    default String sortField() {
        return name();
    }

    enum Type {
        STRING,
        COUNT,
        INSTANT
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy