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

org.rythmengine.extension.IDurationParser Maven / Gradle / Ivy

Go to download

A strong typed high performance Java Template engine with .Net Razor like syntax

There is a newer version: 1.4.2
Show newest version
/**
 * Copyright (C) 2013-2016 The Rythm Engine project
 * for LICENSE and other details see:
 * https://github.com/rythmengine/rythmengine
 */
package org.rythmengine.extension;

import org.rythmengine.utils.Time;

/**
 * A user application could implement this interface to provide
 * customized time string parsing utility to {@link ICacheService rythm cache service}.
 * and then configure the Rythm to use customized implementation via
 * {@link org.rythmengine.conf.RythmConfigurationKey#CACHE_DURATION_PARSER_IMPL "cache.duration_parser.impl"}
 * configuration.
 * 

Usually user application does not need to provide it's own implementation, instead, the rythm built in time * parser could be used as default implementation

*/ public interface IDurationParser { /** * Parse a string representation and return number of seconds * * @param s * @return duration in seconds */ int parseDuration(String s); /** * Rythm's default implementation of {@link IDurationParser}. It allows the following type of duration string * representations: *
    *
  • 1d: 1 day
  • *
  • 3h: 3 hours
  • *
  • 8mn or 8min: 8 minutes
  • *
  • 23s: 23 seconds
  • *
*/ public static final IDurationParser DEFAULT_PARSER = new IDurationParser() { @Override public int parseDuration(String s) { return Time.parseDuration(s); } }; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy