com.googlecode.jslint4java
Class JSLintBuilder

java.lang.Object
  extended by com.googlecode.jslint4java.JSLintBuilder

public class JSLintBuilder
extends Object

Construct JSLint instances.

Author:
hdm

Constructor Summary
JSLintBuilder()
           
 
Method Summary
 JSLint fromClasspathResource(String resource)
          Initialize the scope from a jslint.js found in the classpath.
 JSLint fromClasspathResource(String resource, Charset encoding)
          Initialize the scope from a jslint.js found in the classpath.
 JSLint fromDefault()
          Initialize the scope with a default jslint.js.
 JSLint fromFile(File f)
          Initialize the scope with the jslint.js passed in on the filesystem.
 JSLint fromFile(File f, Charset encoding)
          Initialize the scope with the jslint.js passed in on the filesystem.
 JSLint fromReader(Reader reader, String name)
          Initialize the scope with an arbitrary jslint.
 JSLintBuilder timeout(long maxTimeInSeconds)
          Set this JSLint instance to time out after maxTimeInSeconds.
 JSLintBuilder timeout(long maxTime, TimeUnit timeUnit)
          Set this JSLint instance to timeout after maxTime.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSLintBuilder

public JSLintBuilder()
Method Detail

fromClasspathResource

public JSLint fromClasspathResource(String resource)
                             throws IOException
Initialize the scope from a jslint.js found in the classpath. Assumes a UTF-8 encoding.

Parameters:
resource - the location of jslint.js on the classpath.
Returns:
a configured JSLint
Throws:
IOException - if there are any problems reading the resource.

fromClasspathResource

public JSLint fromClasspathResource(String resource,
                                    Charset encoding)
                             throws IOException
Initialize the scope from a jslint.js found in the classpath.

Parameters:
resource - the location of jslint.js on the classpath.
encoding - the encoding of the resource.
Returns:
a configured JSLint
Throws:
IOException - if there are any problems reading the resource.

fromDefault

public JSLint fromDefault()
Initialize the scope with a default jslint.js.

Returns:
a configured JSLint
Throws:
RuntimeException - if we fail to load the default jslint.js.

fromFile

public JSLint fromFile(File f)
                throws IOException
Initialize the scope with the jslint.js passed in on the filesystem. Assumes a UTF-8 encoding.

Parameters:
f - the path to jslint.js
Returns:
a configured JSLint
Throws:
IOException - if the file can't be read.

fromFile

public JSLint fromFile(File f,
                       Charset encoding)
                throws IOException
Initialize the scope with the jslint.js passed in on the filesystem.

Parameters:
f - the path to jslint.js
encoding - the encoding of the file
Returns:
a configured JSLint
Throws:
IOException - if the file can't be read.

fromReader

@NeedsContext
public JSLint fromReader(Reader reader,
                                      String name)
                  throws IOException
Initialize the scope with an arbitrary jslint.

Parameters:
reader - an input source providing jslint.js.
name - the name of the resource backed by the reader
Returns:
a configured JSLint
Throws:
IOException - if there are any problems reading from reader .

timeout

public JSLintBuilder timeout(long maxTimeInSeconds)
Set this JSLint instance to time out after maxTimeInSeconds.

Parameters:
maxTimeInSeconds - maximum execution time in seconds.
Returns:
this

timeout

public JSLintBuilder timeout(long maxTime,
                             TimeUnit timeUnit)
Set this JSLint instance to timeout after maxTime.

Parameters:
maxTime - The maximum execution time.
timeUnit - The unit of maxTime.
Returns:
this


Copyright © 2007-2012. All Rights Reserved.