Class ReplaceTokens


  • public final class ReplaceTokens
    extends Object
    Class ReplaceTokens has the functionality to scan sourceFile extract tokens, match them with any token replacements in the provided token replacement Map and perform a replacement if a match is found. The entire transformation is written to a specified destination file.
    • Constructor Detail

      • ReplaceTokens

        public ReplaceTokens​(String sourceFile,
                             String destFile,
                             Map tokens)
                      throws Exception
        Constructs a ReplaceTokens object.
        Parameters:
        sourceFile - the source file whose tokens-tags need to be swapped.
        destFile - the destination file which would be the transformed sourceFile with token-tags swapped. transformed
        tokens - a Map containing the token name and the replacement value
        Throws:
        Exception
    • Method Detail

      • tagSwapAndCopyFile

        public void tagSwapAndCopyFile()
                                throws Exception
        Method to perform the token-tag swap and create a destination file with the transformation.
        Throws:
        Exception - if an error occurrs while performing the transformation.