Search in sources :

Example 6 with TransferPluginOption

use of org.syncany.plugins.transfer.TransferPluginOption in project syncany by syncany.

the class PluginOptionsTest method askNestedPluginSettings.

private void askNestedPluginSettings(TransferSettings settings, TransferPluginOption option, int wrap) throws Exception {
    if (option instanceof NestedTransferPluginOption) {
        assertNotNull(ReflectionUtil.getClassFromType(option.getType()));
        System.out.println(new String(new char[wrap]).replace("\0", "\t") + ReflectionUtil.getClassFromType(option.getType()) + "#" + option.getField().getName() + " (nested)");
        TransferSettings nestedSettings = (TransferSettings) ReflectionUtil.getClassFromType(option.getType()).newInstance();
        settings.setField(option.getField().getName(), nestedSettings);
        for (TransferPluginOption nItem : ((NestedTransferPluginOption) option).getOptions()) {
            askNestedPluginSettings(nestedSettings, nItem, ++wrap);
        }
    } else {
        System.out.println(new String(new char[wrap]).replace("\0", "\t") + settings.getClass() + "#" + option.getField().getName());
        settings.setField(option.getField().getName(), String.valueOf(settings.hashCode()));
    }
}
Also used : NestedTransferPluginOption(org.syncany.plugins.transfer.NestedTransferPluginOption) TransferPluginOption(org.syncany.plugins.transfer.TransferPluginOption) NestedTransferPluginOption(org.syncany.plugins.transfer.NestedTransferPluginOption) TransferSettings(org.syncany.plugins.transfer.TransferSettings) DummyTransferSettings(org.syncany.plugins.dummy.DummyTransferSettings)

Aggregations

NestedTransferPluginOption (org.syncany.plugins.transfer.NestedTransferPluginOption)6 TransferPluginOption (org.syncany.plugins.transfer.TransferPluginOption)6 TransferSettings (org.syncany.plugins.transfer.TransferSettings)3 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2 Ignore (org.junit.Ignore)2 Test (org.junit.Test)2 DummyTransferSettings (org.syncany.plugins.dummy.DummyTransferSettings)2 StorageException (org.syncany.plugins.transfer.StorageException)2 TransferPluginOptionCallback (org.syncany.plugins.transfer.TransferPluginOptionCallback)2 UnknownHostException (java.net.UnknownHostException)1 TransferPlugin (org.syncany.plugins.transfer.TransferPlugin)1