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

io.gdcc.xoai.model.oaipmh.Granularity Maven / Gradle / Ivy

There is a newer version: 5.2.2
Show newest version
/*
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 * http://www.dspace.org/license/
 */

package io.gdcc.xoai.model.oaipmh;

/**
 * @author Development @ Lyncode
 * @version 3.1.0
 */
public enum Granularity {
    Day("YYYY-MM-DD"),
    Second("YYYY-MM-DDThh:mm:ssZ"),
    // Lenient defaults to Second granularity, but can be used to accept Day granularity, too
    Lenient(Second.representation);

    public static Granularity fromRepresentation(String representation) {
        for (Granularity granularity : Granularity.values())
            if (granularity.toString().equals(representation)) return granularity;

        throw new IllegalArgumentException(representation);
    }

    private final String representation;

    Granularity(String representation) {
        this.representation = representation;
    }

    @Override
    public String toString() {
        return representation;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy