
de.carne.util.cmdline.CmdLineActionConsumer Maven / Gradle / Ivy
/*
* Copyright (c) 2016 Holger de Carne and contributors, All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package de.carne.util.cmdline;
import java.util.function.Consumer;
/**
* {@code CmdLineAction} implementation for switch and unnamed arguments. In the
* first case the action is invoked with the argument name only (switch) in the
* second case with the (unnamed) option string.
*/
class CmdLineActionConsumer extends CmdLineAction implements Consumer {
private Consumer consumer;
CmdLineActionConsumer(Consumer consumer) {
this.consumer = consumer;
}
@Override
public void accept(String t) throws CmdLineActionException {
this.consumer.accept(t);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy