<commit_before>/*
 * MIT Licence
 * Copyright (c) 2017 <NAME>
 *
 * Please see LICENCE.md for complete licence text.
 */
package eu.fraho.spring.securityJwt.dto;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.jcip.annotations.Immutable;

import java.util.concurrent.TimeUnit;

/**
 * This class specifies a quanitity of periods.
 * Used for the cryptProperties to provide some human readable values for the expiration settings.<br>
 * Just specify them like this: {@code fraho.jwt.example: 1 hour} or {@code fraho.jwt.example: 45 minutes}<br>
 * <br>
 * Example values:
 * <ul>
 * <li>1 hour</li>
 * <li>42 seconds</li>
 * <li>1 day</li>
 * <li>7 days</li>
 * </ul>
 *
 * @see #TimeWithPeriod(String)
 * @see #TimeWithPeriod(int, TimeUnit)
 */
@Getter
@Slf4j
@Immutable
public final class TimeWithPeriod {
    /**
     * Quantity of the {@link #timeUnit}
     */
    private final int quantity;

    /**
     * The timeUnit to use
     */
    private final TimeUnit timeUnit;

    /**
     * Parse the given cryptProperties value and extract the {@link #quantity} and {@link #timeUnit}.<br>
     *
     * @param value A string representation like &quot;&lt;quantity&gt; &lt;timeUnit&gt;&quot;
     */
    public TimeWithPeriod(final String value) {
        final String[] parts = value.split("\\s", 2);

        quantity = Integer.valueOf(parts[0]);
        timeUnit = PeriodWord.valueOf(parts[1]).getTimeUnit();
    }

    /**
     * Create a new instance using the given values.
     *
     * @param quantity Quantitiy of the timeUnit
     * @param timeUnit The timeUnit to use
     */<commit_msg>Fix javadoc comment<commit_after>/*
 * MIT Licence
 * Copyright (c) 2017 <NAME>
 *
 * Please see LICENCE.md for complete licence text.
 */
package eu.fraho.spring.securityJwt.dto;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.jcip.annotations.Immutable;

import java.util.concurrent.TimeUnit;

/**
 * This class specifies a quanitity of periods.
 * Used for the configuration to provide some human readable values for the expiration settings.<br>
 * Just specify them like this: {@code fraho.jwt.example: 1 hour} or {@code fraho.jwt.example: 45 minutes}<br>
 * <br>
 * Example values:
 * <ul>
 * <li>1 hour</li>
 * <li>42 seconds</li>
 * <li>1 day</li>
 * <li>7 days</li>
 * </ul>
 *
 * @see #TimeWithPeriod(String)
 * @see #TimeWithPeriod(int, TimeUnit)
 */
@Getter
@Slf4j
@Immutable
public final class TimeWithPeriod {
    /**
     * Quantity of the {@link #timeUnit}
     */
    private final int quantity;

    /**
     * The timeUnit to use
     */
    private final TimeUnit timeUnit;

    /**
     * Parse the given configuration value and extract the {@link #quantity} and {@link #timeUnit}.<br>
     *
     * @param value A string representation like &quot;&lt;quantity&gt; &lt;timeUnit&gt;&quot;
     */
    public TimeWithPeriod(final String value) {
        final String[] parts = value.split("\\s", 2);

        quantity = Integer.valueOf(parts[0]);
        timeUnit = PeriodWord.valueOf(parts[1]).getTimeUnit();
    }

    /**
     * Create a new instance using the given values.
     *
     * @param quantity Quantitiy of the timeUnit
     * @param timeUnit The timeUnit to use
     */
{'fraction_non_alphanumeric': 0.1295496607032696, 'fraction_numerical': 0.011104256631708822, 'mean_word_length': 3.1102661596958177, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5034785', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1031, 'n_words': 312}