| | |
| | | * This sub-command implements the various set-xxx-prop sub-commands. |
| | | */ |
| | | final class SetPropSubCommandHandler extends SubCommandHandler { |
| | | |
| | | /** Type of modification being performed. */ |
| | | private static enum ModificationType { |
| | | private enum ModificationType { |
| | | /** Append a single value to the property. */ |
| | | ADD, |
| | | /** Remove a single value from the property. */ |
| | |
| | | } else { |
| | | app.println(); |
| | | if (app.confirmAction(INFO_DSCFG_PROMPT_EDIT_TO_ENABLE.get(rufn, name, ufn), true)) { |
| | | MenuResult<Void> result = SetPropSubCommandHandler.modifyManagedObject(app, |
| | | context, ref, handler); |
| | | MenuResult<Void> result = modifyManagedObject(app, context, ref, handler); |
| | | if (result.isQuit()) { |
| | | return result; |
| | | } else if (result.isSuccess()) { |
| | |
| | | |
| | | // Reset properties. |
| | | for (String m : propertyResetArgument.getValues()) { |
| | | |
| | | // Check one does not try to reset with a value |
| | | if (m.contains(":")) { |
| | | throw ArgumentExceptionFactory.unableToResetPropertyWithValue(m, OPTION_DSCFG_LONG_RESET); |
| | |
| | | } |
| | | |
| | | // Apply the command line changes. |
| | | for (PropertyDefinition<?> pd : changes.keySet()) { |
| | | for (Map.Entry<PropertyDefinition, Set> entry : changes.entrySet()) { |
| | | try { |
| | | child.setPropertyValues(pd, changes.get(pd)); |
| | | child.setPropertyValues(entry.getKey(), entry.getValue()); |
| | | } catch (PropertyException e) { |
| | | throw ArgumentExceptionFactory.adaptPropertyException(e, d); |
| | | } |