Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.selesse.jxlint.model;
  
 
 import java.util.List;
 import java.util.Map;

jxlint program options. This contains information relating to JxlintOptions. It is a java.util.Map of JxlintOptions to java.lang.Strings.
 
 public class ProgramOptions {
     private Map<JxlintOptionStringoptions;
     private String sourceDirectory;
 
     public ProgramOptions() {
         this. = Maps.newHashMap();
     }

    
Used for options that don't have any associated information (i.e. option == true).
 
     public void addOption(JxlintOption option) {
         .put(option"true");
     }

    
Adds a JxlintOption with a particular value.
 
     public void addOption(JxlintOption optionString value) {
         .put(optionvalue);
     }
 
     public boolean hasOption(JxlintOption option) {
         return .containsKey(option);
     }
 
     public String getOption(JxlintOption option) {
         return .get(option);
     }

    
Get the program's OutputType.
 
     public OutputType getOutputType() {
         String outputType = .get(.);
 
         if (outputType == null) {
             return .;
         }
 
         String outputTypeString = outputType.toLowerCase();
         if (outputTypeString.equals("quiet")) {
             return .;
         }
         else if (outputTypeString.equals("html")) {
             return .;
         }
         else if (outputTypeString.equals("xml")) {
             return .;
         }
         else {
             return .;
         }
     }

    
Get the source/root directory. This is the directory that was passed to the program, i.e. "java -jar myjar.jar sourceDirectory".
 
     public String getSourceDirectory() {
         return ;
     }

    
Set the source/root directory. This is the directory that was passed to the program, i.e. "java -jar myjar.jar sourceDirectory".
 
     public void setSourceDirectory(String sourceDirectory) {
         this. = sourceDirectory;
     }

    
Returns a list of strings from the raw option string. In other words, given a raw option string "Rule1, Rule2" (i.e. parsed from --disable "Rule1, Rule2"), this returns a list with { "Rule1", "Rule2" }. If any of the rules passed as strings do not exist, this will function will throw a com.selesse.jxlint.model.rules.NonExistentLintRuleException.
 
     public static List<StringgetRuleListFromOptionString(String optionString)
             throws NonExistentLintRuleException {
         Splitter splitter = Splitter.on(",").omitEmptyStrings().trimResults();
 
         List<StringrulesStringList = splitter.splitToList(optionString);
        for (String disabledRuleString : rulesStringList) {
            LintRulesImpl.getInstance().getLintRule(disabledRuleString);
        }
        return Lists.newArrayList(rulesStringList);
    }
    public static List<StringgetCategoryListFromOptionString(String categoryOptionString)
            throws IllegalArgumentException {
        List<StringcategoryList = Lists.newArrayList();
        Splitter splitter = Splitter.on(",").omitEmptyStrings().trimResults();
        List<StringrawCategoryStringList = splitter.splitToList(categoryOptionString);
        Enum[] categories = Categories.get().getEnumConstants();
        List<StringcategoryNames = Lists.newArrayList();
        for (Enum category : categories) {
            categoryNames.add(category.toString());
        }
        for (String categoryString : rawCategoryStringList) {
            if (!categoryNames.contains(categoryString)) {
                throw new IllegalArgumentException("Category \"" + categoryString + "\" does not exist. Try one of: " +
                        Joiner.on(", ").join(categories) + ".");
            }
            categoryList.add(categoryString);
        }
        return categoryList;
    }
New to GrepCode? Check out our FAQ X