Examples of Option


Examples of org.apache.karaf.shell.api.action.Option

        String[] names = scoped || Session.SCOPE_GLOBAL.equals(cmd.scope()) ? new String[] { cmd.name() } : new String[] { cmd.name(), cmd.scope() + ":" + cmd.name() };
        commandCompleter = new StringsCompleter(names);
        // Build options completer
        for (Class<?> type = actionClass; type != null; type = type.getSuperclass()) {
            for (Field field : type.getDeclaredFields()) {
                Option option = field.getAnnotation(Option.class);
                if (option != null) {
                    fields.put(option, field);
                    options.put(option.name(), option);
                    String[] aliases = option.aliases();
                    if (aliases != null) {
                        for (String alias : aliases) {
                            options.put(alias, option);
                        }
                    }
                }
                Argument argument = field.getAnnotation(Argument.class);
                if (argument != null) {
                    Integer key = argument.index();
                    if (arguments.containsKey(key)) {
                        LOGGER.warn("Duplicate @Argument annotations on class " + type.getName() + " for index: " + key + " see: " + field);
                    } else {
                        arguments.put(key, field);
                    }
                }
            }
        }
        options.put(HelpOption.HELP.name(), HelpOption.HELP);

        argsCompleters = new ArrayList<>();
        optionsCompleter = new StringsCompleter(options.keySet());

        boolean multi = false;
        for (int key = 0; key < arguments.size(); key++) {
            Completer completer = null;
            Field field = arguments.get(key);
            if (field != null) {
                Argument argument = field.getAnnotation(Argument.class);
                multi = (argument != null && argument.multiValued());
                Completion ann = field.getAnnotation(Completion.class);
                if (ann != null) {
                    Class<?> clazz = ann.value();
                    String[] value = ann.values();
                    if (clazz != null) {
                        if (value.length > 0 && clazz == StringsCompleter.class) {
                            completer = new StringsCompleter(value, ann.caseSensitive());
                        } else {
                            completer = command.getCompleter(clazz);
                        }
                    }
                } else {
                    completer = getDefaultCompleter(field, multi);
                }
            }
            if (completer == null) {
                completer = NullCompleter.INSTANCE;
            }
            argsCompleters.add(completer);
        }
        if (argsCompleters.isEmpty() || !multi) {
            argsCompleters.add(NullCompleter.INSTANCE);
        }
        optionalCompleters = new HashMap<>();
        for (Option option : fields.keySet()) {
            Completer completer = null;
            Field field = fields.get(option);
            if (field != null) {
                Completion ann = field.getAnnotation(Completion.class);
                if (ann != null) {
                    Class clazz = ann.value();
                    String[] value = ann.values();
                    if (clazz != null) {
                        if (clazz == StringsCompleter.class) {
                            completer = new StringsCompleter(value, ann.caseSensitive());
                        } else {
                            completer = command.getCompleter(clazz);
                        }
                    }
                } else {
                    completer = getDefaultCompleter(field, option.multiValued());
                }
            }
            if (completer == null) {
                completer = NullCompleter.INSTANCE;
            }
            optionalCompleters.put(option.name(), completer);
            if (option.aliases() != null) {
                for (String alias : option.aliases()) {
                    optionalCompleters.put(alias, completer);
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.karaf.shell.commands.Option

        // Command name completer
        commandCompleter = new StringsCompleter(getNames(session, command));
        // Build options completer
        for (Class<?> type = function.getActionClass(); type != null; type = type.getSuperclass()) {
            for (Field field : type.getDeclaredFields()) {
                Option option = field.getAnnotation(Option.class);
                if (option != null) {
                    fields.put(option, field);
                    options.put(option.name(), option);
                    String[] aliases = option.aliases();
                    if (aliases != null) {
                        for (String alias : aliases) {
                            options.put(alias, option);
                        }
                    }
View Full Code Here

Examples of org.apache.marmotta.splash.common.ui.SelectionDialog.Option

                                loopback = loopback<0?i:loopback;
                            } else {
                                text = "Public IP-Address. Recommended for Workstation or Server use";
                            }

                            choices.add(new Option(label, text));
                        }

                        int choice = SelectionDialog.select("Select Server Address",
                                "Select host address to use for configuring the\nApache Marmotta Platform.",
                                WordUtils.wrap("For demonstration purposes or laptop installations it is recommended to select \""+(loopback<0?"localhost":hostNames.get(loopback))+"\" below. For server and workstation installations, please select a public IP address.", 60),
View Full Code Here

Examples of org.apache.torque.generator.option.Option

        Options inheritedOptions = inheritedConfiguration.getOptions();
        for (Map.Entry<QualifiedName, Option> entry
            : inheritedOptions.getGlobalScope().entrySet())
        {
            QualifiedName optionName = entry.getKey();
            Option option = entry.getValue();
            if (!options.getGlobalScope().containsKey(optionName))
            {
                options.setGlobalOption(option);
            }
        }
View Full Code Here

Examples of org.crsh.cli.Option

    }
  }

  private static Tuple get(Annotation... ab) {
    Argument argumentAnn = null;
    Option optionAnn = null;
    Boolean required = null;
    Description description = new Description(ab);
    Annotation info = null;
    for (Annotation parameterAnnotation : ab) {
      if (parameterAnnotation instanceof Option) {
View Full Code Here

Examples of org.eclim.plugin.core.preference.Option

    Preferences.addOptionHandler("com.android.ide.eclipse.adt", new OptionHandler());
    ProjectNatureFactory.addNature("android", NATURE);
    ProjectManagement.addProjectManager(NATURE, new AndroidProjectManager());

    Preferences preferences = Preferences.getInstance();
    Option option = new Option();
    option.setNature(NATURE);
    option.setPath("Android");
    option.setName(AdtPrefs.PREFS_SDK_DIR);
    option.setValidator(new SdkValidator());
    preferences.addOption(option);

    String sdkLocation = AdtPrefs.getPrefs().getOsSdkFolder();
    if (sdkLocation == null || sdkLocation.length() == 0){
      logger.warn("Android SDK Location not set.");
View Full Code Here

Examples of org.elasticsearch.search.suggest.Suggest.Suggestion.Entry.Option

                    options.add(newOption);
                }
            }
           
            protected O newOption(){
                return (O) new Option();
            }
View Full Code Here

Examples of org.elasticsearch.search.suggest.completion.CompletionSuggestion.Entry.Option

                List<Lookup.LookupResult> lookupResults = lookup.lookup(spare.get(), false, suggestionContext.getSize());
                for (Lookup.LookupResult res : lookupResults) {

                    final String key = res.key.toString();
                    final float score = res.value;
                    final Option value = results.get(key);
                    if (value == null) {
                        final Option option = new CompletionSuggestion.Entry.Option(new StringText(key), score, res.payload == null ? null
                                : new BytesArray(res.payload));
                        results.put(key, option);
                    } else if (value.getScore() < score) {
                        value.setScore(score);
                        value.setPayload(res.payload == null ? null : new BytesArray(res.payload));
View Full Code Here

Examples of org.exist.xquery.Option

  }

        private Sequence getOption(Sequence[] args) throws XPathException {
            final String qnameString = args[0].getStringValue();
            final QName qname = QName.parse(context, qnameString, context.getDefaultFunctionNamespace());
            final Option option = context.getOption(qname);

            if(option != null) {
                return new StringValue(option.getContents());
            } else {
                return Sequence.EMPTY_SEQUENCE;
            }
        }
View Full Code Here

Examples of org.integratedmodelling.riskwiz.learning.data.Option

            if (m_query.equals("Select * from Results0")) {
                text.append("\n\nDatabaseLoader options:\n");
                Enumeration enumi = listOptions();

                while (enumi.hasMoreElements()) {
                    Option option = (Option) enumi.nextElement();

                    text.append(option.synopsis() + '\n');
                    text.append(option.description() + '\n');
                }
                System.out.println(text);
            }
        }
        // System.out.println(result);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.