devutility.internal.util.PropertiesUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devutility.internal Show documentation
Show all versions of devutility.internal Show documentation
Utilities for Java development
package devutility.internal.util;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import devutility.internal.data.BeanUtils;
import devutility.internal.lang.ClassHelper;
import devutility.internal.lang.StringHelper;
import devutility.internal.lang.models.EntityField;
public class PropertiesUtils {
/**
* Get properties
* @param resourceName: Properties file name
* @return Properties
*/
public static Properties getProperties(String resourceName) {
return getProperties(PropertiesUtils.class.getClassLoader().getResourceAsStream(resourceName));
}
/**
* Get properties
* @param inputStream: InputStream of properties file
* @return Properties
*/
public static Properties getProperties(InputStream inputStream) {
try (InputStream inStream = inputStream) {
Properties properties = new Properties();
properties.load(inStream);
return properties;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* Check one properties object whether contains prefix.
* @param properties: Properties object
* @param prefix: Prefix of property key
* @return boolean
*/
public static boolean containsPrefix(Properties properties, String prefix) {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy