Difference between revisions of "PropertiesHandler"
(Created page with "Class FQN: '''it.greenvulcano.util.metadata.PropertiesHandler''' /** * Helper class for metadata substitution in strings. * * @version 3.0.0 Feb 17, 2010 * @author GreenVulc...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
Class FQN: '''it.greenvulcano.util.metadata.PropertiesHandler''' | Class FQN: '''it.greenvulcano.util.metadata.PropertiesHandler''' | ||
+ | See also [[Placeholders]] | ||
+ | |||
+ | <syntaxhighlight lang="java5"> | ||
/** | /** | ||
* Helper class for metadata substitution in strings. | * Helper class for metadata substitution in strings. | ||
* | * | ||
− | * | + | * Search the classpath for a file named PropertiesHandler.properties containing, |
− | * | + | * one at line, the FQN of classes implementing PropertyHandler interface, the |
− | * | + | * found classes are instantiated and registered. |
* | * | ||
**/ | **/ | ||
+ | </syntaxhighlight> | ||
− | == | + | ==PropertiesHandler public static methods== |
− | |||
<syntaxhighlight lang="java5"> | <syntaxhighlight lang="java5"> | ||
+ | /** | ||
+ | * This method inserts the correct values for the dynamic parameter found in | ||
+ | * the input string. | ||
+ | * | ||
+ | * @param str | ||
+ | * the string to evaluate | ||
+ | * @return the expanded string | ||
+ | * | ||
+ | * @throws PropertiesHandlerException | ||
+ | * if error occurs and the flag THROWS_EXCEPTION is set | ||
+ | */ | ||
+ | public static String expand(String str) throws PropertiesHandlerException | ||
− | + | /** | |
− | + | * This method inserts the correct values for the dynamic parameter found in | |
− | + | * the input string. | |
− | + | * | |
− | + | * @param str | |
+ | * the string to evaluate | ||
+ | * @param inProperties | ||
+ | * the hashTable containing the properties | ||
+ | * @return the expanded string | ||
+ | * | ||
+ | * @throws PropertiesHandlerException | ||
+ | * if error occurs and the flag THROWS_EXCEPTION is set | ||
+ | */ | ||
+ | public static String expand(String str, Map<String, Object> inProperties) throws PropertiesHandlerException | ||
+ | /** | ||
+ | * This method inserts the correct values for the dynamic parameter found in | ||
+ | * the input string. | ||
+ | * | ||
+ | * @param str | ||
+ | * the string to evaluate | ||
+ | * @param inProperties | ||
+ | * the hashTable containing the properties | ||
+ | * @param obj | ||
+ | * the object to work with | ||
+ | * @return the expanded string | ||
+ | * | ||
+ | * @throws PropertiesHandlerException | ||
+ | * if error occurs and the flag THROWS_EXCEPTION is set | ||
+ | */ | ||
+ | public static String expand(String str, Map<String, Object> inProperties, Object obj) | ||
+ | throws PropertiesHandlerException | ||
− | + | /** | |
− | + | * This method inserts the correct values for the dynamic parameter found in | |
− | + | * the input string. | |
− | + | * | |
− | + | * @param str | |
− | + | * the string to evaluate | |
− | + | * @param inProperties | |
− | + | * the hashTable containing the properties | |
− | + | * @param obj | |
− | + | * the object to work with | |
− | + | * @param scope | |
− | + | * the JavaScript scope | |
− | + | * @return the expanded string | |
+ | * | ||
+ | * @throws PropertiesHandlerException | ||
+ | * if error occurs and the flag THROWS_EXCEPTION is set | ||
+ | */ | ||
+ | public static String expand(String str, Map<String, Object> inProperties, Object obj, Scriptable scope) | ||
+ | throws PropertiesHandlerException | ||
+ | /** | ||
+ | * This method inserts the correct values for the dynamic parameter found in | ||
+ | * the input string. | ||
+ | * | ||
+ | * @param str | ||
+ | * the string to evaluate | ||
+ | * @param inProperties | ||
+ | * the hashTable containing the properties | ||
+ | * @param obj | ||
+ | * the object to work with | ||
+ | * @param scope | ||
+ | * the JavaScript scope | ||
+ | * @param extra | ||
+ | * a extra object passed to property handlers | ||
+ | * @return the expanded string | ||
+ | * | ||
+ | * @throws PropertiesHandlerException | ||
+ | * if error occurs and the flag THROWS_EXCEPTION is set | ||
+ | */ | ||
+ | public static String expand(String str, Map<String, Object> inProperties, Object obj, Scriptable scope, Object extra) | ||
+ | throws PropertiesHandlerException | ||
− | + | /** | |
− | + | * Enables the exception throwing on errors, for the current thread. | |
− | + | * | |
− | + | * Example: | |
− | + | * | |
− | + | * <pre> | |
− | + | * | |
− | + | * ... | |
− | + | * PropertiesHandler.enableExceptionOnErrors(); | |
− | + | * try { | |
− | + | * ... | |
− | + | * String value = PropertiesHandler.expand(...); | |
− | + | * ... | |
− | + | * } | |
− | + | * catch (PropertiesHandlerException exc) { | |
− | + | * ... | |
+ | * } | ||
+ | * finally { | ||
+ | * PropertiesHandler.disableExceptionOnErrors(); | ||
+ | * } | ||
+ | * | ||
+ | * </pre> | ||
+ | */ | ||
+ | public static void enableExceptionOnErrors() | ||
+ | /** | ||
+ | * Disables the exception throwing on errors, for the current thread. | ||
+ | * | ||
+ | */ | ||
+ | public static void disableExceptionOnErrors() | ||
− | + | /** | |
− | + | * Checks if the exception throwing on errors is enabled for the current | |
− | + | * thread. | |
− | + | * | |
− | + | * @return if the exception throwing on errors is enabled for the current | |
− | + | * thread. | |
− | + | * | |
− | + | */ | |
− | + | public static boolean isExceptionOnErrors() | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | /** | |
− | + | * Checks if the input string need to be processed. | |
− | + | * | |
− | + | * @param str | |
− | + | * the string to check | |
− | + | * @return true if the string is processed | |
− | + | */ | |
− | + | public static boolean isExpanded(String str) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 18:03, 21 December 2012
Class FQN: it.greenvulcano.util.metadata.PropertiesHandler
See also Placeholders
/**
* Helper class for metadata substitution in strings.
*
* Search the classpath for a file named PropertiesHandler.properties containing,
* one at line, the FQN of classes implementing PropertyHandler interface, the
* found classes are instantiated and registered.
*
**/
PropertiesHandler public static methods
/**
* This method inserts the correct values for the dynamic parameter found in
* the input string.
*
* @param str
* the string to evaluate
* @return the expanded string
*
* @throws PropertiesHandlerException
* if error occurs and the flag THROWS_EXCEPTION is set
*/
public static String expand(String str) throws PropertiesHandlerException
/**
* This method inserts the correct values for the dynamic parameter found in
* the input string.
*
* @param str
* the string to evaluate
* @param inProperties
* the hashTable containing the properties
* @return the expanded string
*
* @throws PropertiesHandlerException
* if error occurs and the flag THROWS_EXCEPTION is set
*/
public static String expand(String str, Map<String, Object> inProperties) throws PropertiesHandlerException
/**
* This method inserts the correct values for the dynamic parameter found in
* the input string.
*
* @param str
* the string to evaluate
* @param inProperties
* the hashTable containing the properties
* @param obj
* the object to work with
* @return the expanded string
*
* @throws PropertiesHandlerException
* if error occurs and the flag THROWS_EXCEPTION is set
*/
public static String expand(String str, Map<String, Object> inProperties, Object obj)
throws PropertiesHandlerException
/**
* This method inserts the correct values for the dynamic parameter found in
* the input string.
*
* @param str
* the string to evaluate
* @param inProperties
* the hashTable containing the properties
* @param obj
* the object to work with
* @param scope
* the JavaScript scope
* @return the expanded string
*
* @throws PropertiesHandlerException
* if error occurs and the flag THROWS_EXCEPTION is set
*/
public static String expand(String str, Map<String, Object> inProperties, Object obj, Scriptable scope)
throws PropertiesHandlerException
/**
* This method inserts the correct values for the dynamic parameter found in
* the input string.
*
* @param str
* the string to evaluate
* @param inProperties
* the hashTable containing the properties
* @param obj
* the object to work with
* @param scope
* the JavaScript scope
* @param extra
* a extra object passed to property handlers
* @return the expanded string
*
* @throws PropertiesHandlerException
* if error occurs and the flag THROWS_EXCEPTION is set
*/
public static String expand(String str, Map<String, Object> inProperties, Object obj, Scriptable scope, Object extra)
throws PropertiesHandlerException
/**
* Enables the exception throwing on errors, for the current thread.
*
* Example:
*
* <pre>
*
* ...
* PropertiesHandler.enableExceptionOnErrors();
* try {
* ...
* String value = PropertiesHandler.expand(...);
* ...
* }
* catch (PropertiesHandlerException exc) {
* ...
* }
* finally {
* PropertiesHandler.disableExceptionOnErrors();
* }
*
* </pre>
*/
public static void enableExceptionOnErrors()
/**
* Disables the exception throwing on errors, for the current thread.
*
*/
public static void disableExceptionOnErrors()
/**
* Checks if the exception throwing on errors is enabled for the current
* thread.
*
* @return if the exception throwing on errors is enabled for the current
* thread.
*
*/
public static boolean isExceptionOnErrors()
/**
* Checks if the input string need to be processed.
*
* @param str
* the string to check
* @return true if the string is processed
*/
public static boolean isExpanded(String str)