Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

Entry-point to the jxlint framework. This should be called only after customizing (if desired). Pass your program's command line arguments to parseArgumentsAndDispatch(java.lang.String[])}, jxlint will do the rest! Sample implementation is shown below:
     public class MyApplication {
         public static void main (String[] args) {
             Jxlint jxlint = new Jxlint(new MyLintRules(), new MyProgramSettings());
 public class Jxlint {
     private final ProgramSettings programSettings;

Initializes jxlint with a set of rules (com.selesse.jxlint.model.rules.LintRules and program settings com.selesse.jxlint.settings.ProgramSettings). This will make the program call java.lang.System.exit(int) under circumstances described in com.selesse.jxlint.model.ExitType.
     public Jxlint(LintRules lintRulesProgramSettings programSettings) {

     public Jxlint(LintRules lintRulesProgramSettings programSettingsboolean exitAfterReporting) {
         this. = programSettings;
     public void setCustomCategories(Class<? extends Enum<?>> categories) {

Parses the command line arguments, and calls the Dispatcher to decide what to do next. Makes sure that there are no java.lang.Exceptions thrown when parsing the command line arguments.

args Your program's command line arguments.
     public void parseArgumentsAndDispatch(String[] args) {
         if (args.length == 0) {
             args = new String[] { "--help" };
         // Turn the color on!
         CommandLineParser commandLineParser = new GnuParser();
         Options options = CommandLineOptions.generateJxlintOptions();
         try {
             CommandLine commandLine = commandLineParser.parse(optionsargs);
             ProgramOptions programOptions = ProgramOptionExtractor.extractProgramOptions(commandLine);
         catch (MissingArgumentException e) {
             ProgramExitter.exitProgramWithMessage("Missing argument for option '--" + e.getOption().getLongOpt() + "'" +
         catch (AlreadySelectedException e) {
             OptionGroup badOptionGroup = e.getOptionGroup();
             List<StringoptionNames = Lists.newArrayList();
             for (Object option : badOptionGroup.getOptions()) {
                 optionNames.add("--" + ((Optionoption).getLongOpt());
            ProgramExitter.exitProgramWithMessage("Only one of " + Joiner.on(", ").join(optionNames) +
                    " must be selected.".);
        catch (UnrecognizedOptionException e) {
            ProgramExitter.exitProgramWithMessage("Unrecognized option: " + e.getOption(), .);
        catch (ParseException e) {
        // This is done both here, and in ProgramExitter#exitProgramWithMessage.
        // Why? Because we have two possible program flows: we exit with System.exit, or we don't.
        if (Profiler.isEnabled()) {
New to GrepCode? Check out our FAQ X