com.sun.tools.javac.util.StringUtils Java Examples

The following examples show how to use com.sun.tools.javac.util.StringUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: SerializedFormBuilder.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return true if the given Doc should be included
 * in the serialized form.
 *
 * @param doc the Doc object to check for serializability.
 */
private static boolean serialDocInclude(Doc doc) {
    if (doc.isEnum()) {
        return false;
    }
    Tag[] serial = doc.tags("serial");
    if (serial.length > 0) {
        String serialtext = StringUtils.toLowerCase(serial[0].text());
        if (serialtext.contains("exclude")) {
            return false;
        } else if (serialtext.contains("include")) {
            return true;
        }
    }
    return true;
}
 
Example #2
Source Project: hottub   Author: dsrg-uoft   File: SerializedFormBuilder.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return true if the given Doc should be included
 * in the serialized form.
 *
 * @param doc the Doc object to check for serializability.
 */
private static boolean serialDocInclude(Doc doc) {
    if (doc.isEnum()) {
        return false;
    }
    Tag[] serial = doc.tags("serial");
    if (serial.length > 0) {
        String serialtext = StringUtils.toLowerCase(serial[0].text());
        if (serialtext.indexOf("exclude") >= 0) {
            return false;
        } else if (serialtext.indexOf("include") >= 0) {
            return true;
        }
    }
    return true;
}
 
Example #3
Source Project: hottub   Author: dsrg-uoft   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = StringUtils.toLowerCase(name).startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #4
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Checker.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitEntity(EntityTree tree, Void ignore) {
    checkAllowsText(tree);
    markEnclosingTag(Flag.HAS_TEXT);
    String name = tree.getName().toString();
    if (name.startsWith("#")) {
        int v = StringUtils.toLowerCase(name).startsWith("#x")
                ? Integer.parseInt(name.substring(2), 16)
                : Integer.parseInt(name.substring(1), 10);
        if (!Entity.isValid(v)) {
            env.messages.error(HTML, tree, "dc.entity.invalid", name);
        }
    } else if (!Entity.isValid(name)) {
        env.messages.error(HTML, tree, "dc.entity.invalid", name);
    }
    return null;
}
 
Example #5
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: SerializedFormBuilder.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return true if the given Doc should be included
 * in the serialized form.
 *
 * @param doc the Doc object to check for serializability.
 */
private static boolean serialDocInclude(Doc doc) {
    if (doc.isEnum()) {
        return false;
    }
    Tag[] serial = doc.tags("serial");
    if (serial.length > 0) {
        String serialtext = StringUtils.toLowerCase(serial[0].text());
        if (serialtext.indexOf("exclude") >= 0) {
            return false;
        } else if (serialtext.indexOf("include") >= 0) {
            return true;
        }
    }
    return true;
}
 
Example #6
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: Configuration.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * This checks for the validity of the options used by the user.
 * This works exactly like
 * {@link com.sun.javadoc.Doclet#validOptions(String[][],
 * DocErrorReporter)}. This will validate the options which are shared
 * by our doclets. For example, this method will flag an error using
 * the DocErrorReporter if user has used "-nohelp" and "-helpfile" option
 * together.
 *
 * @param options  options used on the command line.
 * @param reporter used to report errors.
 * @return true if all the options are valid.
 */
public boolean generalValidOptions(String options[][],
        DocErrorReporter reporter) {
    boolean docencodingfound = false;
    String encoding = "";
    for (int oi = 0; oi < options.length; oi++) {
        String[] os = options[oi];
        String opt = StringUtils.toLowerCase(os[0]);
        if (opt.equals("-docencoding")) {
            docencodingfound = true;
            if (!checkOutputFileEncoding(os[1], reporter)) {
                return false;
            }
        } else if (opt.equals("-encoding")) {
            encoding = os[1];
        }
    }
    if (!docencodingfound && encoding.length() > 0) {
        if (!checkOutputFileEncoding(encoding, reporter)) {
            return false;
        }
    }
    return true;
}
 
Example #7
Source Project: TencentKona-8   Author: Tencent   File: TagletManager.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a new <code>SimpleTaglet</code>.  If this tag already exists
 * and the header passed as an argument is null, move tag to the back of the
 * list. If this tag already exists and the header passed as an argument is
 * not null, overwrite previous tag with new one.  Otherwise, add new
 * SimpleTaglet to list.
 * @param tagName the name of this tag
 * @param header the header to output.
 * @param locations the possible locations that this tag
 * can appear in.
 */
public void addNewSimpleCustomTag(String tagName, String header, String locations) {
    if (tagName == null || locations == null) {
        return;
    }
    Taglet tag = customTags.get(tagName);
    locations = StringUtils.toLowerCase(locations);
    if (tag == null || header != null) {
        customTags.remove(tagName);
        customTags.put(tagName, new SimpleTaglet(tagName, header, locations));
        if (locations != null && locations.indexOf('x') == -1) {
            checkTagName(tagName);
        }
    } else {
        //Move to back
        customTags.remove(tagName);
        customTags.put(tagName, tag);
    }
}
 
Example #8
Source Project: TencentKona-8   Author: Tencent   File: SerializedFormBuilder.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return true if the given Doc should be included
 * in the serialized form.
 *
 * @param doc the Doc object to check for serializability.
 */
private static boolean serialDocInclude(Doc doc) {
    if (doc.isEnum()) {
        return false;
    }
    Tag[] serial = doc.tags("serial");
    if (serial.length > 0) {
        String serialtext = StringUtils.toLowerCase(serial[0].text());
        if (serialtext.indexOf("exclude") >= 0) {
            return false;
        } else if (serialtext.indexOf("include") >= 0) {
            return true;
        }
    }
    return true;
}
 
Example #9
Source Project: TencentKona-8   Author: Tencent   File: StringUtilsTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Locale.setDefault(new Locale("tr", "TR"));

    //verify the properties of the default locale:
    assertEquals("\u0131", "I".toLowerCase());
    assertEquals("\u0130", "i".toUpperCase());

    //verify the StringUtils.toLowerCase/toUpperCase do what they should:
    assertEquals("i", StringUtils.toLowerCase("I"));
    assertEquals("I", StringUtils.toUpperCase("i"));

    //verify StringUtils.caseInsensitiveIndexOf works:
    assertEquals(2, StringUtils.indexOfIgnoreCase("  lookFor", "lookfor"));
    assertEquals(11, StringUtils.indexOfIgnoreCase("  lookFor  LOOKfor", "lookfor", 11));
    assertEquals(2, StringUtils.indexOfIgnoreCase("\u0130\u0130lookFor", "lookfor"));
}
 
Example #10
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: SerializedFormBuilder.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return true if the given Doc should be included
 * in the serialized form.
 *
 * @param doc the Doc object to check for serializability.
 */
private static boolean serialDocInclude(Doc doc) {
    if (doc.isEnum()) {
        return false;
    }
    Tag[] serial = doc.tags("serial");
    if (serial.length > 0) {
        String serialtext = StringUtils.toLowerCase(serial[0].text());
        if (serialtext.indexOf("exclude") >= 0) {
            return false;
        } else if (serialtext.indexOf("include") >= 0) {
            return true;
        }
    }
    return true;
}
 
Example #11
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Configuration.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * This checks for the validity of the options used by the user.
 * This works exactly like
 * {@link com.sun.javadoc.Doclet#validOptions(String[][],
 * DocErrorReporter)}. This will validate the options which are shared
 * by our doclets. For example, this method will flag an error using
 * the DocErrorReporter if user has used "-nohelp" and "-helpfile" option
 * together.
 *
 * @param options  options used on the command line.
 * @param reporter used to report errors.
 * @return true if all the options are valid.
 */
public boolean generalValidOptions(String options[][],
        DocErrorReporter reporter) {
    boolean docencodingfound = false;
    String encoding = "";
    for (int oi = 0; oi < options.length; oi++) {
        String[] os = options[oi];
        String opt = StringUtils.toLowerCase(os[0]);
        if (opt.equals("-docencoding")) {
            docencodingfound = true;
            if (!checkOutputFileEncoding(os[1], reporter)) {
                return false;
            }
        } else if (opt.equals("-encoding")) {
            encoding = os[1];
        }
    }
    if (!docencodingfound && encoding.length() > 0) {
        if (!checkOutputFileEncoding(encoding, reporter)) {
            return false;
        }
    }
    return true;
}
 
Example #12
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: StringUtilsTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Locale.setDefault(new Locale("tr", "TR"));

    //verify the properties of the default locale:
    assertEquals("\u0131", "I".toLowerCase());
    assertEquals("\u0130", "i".toUpperCase());

    //verify the StringUtils.toLowerCase/toUpperCase do what they should:
    assertEquals("i", StringUtils.toLowerCase("I"));
    assertEquals("I", StringUtils.toUpperCase("i"));

    //verify StringUtils.caseInsensitiveIndexOf works:
    assertEquals(2, StringUtils.indexOfIgnoreCase("  lookFor", "lookfor"));
    assertEquals(11, StringUtils.indexOfIgnoreCase("  lookFor  LOOKfor", "lookfor", 11));
    assertEquals(2, StringUtils.indexOfIgnoreCase("\u0130\u0130lookFor", "lookfor"));
}
 
Example #13
Source Project: jdk8u60   Author: chenghanpeng   File: Configuration.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * This checks for the validity of the options used by the user.
 * This works exactly like
 * {@link com.sun.javadoc.Doclet#validOptions(String[][],
 * DocErrorReporter)}. This will validate the options which are shared
 * by our doclets. For example, this method will flag an error using
 * the DocErrorReporter if user has used "-nohelp" and "-helpfile" option
 * together.
 *
 * @param options  options used on the command line.
 * @param reporter used to report errors.
 * @return true if all the options are valid.
 */
public boolean generalValidOptions(String options[][],
        DocErrorReporter reporter) {
    boolean docencodingfound = false;
    String encoding = "";
    for (int oi = 0; oi < options.length; oi++) {
        String[] os = options[oi];
        String opt = StringUtils.toLowerCase(os[0]);
        if (opt.equals("-docencoding")) {
            docencodingfound = true;
            if (!checkOutputFileEncoding(os[1], reporter)) {
                return false;
            }
        } else if (opt.equals("-encoding")) {
            encoding = os[1];
        }
    }
    if (!docencodingfound && encoding.length() > 0) {
        if (!checkOutputFileEncoding(encoding, reporter)) {
            return false;
        }
    }
    return true;
}
 
Example #14
Source Project: jdk8u60   Author: chenghanpeng   File: Util.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given a ClassDoc, return the name of its type (Class, Interface, etc.).
 *
 * @param cd the ClassDoc to check.
 * @param lowerCaseOnly true if you want the name returned in lower case.
 *                      If false, the first letter of the name is capitalized.
 * @return
 */
public static String getTypeName(Configuration config,
    ClassDoc cd, boolean lowerCaseOnly) {
    String typeName = "";
    if (cd.isOrdinaryClass()) {
        typeName = "doclet.Class";
    } else if (cd.isInterface()) {
        typeName = "doclet.Interface";
    } else if (cd.isException()) {
        typeName = "doclet.Exception";
    } else if (cd.isError()) {
        typeName = "doclet.Error";
    } else if (cd.isAnnotationType()) {
        typeName = "doclet.AnnotationType";
    } else if (cd.isEnum()) {
        typeName = "doclet.Enum";
    }
    return config.getText(
        lowerCaseOnly ? StringUtils.toLowerCase(typeName) : typeName);
}
 
Example #15
Source Project: jdk8u60   Author: chenghanpeng   File: StringUtilsTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Locale.setDefault(new Locale("tr", "TR"));

    //verify the properties of the default locale:
    assertEquals("\u0131", "I".toLowerCase());
    assertEquals("\u0130", "i".toUpperCase());

    //verify the StringUtils.toLowerCase/toUpperCase do what they should:
    assertEquals("i", StringUtils.toLowerCase("I"));
    assertEquals("I", StringUtils.toUpperCase("i"));

    //verify StringUtils.caseInsensitiveIndexOf works:
    assertEquals(2, StringUtils.indexOfIgnoreCase("  lookFor", "lookfor"));
    assertEquals(11, StringUtils.indexOfIgnoreCase("  lookFor  LOOKfor", "lookfor", 11));
    assertEquals(2, StringUtils.indexOfIgnoreCase("\u0130\u0130lookFor", "lookfor"));
}
 
Example #16
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: StringUtilsTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Locale.setDefault(new Locale("tr", "TR"));

    //verify the properties of the default locale:
    assertEquals("\u0131", "I".toLowerCase());
    assertEquals("\u0130", "i".toUpperCase());

    //verify the StringUtils.toLowerCase/toUpperCase do what they should:
    assertEquals("i", StringUtils.toLowerCase("I"));
    assertEquals("I", StringUtils.toUpperCase("i"));

    //verify StringUtils.caseInsensitiveIndexOf works:
    assertEquals(2, StringUtils.indexOfIgnoreCase("  lookFor", "lookfor"));
    assertEquals(11, StringUtils.indexOfIgnoreCase("  lookFor  LOOKfor", "lookfor", 11));
    assertEquals(2, StringUtils.indexOfIgnoreCase("\u0130\u0130lookFor", "lookfor"));
}
 
Example #17
Source Project: TencentKona-8   Author: Tencent   File: Messages.java    License: GNU General Public License v2.0 5 votes vote down vote up
void setOptions(String opts) {
    if (opts == null)
        setOption(ALL, Env.AccessKind.PRIVATE);
    else {
        for (String opt: opts.split(","))
            setOption(StringUtils.toLowerCase(opt.trim()));
    }
}
 
