The ModifyCheckingAccountImpl class provides two command constructors. One of them implicitly uses the default target policy; the other takes a target policy object as an argument, which enables you to use a custom target policy.
The following example uses the second constructor, passing a null target and a custom target policy, so that the custom policy is used to determine the target. After the command is executed, the code uses the reset method to return the target policy to the default.
{ ... CheckingAccount checkingAccount .... try { CustomTargetPolicy customPolicy = new CustomTargetPolicy(); ModifyCheckingAccountCmd cmd = new ModifyCheckingAccountCmdImpl(null, 1000, customPolicy); cmd.setCheckingAccount(checkingAccount); cmd.execute(); cmd.reset(); } catch (Exception e) { System.out.println(e.getMessage()); } }