jdk/src/jdk.jdi/share/classes/com/sun/jdi/connect/Connector.java
author clanger
Fri, 16 Jun 2017 14:09:31 +0200
changeset 45564 0149773a140c
parent 34894 3248b89d1921
permissions -rw-r--r--
8181417: Code cleanups in com.sun.jdi Reviewed-by: alanb, stuefe, sspitsyn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
     2
 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.jdi.connect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    28
import java.io.Serializable;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.List;
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    30
import java.util.Map;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * A method of connection between a debugger and a target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * A connector encapsulates exactly one {@link Transport}. used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * to establish the connection. Each connector has a set of arguments
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * which controls its operation. The arguments are stored as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * map, keyed by a string. Each implementation defines the string
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * argument keys it accepts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @see LaunchingConnector
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @see AttachingConnector
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * @see ListeningConnector
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * @see Connector.Argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @author Gordon Hirsch
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @since  1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
public interface Connector {
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    49
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * Returns a short identifier for the connector. Connector implementors
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * should follow similar naming conventions as are used with packages
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * to avoid name collisions. For example, the Sun connector
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * implementations have names prefixed with "com.sun.jdi.".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * Not intended for exposure to end-user.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * @return the name of this connector.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    String name();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * Returns a human-readable description of this connector
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * and its purpose.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @return the description of this connector
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    String description();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * Returns the transport mechanism used by this connector to establish
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * connections with a target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @return the {@link Transport} used by this connector.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    Transport transport();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Returns the arguments accepted by this Connector and their
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * default values. The keys of the returned map are string argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * names. The values are {@link Connector.Argument} containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * information about the argument and its default value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @return the map associating argument names with argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * information and default value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    86
    Map<String, Connector.Argument> defaultArguments();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * Specification for and value of a Connector argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Will always implement a subinterface of Argument:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * {@link Connector.StringArgument}, {@link Connector.BooleanArgument},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * {@link Connector.IntegerArgument},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * or {@link Connector.SelectedArgument}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public interface Argument extends Serializable {
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    96
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
         * Returns a short, unique identifier for the argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
         * Not intended for exposure to end-user.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
         * @return the name of this argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        String name();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
         * Returns a short human-readable label for this argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
         * @return a label for this argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        String label();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
         * Returns a human-readable description of this argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
         * and its purpose.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
         * @return the description of this argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        String description();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
         * Returns the current value of the argument. Initially, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
         * default value is returned. If the value is currently unspecified,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
         * null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
         * @return the current value of the argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        String value();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
         * Sets the value of the argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
         * The value should be checked with {@link #isValid(String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
         * before setting it; invalid values will throw an exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
         * when the connection is established - for example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
         * on {@link LaunchingConnector#launch}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        void setValue(String value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
         * Performs basic sanity check of argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
         * @return <code>true</code> if the value is valid to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
         * used in {@link #setValue(String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        boolean isValid(String value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
         * Indicates whether the argument must be specified. If true,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
         * {@link #setValue} must be used to set a non-null value before
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
         * using this argument in establishing a connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
         * @return <code>true</code> if the argument must be specified;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
         * <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        boolean mustSpecify();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * Specification for and value of a Connector argument,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * whose value is Boolean.  Boolean values are represented
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * by the localized versions of the strings "true" and "false".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    public interface BooleanArgument extends Argument {
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   162
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
         * Sets the value of the argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        void setValue(boolean value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
         * Performs basic sanity check of argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
         * @return <code>true</code> if value is a string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
         * representation of a boolean value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
         * @see #stringValueOf(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        boolean isValid(String value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
         * Return the string representation of the <code>value</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
         * parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
         * Does not set or examine the current value of <code>this</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
         * instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
         * @return the localized String representation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
         * boolean value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        String stringValueOf(boolean value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
         * Return the value of the argument as a boolean.  Since
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
         * the argument may not have been set or may have an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
         * value {@link #isValid(String)} should be called on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
         * {@link #value()} to check its validity.  If it is invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
         * the boolean returned by this method is undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
         * @return the value of the argument as a boolean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        boolean booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * Specification for and value of a Connector argument,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * whose value is an integer.  Integer values are represented
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * by their corresponding strings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public interface IntegerArgument extends Argument {
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   203
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
         * Sets the value of the argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
         * The value should be checked with {@link #isValid(int)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
         * before setting it; invalid values will throw an exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
         * when the connection is established - for example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
         * on {@link LaunchingConnector#launch}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        void setValue(int value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
         * Performs basic sanity check of argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
         * @return <code>true</code> if value represents an int that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
         * <code>{@link #min()} &lt;= value &lt;= {@link #max()}</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        boolean isValid(String value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
         * Performs basic sanity check of argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
         * @return <code>true</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
         * <code>{@link #min()} &lt;= value  &lt;= {@link #max()}</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        boolean isValid(int value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
         * Return the string representation of the <code>value</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
         * parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
         * Does not set or examine the current value of <code>this</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
         * instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
         * @return the String representation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
         * int value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        String stringValueOf(int value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
         * Return the value of the argument as a int.  Since
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
         * the argument may not have been set or may have an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
         * value {@link #isValid(String)} should be called on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
         * {@link #value()} to check its validity.  If it is invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
         * the int returned by this method is undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
         * @return the value of the argument as a int.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        int intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
         * The upper bound for the value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
         * @return the maximum allowed value for this argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        int max();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
         * The lower bound for the value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
         * @return the minimum allowed value for this argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        int min();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * Specification for and value of a Connector argument,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * whose value is a String.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    public interface StringArgument extends Argument {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
         * Performs basic sanity check of argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
         * @return <code>true</code> always
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        boolean isValid(String value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * Specification for and value of a Connector argument,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * whose value is a String selected from a list of choices.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    public interface SelectedArgument extends Argument {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
         * Return the possible values for the argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
         * @return {@link List} of {@link String}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        List<String> choices();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
         * Performs basic sanity check of argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
         * @return <code>true</code> if value is one of {@link #choices()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        boolean isValid(String value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
}