ConfigPropertyRepositoryUtils.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tradecloud.repository;

import com.tradecloud.domain.configuration.TreasuryConfig;
import com.tradecloud.domain.model.deal.AutoLinkReversalDealOptions;

/**
 *
 *
 */
public class ConfigPropertyRepositoryUtils {

    public static boolean getBoolean(ConfigPropertyRepository configPropertyRepository, String property) {
        return Boolean.valueOf(configPropertyRepository.getProperty(property));
    }

    public static <T extends Enum<T>> T getEnum(ConfigPropertyRepository configPropertyRepository, String property, Class<T> c) {
        return Enum.valueOf(c, configPropertyRepository.getProperty(property));
    }

    public static AutoLinkReversalDealOptions getAutoLinkReversalDealOptions(ConfigPropertyRepository configPropertyRepository) {
        return ConfigPropertyRepositoryUtils.getEnum(configPropertyRepository, TreasuryConfig.AUTO_LINK_REVERSAL_DEALS,
                AutoLinkReversalDealOptions.class);
    }
}