propertiestonicpropertymanager.java

来自「模块化您的应用系统」· Java 代码 · 共 42 行

JAVA
42
字号
package com.opensymphony.tonic.impl;

import com.opensymphony.tonic.TonicPropertyManager;
import com.opensymphony.tonic.util.ClassLoaderUtils;

import java.util.Properties;
import java.io.IOException;

public class PropertiesTonicPropertyManager implements TonicPropertyManager
{
    public final static String DEFAULT_FILE = "tonic.properties";

    Properties props = null;

    public PropertiesTonicPropertyManager() throws IOException
    {
        this(DEFAULT_FILE);
    }

    public PropertiesTonicPropertyManager(String propFile) throws IOException
    {
        Properties props = new Properties();
        props.load(ClassLoaderUtils.getResourceAsStream(propFile, getClass()));
        init(props);
    }

    public PropertiesTonicPropertyManager(Properties props)
    {
        init(props);
    }

    private void init(Properties props)
    {
        this.props = props;
    }

    public String getProperty(String key)
    {
        return props.getProperty(key);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?