@Test public void testCreateEncryptionContextTableNameOverrideMap_expectedOverride() { Map<String, String> tableNameOverrides = new HashMap<>(); tableNameOverrides.put("OriginalTableName", "MyNewTableName"); Function<EncryptionContext, EncryptionContext> nameOverrideMap = overrideEncryptionContextTableNameUsingMap(tableNameOverrides); EncryptionContext context = new EncryptionContext.Builder().withTableName("OriginalTableName").build(); EncryptionContext newContext = nameOverrideMap.apply(context); assertEquals("OriginalTableName", context.getTableName()); assertEquals("MyNewTableName", newContext.getTableName()); }
public static UnaryOperator<EncryptionContext> overrideEncryptionContextTableNameUsingMap( Map<String, String> tableNameOverrideMap) { return encryptionContext -> { if (tableNameOverrideMap == null || encryptionContext == null || encryptionContext.getTableName() == null) { return encryptionContext; } String newTableName = tableNameOverrideMap.get(encryptionContext.getTableName()); if (newTableName != null) { return new EncryptionContext.Builder(encryptionContext).withTableName(newTableName).build(); } else { return encryptionContext; } }; }
EncryptionContextOperators { public static UnaryOperator<EncryptionContext> overrideEncryptionContextTableNameUsingMap( Map<String, String> tableNameOverrideMap) { return encryptionContext -> { if (tableNameOverrideMap == null || encryptionContext == null || encryptionContext.getTableName() == null) { return encryptionContext; } String newTableName = tableNameOverrideMap.get(encryptionContext.getTableName()); if (newTableName != null) { return new EncryptionContext.Builder(encryptionContext).withTableName(newTableName).build(); } else { return encryptionContext; } }; } }
EncryptionContextOperators { public static UnaryOperator<EncryptionContext> overrideEncryptionContextTableNameUsingMap( Map<String, String> tableNameOverrideMap) { return encryptionContext -> { if (tableNameOverrideMap == null || encryptionContext == null || encryptionContext.getTableName() == null) { return encryptionContext; } String newTableName = tableNameOverrideMap.get(encryptionContext.getTableName()); if (newTableName != null) { return new EncryptionContext.Builder(encryptionContext).withTableName(newTableName).build(); } else { return encryptionContext; } }; } private  EncryptionContextOperators(); }
EncryptionContextOperators { public static UnaryOperator<EncryptionContext> overrideEncryptionContextTableNameUsingMap( Map<String, String> tableNameOverrideMap) { return encryptionContext -> { if (tableNameOverrideMap == null || encryptionContext == null || encryptionContext.getTableName() == null) { return encryptionContext; } String newTableName = tableNameOverrideMap.get(encryptionContext.getTableName()); if (newTableName != null) { return new EncryptionContext.Builder(encryptionContext).withTableName(newTableName).build(); } else { return encryptionContext; } }; } private  EncryptionContextOperators(); static UnaryOperator<EncryptionContext> overrideEncryptionContextTableName(
            String originalTableName,
            String newTableName); static UnaryOperator<EncryptionContext> overrideEncryptionContextTableNameUsingMap(
            Map<String, String> tableNameOverrideMap); }
EncryptionContextOperators { public static UnaryOperator<EncryptionContext> overrideEncryptionContextTableNameUsingMap( Map<String, String> tableNameOverrideMap) { return encryptionContext -> { if (tableNameOverrideMap == null || encryptionContext == null || encryptionContext.getTableName() == null) { return encryptionContext; } String newTableName = tableNameOverrideMap.get(encryptionContext.getTableName()); if (newTableName != null) { return new EncryptionContext.Builder(encryptionContext).withTableName(newTableName).build(); } else { return encryptionContext; } }; } private  EncryptionContextOperators(); static UnaryOperator<EncryptionContext> overrideEncryptionContextTableName(
            String originalTableName,
            String newTableName); static UnaryOperator<EncryptionContext> overrideEncryptionContextTableNameUsingMap(
            Map<String, String> tableNameOverrideMap);  }