Example #18
Source Project: TencentKona-8   Author: Tencent   File: Messages.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void setOption(String arg) throws IllegalArgumentException {
    if (arg.equals(Stats.OPT)) {
        stats.setEnabled(true);
        return;
    }

    int sep = arg.indexOf("/");
    if (sep > 0) {
        Env.AccessKind ak = Env.AccessKind.valueOf(StringUtils.toUpperCase(arg.substring(sep + 1)));
        setOption(arg.substring(0, sep), ak);
    } else {
        setOption(arg, null);
    }
}
 
Example #19
Source Project: TencentKona-8   Author: Tencent   File: Messages.java    License: GNU General Public License v2.0 5 votes vote down vote up
void report(PrintWriter out) {
    if (codeCounts == null) {
        return;
    }
    out.println("By group...");
    Table groupTable = new Table();
    for (Messages.Group g : Messages.Group.values()) {
        groupTable.put(g.optName(), groupCounts[g.ordinal()]);
    }
    groupTable.print(out);
    out.println();
    out.println("By diagnostic kind...");
    Table dkindTable = new Table();
    for (Diagnostic.Kind k : Diagnostic.Kind.values()) {
        dkindTable.put(StringUtils.toLowerCase(k.toString()), dkindCounts[k.ordinal()]);
    }
    dkindTable.print(out);
    out.println();
    out.println("By message kind...");
    Table codeTable = new Table();
    for (Map.Entry<String, Integer> e : codeCounts.entrySet()) {
        String code = e.getKey();
        String msg;
        try {
            msg = code.equals(NO_CODE) ? "OTHER" : bundle.getString(code);
        } catch (MissingResourceException ex) {
            msg = code;
        }
        codeTable.put(msg, e.getValue());
    }
    codeTable.print(out);
}
 
Example #20
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: TypeDesc.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static String encodeAsString(TypeDesc td) {
    if (td.typeKind.isPrimitive() || td.typeKind == TypeKind.VOID)
        return StringUtils.toLowerCase(td.typeKind.toString());

    if (td.typeKind == TypeKind.ARRAY)
        return encodeAsString(((ArrayTypeDesc) td).compTypeDesc) + "[]";

    if (td.typeKind == TypeKind.TYPEVAR)
        return "#" + ((TypeVarTypeDesc) td).identifier;

    if (td.typeKind == TypeKind.DECLARED)
        return ((ReferenceTypeDesc) td).javaType.toString();

    throw new AssertionError("Unhandled type: " + td.typeKind);
}
 
Example #21
Source Project: TencentKona-8   Author: Tencent   File: Configuration.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method should be defined in all those doclets
 * which want to inherit from this Configuration. This method
 * should return the number of arguments to the command line
 * option (including the option name).  For example,
 * -notimestamp is a single-argument option, so this method would
 * return 1.
 *
 * @param option Command line option under consideration.
 * @return number of arguments to option (including the
 * option name). Zero return means option not known.
 * Negative value means error occurred.
 */
public int optionLength(String option) {
    option = StringUtils.toLowerCase(option);
    if (option.equals("-author") ||
        option.equals("-docfilessubdirs") ||
        option.equals("-javafx") ||
        option.equals("-keywords") ||
        option.equals("-linksource") ||
        option.equals("-nocomment") ||
        option.equals("-nodeprecated") ||
        option.equals("-nosince") ||
        option.equals("-notimestamp") ||
        option.equals("-quiet") ||
        option.equals("-xnodate") ||
        option.equals("-version")) {
        return 1;
    } else if (option.equals("-d") ||
               option.equals("-docencoding") ||
               option.equals("-encoding") ||
               option.equals("-excludedocfilessubdir") ||
               option.equals("-link") ||
               option.equals("-sourcetab") ||
               option.equals("-noqualifier") ||
               option.equals("-output") ||
               option.equals("-sourcepath") ||
               option.equals("-tag") ||
               option.equals("-taglet") ||
               option.equals("-tagletpath") ||
               option.equals("-xprofilespath")) {
        return 2;
    } else if (option.equals("-group") ||
               option.equals("-linkoffline")) {
        return 3;
    } else {
        return -1;  // indicate we don't know about it
    }
}
 
