Step Three : The Executor
In this step, the Executor internally will first try to retrieve the registered TMD set. If it finds them,
it will invoke the 'Indexer' subcomponent passing the source object if applicable.
The 'Indexer' indexes all the collections if present (i.e. arrays, lists and maps). After the Indexer
completes, the Executor finally invokes the compiled executable. This is the only step you will have to invoke
every time you want to perform an object-conversion.
There are 2 methods with different method signatures to invoke the executor.
If the OTCS file consists of values only, (meaning there is no source object used) and so the parameters
would be only 3 as shown below -
Method signature:
copyFromLiterals(String namespace, Class<T> targetClz, Map<String, Object> data)
Ex:-
OtcExecutor otcExecutor = OtcExecutorImpl.getInstance();
otcExecutor.copyFromLiterals("com.example", Passenger.class, null);
If the OTCS file uses a source-object (copy-values command inclusive) then the format is as given in the
below example -
Method signature:
copyFromSource(String namespace, S source-object, Class<T> targetClz, Map<String, Object> data);
Ex:-
OtcExecutor otcExecutor = OtcExecutorImpl.getInstance();
otcExecutor.copyFromSource(null, employee-object, Passenger.class, data);
Please note that 'null' can be passed for the first and the last parameters which are the package-name
and the Map parameters.