install4j API

com.install4j.api.beans
Class AbstractBean

java.lang.Object
  extended by com.install4j.api.beans.AbstractBean
All Implemented Interfaces:
Bean
Direct Known Subclasses:
AbstractFormComponent, AbstractInstallAction, AbstractInstallerOrUninstallerScreen, AbstractInstallerScreen, AbstractInstallOrUninstallAction, AbstractUninstallAction, AbstractUninstallerScreen

public abstract class AbstractBean
extends java.lang.Object
implements Bean

Common base class for all abstract super-classes for beans that are handled by install4j. It is not recommended to extend this class directly. Concrete super-classes exist for

This class provides common utility methods fir all bean types.

Author:
ej-technologies GmbH

Constructor Summary
AbstractBean()
           
 
Method Summary
static java.io.File replaceVariables(java.io.File file)
          Replace all installer variables and localization keys in a file name.
static java.io.File[] replaceVariables(java.io.File[] files)
          Replace all installer variables and localization keys in a file array.
static java.lang.String replaceVariables(java.lang.String value)
          Same as replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), with ReplacementMode.PLAIN as the replacement mode and VariableErrorHandlingDescriptor.DEFAULT as the error handling descriptor.
static java.lang.String[] replaceVariables(java.lang.String[] values)
          Same as replaceVariables(String[], VariableErrorHandlingDescriptor), with VariableErrorHandlingDescriptor.DEFAULT as the error handling descriptor.
static java.lang.String[] replaceVariables(java.lang.String[] values, VariableErrorHandlingDescriptor errorHandlingDescriptor)
          Replace all installer variables and localization keys in a string array.
static java.lang.String replaceVariables(java.lang.String value, ReplacementMode replacementMode)
          Same as replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), with VariableErrorHandlingDescriptor.DEFAULT as the error handling descriptor.
static java.lang.String replaceVariables(java.lang.String value, ReplacementMode replacementMode, VariableErrorHandlingDescriptor errorHandlingDescriptor)
          Replace all installer variables and localization keys in a string.
static java.lang.String replaceVariables(java.lang.String value, VariableErrorHandlingDescriptor errorHandlingDescriptor)
          Same as replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), with ReplacementMode.PLAIN as the replacement mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBean

public AbstractBean()
Method Detail

replaceVariables

public static java.lang.String replaceVariables(java.lang.String value)
                                         throws UndefinedVariableException
Same as replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), with ReplacementMode.PLAIN as the replacement mode and VariableErrorHandlingDescriptor.DEFAULT as the error handling descriptor.

Parameters:
value - the original string
Returns:
the string with all variables replaced.
Throws:
UndefinedVariableException - if a variable name cannot be found and the error handling is set to VariableErrorHandling.EXCEPTION for the variable type.

replaceVariables

public static java.lang.String replaceVariables(java.lang.String value,
                                                ReplacementMode replacementMode)
                                         throws UndefinedVariableException
Same as replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), with VariableErrorHandlingDescriptor.DEFAULT as the error handling descriptor.

Parameters:
value - the original string
replacementMode - the replacement mode
Returns:
the string with all variables replaced.
Throws:
UndefinedVariableException - if a variable name cannot be found and the error handling is set to VariableErrorHandling.EXCEPTION for the variable type.

replaceVariables

public static java.lang.String replaceVariables(java.lang.String value,
                                                VariableErrorHandlingDescriptor errorHandlingDescriptor)
                                         throws UndefinedVariableException
Same as replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), with ReplacementMode.PLAIN as the replacement mode.

Parameters:
value - the original string
errorHandlingDescriptor - describes how missing variables should be treated for each variable type
Returns:
the string with all variables replaced.
Throws:
UndefinedVariableException - if a variable name cannot be found and the error handling is set to VariableErrorHandling.EXCEPTION for the variable type.

replaceVariables

public static java.lang.String replaceVariables(java.lang.String value,
                                                ReplacementMode replacementMode,
                                                VariableErrorHandlingDescriptor errorHandlingDescriptor)
                                         throws UndefinedVariableException
Replace all installer variables and localization keys in a string.

Note: compiler variables in the project are replaced at compile time. Compiler variables in external files, such as a custom localization file are not replaced at a compile time.

Parameters:
value - the original string
replacementMode - the replacement mode
errorHandlingDescriptor - describes how missing variables should be treated for each variable type
Returns:
the string with all variables replaced.
Throws:
UndefinedVariableException - if a variable name cannot be found and the error handling is set to VariableErrorHandling.EXCEPTION for the variable type.

replaceVariables

public static java.io.File replaceVariables(java.io.File file)
                                     throws UndefinedVariableException
Replace all installer variables and localization keys in a file name. The used error handling descriptor is VariableErrorHandlingDescriptor.DEFAULT.

Note: compiler variables in the project are replaced at compile time. Compiler variables in external files, such as a custom localization file are not replaced at a compile time.

Parameters:
file - the original file
Returns:
the file with all variables replaced in its name.
Throws:
UndefinedVariableException - if a variable name cannot be found and the error handling is set to VariableErrorHandling.EXCEPTION for the variable type.

replaceVariables

public static java.lang.String[] replaceVariables(java.lang.String[] values)
                                           throws UndefinedVariableException
Same as replaceVariables(String[], VariableErrorHandlingDescriptor), with VariableErrorHandlingDescriptor.DEFAULT as the error handling descriptor.

Parameters:
values - the original array
Returns:
the array with all variables replaced
Throws:
UndefinedVariableException - if a variable name cannot be found and the error handling is set to VariableErrorHandling.EXCEPTION for the variable type.

replaceVariables

public static java.lang.String[] replaceVariables(java.lang.String[] values,
                                                  VariableErrorHandlingDescriptor errorHandlingDescriptor)
                                           throws UndefinedVariableException
Replace all installer variables and localization keys in a string array. For array elements that consist of an installer variable that in turn contains an array value, the elements of that array value will be inserted into the returned array. For this reason the returned array may have more elements than the original array. For example, if the array passed in as an argument has the elements:

   [0] = "One"
   [1] = "${installer:myVariable}"
   [2] = "Three"

 
and the variable myVariable has a String array value with the elements

   [0] = "Blue"
   [1] = "Green"

 
then the returned array will be

   [0] = "One"
   [1] = "Blue"
   [2] = "Green"
   [3] = "Three"

 

If the array in an installer variable is not of type String[], each element will be converted to a string by calling toString() on it.

Note: compiler variables are replaced at compile time.

Parameters:
values - the original array
errorHandlingDescriptor - describes how missing variables should be treated for each variable type
Returns:
the array with all variables replaced
Throws:
UndefinedVariableException - if a variable name cannot be found and the error handling is set to VariableErrorHandling.EXCEPTION for the variable type.

replaceVariables

public static java.io.File[] replaceVariables(java.io.File[] files)
                                       throws UndefinedVariableException
Replace all installer variables and localization keys in a file array. This method is analogous to replaceVariables(String[]).

Parameters:
files - the original array
Returns:
the array with all variables replaced
Throws:
UndefinedVariableException - if a variable name cannot be found and the error handling is set to VariableErrorHandling.EXCEPTION for the variable type.

install4j API