Example #22
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: JavadocFormatter.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public Object visitEntity(EntityTree node, Object p) {
    String name = node.getName().toString();
    int code = -1;
    if (name.startsWith("#")) {
        try {
            int v = StringUtils.toLowerCase(name).startsWith("#x")
                    ? Integer.parseInt(name.substring(2), 16)
                    : Integer.parseInt(name.substring(1), 10);
            if (Entity.isValid(v)) {
                code = v;
            }
        } catch (NumberFormatException ex) {
            //ignore
        }
    } else {
        Entity entity = Entity.get(name);
        if (entity != null) {
            code = entity.code;
        }
    }
    if (code != (-1)) {
        result.appendCodePoint(code);
    } else {
        result.append(node.toString());
    }
    return super.visitEntity(node, p);
}
 
Example #23
Source Project: hottub   Author: dsrg-uoft   File: SimpleTaglet.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a <code>SimpleTaglet</code>.
 * @param tagName the name of this tag
 * @param header the header to output.
 * @param locations the possible locations that this tag
 * can appear in.  The <code>String</code> can contain 'p'
 * for package, 't' for type, 'm' for method, 'c' for constructor
 * and 'f' for field.
 */
public SimpleTaglet(String tagName, String header, String locations) {
    this.tagName = tagName;
    this.header = header;
    locations = StringUtils.toLowerCase(locations);
    if (locations.indexOf(ALL) != -1 && locations.indexOf(EXCLUDED) == -1) {
        this.locations = PACKAGE + TYPE + FIELD + METHOD + CONSTRUCTOR + OVERVIEW;
    } else {
        this.locations = locations;
    }
}
 
Example #24
Source Project: TencentKona-8   Author: Tencent   File: SimpleTaglet.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a <code>SimpleTaglet</code>.
 * @param tagName the name of this tag
 * @param header the header to output.
 * @param locations the possible locations that this tag
 * can appear in.  The <code>String</code> can contain 'p'
 * for package, 't' for type, 'm' for method, 'c' for constructor
 * and 'f' for field.
 */
public SimpleTaglet(String tagName, String header, String locations) {
    this.tagName = tagName;
    this.header = header;
    locations = StringUtils.toLowerCase(locations);
    if (locations.indexOf(ALL) != -1 && locations.indexOf(EXCLUDED) == -1) {
        this.locations = PACKAGE + TYPE + FIELD + METHOD + CONSTRUCTOR + OVERVIEW;
    } else {
        this.locations = locations;
    }
}
 
Example #25
Source Project: lua-for-android   Author: qtiuto   File: Infer.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Incorporation error: mismatch between inferred type and given bound.
 */
void reportInstError(UndetVar uv, InferenceBound ib) {
    reportInferenceError(
            String.format("inferred.do.not.conform.to.%s.bounds", StringUtils.toLowerCase(ib.name())),
            uv.getInst(),
            uv.getBounds(ib));
}
 
Example #26
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: Messages.java    License: GNU General Public License v2.0 5 votes vote down vote up
void setOptions(String opts) {
    if (opts == null)
        setOption(ALL, Env.AccessKind.PRIVATE);
    else {
        for (String opt: opts.split(","))
            setOption(StringUtils.toLowerCase(opt.trim()));
    }
}
 
Example #27
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Start.java    License: GNU General Public License v2.0 5 votes vote down vote up
boolean matches(List<String> names, String arg) {
    for (String name : names) {
        if (StringUtils.toLowerCase(name).equals(StringUtils.toLowerCase(arg)))
            return true;
    }
    return false;
}
 
Example #28
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: PubApi.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Set<Modifier> parseModifiers(String modifiers) {
    if (modifiers == null)
        return Collections.emptySet();
    return Stream.of(modifiers.split(" "))
                 .map(String::trim)
                 .map(StringUtils::toUpperCase)
                 .filter(s -> !s.isEmpty())
                 .map(Modifier::valueOf)
                 .collect(Collectors.toSet());
}
 
Example #29
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: Messages.java    License: GNU General Public License v2.0 5 votes vote down vote up
static boolean isValidOptions(String opts) {
    for (String opt: opts.split(",")) {
        if (!isValidOption(StringUtils.toLowerCase(opt.trim())))
            return false;
    }
    return true;
}
 
Example #30
Source Project: jdk8u60   Author: chenghanpeng   File: Messages.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void setOption(String arg) throws IllegalArgumentException {
    if (arg.equals(Stats.OPT)) {
        stats.setEnabled(true);
        return;
    }

    int sep = arg.indexOf("/");
    if (sep > 0) {
        Env.AccessKind ak = Env.AccessKind.valueOf(StringUtils.toUpperCase(arg.substring(sep + 1)));
        setOption(arg.substring(0, sep), ak);
    } else {
        setOption(arg, null);
    }
}