Frames | No Frames |
1: /** 2: * Copyright 2003-2004 The Apache Software Foundation 3: * 4: * Licensed under the Apache License, Version 2.0 (the "License"); 5: * you may not use this file except in compliance with the License. 6: * You may obtain a copy of the License at 7: * 8: * http://www.apache.org/licenses/LICENSE-2.0 9: * 10: * Unless required by applicable law or agreed to in writing, software 11: * distributed under the License is distributed on an "AS IS" BASIS, 12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13: * See the License for the specific language governing permissions and 14: * limitations under the License. 15: */ 16: package net.dpml.cli; 17: 18: import java.util.List; 19: 20: /** 21: * A CommandLine that detected values and options can be written to. 22: */ 23: public interface WriteableCommandLine extends CommandLine 24: { 25: /** 26: * Adds an Option to the CommandLine 27: * @param option the Option to add 28: */ 29: void addOption( Option option ); 30: 31: /** 32: * Adds a value to an Option in the CommandLine. 33: * @param option the Option to add to 34: * @param value the value to add 35: */ 36: void addValue( Option option, Object value ); 37: 38: /** 39: * Sets the default values for an Option in the CommandLine 40: * @param option the Option to add to 41: * @param defaultValues the defaults for the option 42: */ 43: void setDefaultValues( Option option, List defaultValues ); 44: 45: /** 46: * Adds a switch value to an Option in the CommandLine. 47: * @param option the Option to add to 48: * @param value the switch value to add 49: * @throws IllegalStateException if the switch has already been added 50: */ 51: void addSwitch( Option option, boolean value ) throws IllegalStateException; 52: 53: /** 54: * Sets the default state for a Switch in the CommandLine. 55: * @param option the Option to add to 56: * @param defaultSwitch the defaults state for ths switch 57: */ 58: void setDefaultSwitch( Option option, Boolean defaultSwitch ); 59: 60: /** 61: * Adds a property value to a name in the CommandLine. 62: * Replaces any existing value for the property. 63: * 64: * @param property the name of the property 65: * @param value the value of the property 66: */ 67: void addProperty( String property, String value ); 68: 69: /** 70: * Detects whether the argument looks like an Option trigger 71: * @param argument the argument to test 72: * @return true if the argument looks like an Option trigger 73: */ 74: boolean looksLikeOption( String argument ); 75: }