Package org.omegat.util
Class VarExpansion<Param>
- java.lang.Object
-
- org.omegat.util.VarExpansion<Param>
-
- Direct Known Subclasses:
CommandVarExpansion
,MatchesVarExpansion
,ModificationInfoManager.ModificationInfoVarExpansion
public abstract class VarExpansion<Param> extends java.lang.Object
This class is used to transform a string by expansion of variables it contains. It can expand:- Entries in Bundle.properties: see
expandBundleEntries(String)
for syntax - Variables: see
expandVariables(Object)
for syntax
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
PATTERN_BUNDLE_ENTRY
static java.lang.String
VAR_FILE_EXTENSION
static java.lang.String
VAR_FILE_NAME
static java.lang.String
VAR_FILE_NAME_ONLY
static java.lang.String
VAR_FILE_PATH
static java.lang.String
VAR_FILE_SHORT_PATH
static java.lang.String
VAR_PROJECT_SOURCE_LANG
static java.lang.String
VAR_PROJECT_SOURCE_LANG_CODE
static java.lang.String
VAR_PROJECT_TARGET_LANG
static java.lang.String
VAR_PROJECT_TARGET_LANG_CODE
static java.lang.String
VAR_SOURCE_TEXT
static java.lang.String
VAR_TARGET_TEXT
-
Constructor Summary
Constructors Constructor Description VarExpansion(java.lang.String template)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
expandFileName(java.lang.String localTemplate, java.lang.String filePath, java.lang.String baseDir)
java.lang.String
expandFileNames(java.lang.String localTemplate, java.lang.String[] filePaths, java.lang.String baseDir)
Expands all variables relating to file name : ${filePath} = full file path ${fileShortPath} = file path relative to given root ${fileName} = full file name (w/o path but with extension) ${fileNameOnly} = file name without extension ${fileNameOnly-1}, ${fileNameOnly-2}, ...abstract java.lang.String
expandVariables(Param param)
-
-
-
Field Detail
-
VAR_SOURCE_TEXT
public static final java.lang.String VAR_SOURCE_TEXT
- See Also:
- Constant Field Values
-
VAR_TARGET_TEXT
public static final java.lang.String VAR_TARGET_TEXT
- See Also:
- Constant Field Values
-
VAR_PROJECT_SOURCE_LANG
public static final java.lang.String VAR_PROJECT_SOURCE_LANG
- See Also:
- Constant Field Values
-
VAR_PROJECT_SOURCE_LANG_CODE
public static final java.lang.String VAR_PROJECT_SOURCE_LANG_CODE
- See Also:
- Constant Field Values
-
VAR_PROJECT_TARGET_LANG
public static final java.lang.String VAR_PROJECT_TARGET_LANG
- See Also:
- Constant Field Values
-
VAR_PROJECT_TARGET_LANG_CODE
public static final java.lang.String VAR_PROJECT_TARGET_LANG_CODE
- See Also:
- Constant Field Values
-
VAR_FILE_NAME
public static final java.lang.String VAR_FILE_NAME
- See Also:
- Constant Field Values
-
VAR_FILE_NAME_ONLY
public static final java.lang.String VAR_FILE_NAME_ONLY
- See Also:
- Constant Field Values
-
VAR_FILE_EXTENSION
public static final java.lang.String VAR_FILE_EXTENSION
- See Also:
- Constant Field Values
-
VAR_FILE_PATH
public static final java.lang.String VAR_FILE_PATH
- See Also:
- Constant Field Values
-
VAR_FILE_SHORT_PATH
public static final java.lang.String VAR_FILE_SHORT_PATH
- See Also:
- Constant Field Values
-
PATTERN_BUNDLE_ENTRY
public static final java.util.regex.Pattern PATTERN_BUNDLE_ENTRY
-
-
Method Detail
-
expandFileNames
public java.lang.String expandFileNames(java.lang.String localTemplate, java.lang.String[] filePaths, java.lang.String baseDir)
Expands all variables relating to file name :- ${filePath} = full file path
- ${fileShortPath} = file path relative to given root
- ${fileName} = full file name (w/o path but with extension)
- ${fileNameOnly} = file name without extension
- ${fileNameOnly-1}, ${fileNameOnly-2}, ... = filename with 1, 2, ... extensions
- ${fileExtension} = all extensions after '.'
- ${fileExtension-1}, ${fileExtension-2}, ... = ${fileExtension} after removing 1, 2, ... extensions
- Parameters:
localTemplate
- initial template. If null, use instance's template but does not modify itfilePath
- path used by variable ${fileShortPath}- Returns:
- Copy of the template with mentioned variables expanded. Other variables remain unchanged
-
expandFileName
public java.lang.String expandFileName(java.lang.String localTemplate, java.lang.String filePath, java.lang.String baseDir)
-
expandVariables
public abstract java.lang.String expandVariables(Param param)
-
-