private static TransferPluginOption getOptionFromField(Field field, Class<? extends TransferSettings> transferSettingsClass, int level) { Element elementAnnotation = field.getAnnotation(Element.class); Setup setupAnnotation = field.getAnnotation(Setup.class); boolean hasName = !elementAnnotation.name().equalsIgnoreCase(""); boolean hasDescription = setupAnnotation != null && !setupAnnotation.description().equals(""); boolean hasCallback = setupAnnotation != null && !setupAnnotation.callback().isInterface(); boolean hasConverter = setupAnnotation != null && !setupAnnotation.converter().isInterface(); boolean hasFileType = setupAnnotation != null && setupAnnotation.fileType() != null; String name = (hasName) ? elementAnnotation.name() : field.getName(); String description = (hasDescription) ? setupAnnotation.description() : field.getName(); FileType fileType = (hasFileType) ? setupAnnotation.fileType() : null; boolean required = elementAnnotation.required(); boolean sensitive = setupAnnotation != null && setupAnnotation.sensitive(); boolean singular = setupAnnotation != null && setupAnnotation.singular(); boolean visible = setupAnnotation != null && setupAnnotation.visible(); boolean encrypted = field.getAnnotation(Encrypted.class) != null; Class<? extends TransferPluginOptionCallback> callback = (hasCallback) ? setupAnnotation.callback() : null; Class<? extends TransferPluginOptionConverter> converter = (hasConverter) ? setupAnnotation.converter() : null; boolean isNestedOption = TransferSettings.class.isAssignableFrom(field.getType()); if (isNestedOption) { return createNestedOption(field, level, name, description, fileType, encrypted, sensitive, singular, visible, required, callback, converter); } else { return createNormalOption(field, transferSettingsClass, name, description, fileType, encrypted, sensitive, singular, visible, required, callback, converter); } }