|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.github.miemiedev.mybatis.paginator.support.PropertiesHelper
public class PropertiesHelper
Properties的操作的工具类,为Properties提供一个代理增加相关工具方法如 getRequiredString(),getInt(),getBoolean()等方法 并可以通过systemPropertiesMode属性指定是否搜索System.getProperty()及System.getenv()来查找值. 默认不搜索系统属性
使用1:
public class ConnectionUtils {
static Properties properties = new Properties();
// ... do load properties
// delegate to properties
static PropertiesHelper props = new PropertiesHelper(properties);
public static Connection getConnection() {
// use getRequiredProperty()
DriverManager.getConnection(props.getRequiredString("jdbc.url"));
}
}
指定是否搜索系统属性:
new PropertiesHelper(properties,PropertiesHelper.SYSTEM_PROPERTIES_MODE_OVERRIDE)
| 字段摘要 | |
|---|---|
static int |
SYSTEM_PROPERTIES_MODE_FALLBACK
Check system properties if not resolvable in the specified properties. |
static int |
SYSTEM_PROPERTIES_MODE_NEVER
Never check system properties. |
static int |
SYSTEM_PROPERTIES_MODE_OVERRIDE
Check system properties first, before trying the specified properties. |
| 构造方法摘要 | |
|---|---|
PropertiesHelper(Properties p)
|
|
PropertiesHelper(Properties p,
int systemPropertiesMode)
|
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
public static final int SYSTEM_PROPERTIES_MODE_NEVER
public static final int SYSTEM_PROPERTIES_MODE_FALLBACK
public static final int SYSTEM_PROPERTIES_MODE_OVERRIDE
| 构造方法详细信息 |
|---|
public PropertiesHelper(Properties p)
public PropertiesHelper(Properties p,
int systemPropertiesMode)
| 方法详细信息 |
|---|
public Properties getProperties()
public void setProperties(Properties props)
public String getRequiredString(String key)
public String getNullIfBlank(String key)
public String getNullIfEmpty(String key)
public String getAndTryFromSystem(String key)
public Integer getInteger(String key)
public int getInt(String key,
int defaultValue)
public int getRequiredInt(String key)
public Long getLong(String key)
public long getLong(String key,
long defaultValue)
public Long getRequiredLong(String key)
public Boolean getBoolean(String key)
public boolean getBoolean(String key,
boolean defaultValue)
public boolean getRequiredBoolean(String key)
public Float getFloat(String key)
public float getFloat(String key,
float defaultValue)
public Float getRequiredFloat(String key)
public Double getDouble(String key)
public double getDouble(String key,
double defaultValue)
public Double getRequiredDouble(String key)
public Object setProperty(String key,
int value)
public Object setProperty(String key,
long value)
public Object setProperty(String key,
float value)
public Object setProperty(String key,
double value)
public Object setProperty(String key,
boolean value)
public String[] getStringArray(String key)
public int[] getIntArray(String key)
public Properties getStartsWithProperties(String prefix)
public String getProperty(String key,
String defaultValue)
public String getProperty(String key)
public Object setProperty(String key,
String value)
public void clear()
public Set<Map.Entry<Object,Object>> entrySet()
public Enumeration<?> propertyNames()
public boolean contains(Object value)
public boolean containsKey(Object key)
public boolean containsValue(Object value)
public Enumeration<Object> elements()
public Object get(Object key)
public boolean isEmpty()
public Enumeration<Object> keys()
public Set<Object> keySet()
public void list(PrintStream out)
public void list(PrintWriter out)
public void load(InputStream inStream)
throws IOException
IOException
public void loadFromXML(InputStream in)
throws IOException,
InvalidPropertiesFormatException
IOException
InvalidPropertiesFormatException
public Object put(Object key,
Object value)
public void putAll(Map<? extends Object,? extends Object> t)
public Object remove(Object key)
public void save(OutputStream out,
String comments)
public int size()
public void store(OutputStream out,
String comments)
throws IOException
IOException
public void storeToXML(OutputStream os,
String comment,
String encoding)
throws IOException
IOException
public void storeToXML(OutputStream os,
String comment)
throws IOException
IOExceptionpublic Collection<Object> values()
public String toString()
Object 中的 toString
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||