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

es.urjc.etsii.grafo.config.BlockConfig Maven / Gradle / Ivy

package es.urjc.etsii.grafo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * Block Java API methods configuration
 */
@Configuration
@ConfigurationProperties(prefix = "advanced.block")
public class BlockConfig {

    /**
     * Should we block the method Collections.shuffle(List)?
     */
    private boolean blockCollectionsShuffle = true;

    /**
     * Should we block the method Math.random()?
     */
    private boolean blockMathRandom = true;

    /**
     * Return true if method Collections.shuffle(LIST) should be blocked.
     * Use CollectionUtil.shuffle() instead.
     *
     * @return true if method should be blocked, false otherwise
     */
    public boolean isBlockCollectionsShuffle() {
        return blockCollectionsShuffle;
    }

    /**
     * NOOP after method has been blocked. Only used as a setter when deserializing the configuration file.
     *
     * @param blockCollectionsShuffle true if method should be blocked, false otherwise
     */
    public void setBlockCollectionsShuffle(boolean blockCollectionsShuffle) {
        this.blockCollectionsShuffle = blockCollectionsShuffle;
    }


    /**
     * Return true if method Math.random() should be blocked.
     * Use RandomManager instead.
     *
     * @return true if method should be blocked, false otherwise
     */
    public boolean isBlockMathRandom() {
        return blockMathRandom;
    }

    /**
     * NOOP after method has been blocked. Only used as a setter when deserializing the configuration file.
     *
     * @param blockMathRandom true if method should be blocked, false otherwise
     */
    public void setBlockMathRandom(boolean blockMathRandom) {
        this.blockMathRandom = blockMathRandom;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy