public final class PropertiesUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String[] |
PROPERTIES_DELIMITERS
The Constant PROPERTIES_DELIMITERS contains all valid delimiters for properties files.
|
static String |
SEARCH_FILE_PATTERN
The Constant SEARCH_FILE_PATTERN is a regex for searching java and html files.
|
| Modifier and Type | Method and Description |
|---|---|
static Map<String,List<String>> |
findRedundantValues(Properties properties)
Finds redundant values from the given Properties object and saves it to a Map.
|
static Set<String> |
getAvailableLanguages(String bundlepackage,
String bundlename)
Deprecated.
|
static String |
getBundlename(File propertiesFile)
Deprecated.
use instead
LocaleResolver.resolveBundlename(File) |
static Locale |
getLocale(File propertiesFile)
Deprecated.
use instead
LocaleResolver.resolveLocale(File) |
static Map<File,Locale> |
getLocales(String bundlepackage,
String bundlename)
Deprecated.
use instead
LocaleResolver.resolveLocales(String, String) |
static Properties |
getLocalPropertiesFromClass(Class<?> componentClass,
Class<?> defaultClass,
Locale locale)
Gets the properties.
|
static Map<String,List<String>> |
getMatchedPrefixLists(Properties enProperties)
Finds all keys with the same key prefixes from the given Properties and saves them to a Map
with the prefix as a key and holds a List with the whole keys the starts with the same key
prefix.
|
static List<String> |
getPropertyParameters(String propertyValue)
Finds the property parameters from the given propertyValue.
|
static Properties |
loadProperties(Class<?> clazz,
String name)
Load properties.
|
static Properties |
loadProperties(Class<?> clazz,
String packagePath,
String fileName)
Load properties.
|
static Properties |
loadProperties(File propertiesFile)
Load a Properties-object from the given File-object.
|
static Properties |
loadProperties(String packagePath)
Gives a Properties-object from the given packagepath.
|
static Properties |
loadProperties(String packagePath,
String fileName)
Load properties.
|
static Properties |
loadPropertiesFromClassObject(Class<?> clazz,
Locale locale)
Load the properties file from the given class object.
|
static Set<String> |
resolveAvailableLanguages(String bundlepackage,
String bundlename)
Resolves all the available languages for the given resource bundle name in the given bundle
package.
|
static void |
toProperties(File properties,
File xml,
String comment)
Converts the given xml file to the given properties file.
|
static void |
toProperties(OutputStream properties,
InputStream xml,
String comment)
Converts the given xml InputStream to the given properties OutputStream.
|
static void |
toXml(File properties,
File xml,
String comment,
String encoding)
Converts the given properties file to the given xml file.
|
static void |
toXml(InputStream properties,
OutputStream xml,
String comment,
String encoding)
Converts the given properties InputStream to the given xml OutputStream.
|
public static final String SEARCH_FILE_PATTERN
public static final String[] PROPERTIES_DELIMITERS
public static Map<String,List<String>> findRedundantValues(Properties properties)
properties - The Properties to check.public static Set<String> getAvailableLanguages(String bundlepackage, String bundlename)
LocaleResolver.resolveAvailableLanguages(String, String)bundlepackage - The package that contains the properties files.bundlename - The name of the resource bundle.public static String getBundlename(File propertiesFile)
LocaleResolver.resolveBundlename(File)propertiesFile - the properties filepublic static Locale getLocale(File propertiesFile)
LocaleResolver.resolveLocale(File)propertiesFile - the properties filepublic static Map<File,Locale> getLocales(String bundlepackage, String bundlename)
LocaleResolver.resolveLocales(String, String)bundlepackage - The package that contains the properties files.bundlename - The name of the resource bundle.public static Properties getLocalPropertiesFromClass(Class<?> componentClass, Class<?> defaultClass, Locale locale) throws Exception
componentClass - the component classdefaultClass - the default classlocale - the localeException - the exceptionpublic static Map<String,List<String>> getMatchedPrefixLists(Properties enProperties)
enProperties - the en propertiespublic static List<String> getPropertyParameters(String propertyValue)
propertyValue - the property valuepublic static Properties loadProperties(Class<?> clazz, String name) throws IOException
clazz - the clazzname - the package path with the file nameIOException - Signals that an I/O exception has occurred.public static Properties loadProperties(Class<?> clazz, String packagePath, String fileName) throws IOException
clazz - the clazzpackagePath - the package path without the file namefileName - the file nameIOException - Signals that an I/O exception has occurred.public static Properties loadProperties(File propertiesFile) throws IOException
propertiesFile - the properties fileIOException - Signals that an I/O exception has occurred.public static Properties loadProperties(String packagePath) throws IOException
packagePath - The package-path and the name from the resource as a String.IOException - Signals that an I/O exception has occurred.public static Properties loadProperties(String packagePath, String fileName) throws IOException
packagePath - the package path without the file namefileName - the file nameIOException - Signals that an I/O exception has occurred.public static Properties loadPropertiesFromClassObject(Class<?> clazz, Locale locale) throws IOException
clazz - the clazzlocale - the localeIOException - Signals that an I/O exception has occurred.public static Set<String> resolveAvailableLanguages(String bundlepackage, String bundlename)
bundlepackage - The package that contains the properties files.bundlename - The name of the resource bundle.public static void toProperties(File properties, File xml, String comment) throws FileNotFoundException, IOException
properties - the properties file. The xml file does not have to exist.xml - the xml file with the properties to convert.comment - the commentFileNotFoundException - the file not found exceptionIOException - Signals that an I/O exception has occurred.public static void toProperties(OutputStream properties, InputStream xml, String comment) throws FileNotFoundException, IOException
properties - the properties file. The xml file does not have to exist.xml - the xml file with the properties to convert.comment - the commentFileNotFoundException - the file not found exceptionIOException - Signals that an I/O exception has occurred.public static void toXml(File properties, File xml, String comment, String encoding) throws FileNotFoundException, IOException
properties - the properties file.xml - the xml file to write in. The xml file does not have to exist.comment - the commentencoding - the encoding for the xml file.FileNotFoundException - the file not found exceptionIOException - Signals that an I/O exception has occurred.public static void toXml(InputStream properties, OutputStream xml, String comment, String encoding) throws FileNotFoundException, IOException
properties - the properties InputStream.xml - the xml OutputStream to write in.comment - the commentencoding - the encoding for the xml file.FileNotFoundException - the file not found exceptionIOException - Signals that an I/O exception has occurred.Copyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.