ro.isdc.wro.extensions.processor.js
Class AbstractLinterProcessor

java.lang.Object
  extended by ro.isdc.wro.extensions.processor.js.AbstractLinterProcessor
All Implemented Interfaces:
ResourcePostProcessor, ResourcePreProcessor
Direct Known Subclasses:
JsHintProcessor, JsLintProcessor

@SupportedResourceType(value=JS)
public abstract class AbstractLinterProcessor
extends Object
implements ResourcePreProcessor, ResourcePostProcessor

Processor which analyze the js code and warns you about any problems. The processing result won't change no matter if the processed script contains errors or not.

Since:
1.3.5
Author:
Alex Objelean

Constructor Summary
AbstractLinterProcessor()
           
 
Method Summary
protected abstract  AbstractLinter newLinter()
           
protected  void onException(Exception e)
          Invoked when a processing exception occurs.
protected  void onLinterException(LinterException e, Resource resource)
          Called when LinterException is thrown.
 void process(Reader reader, Writer writer)
          
 void process(Resource resource, Reader reader, Writer writer)
          
 AbstractLinterProcessor setOptions(String... options)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLinterProcessor

public AbstractLinterProcessor()
Method Detail

setOptions

public AbstractLinterProcessor setOptions(String... options)

process

public void process(Resource resource,
                    Reader reader,
                    Writer writer)
             throws IOException

Specified by:
process in interface ResourcePreProcessor
Throws:
IOException

onException

protected void onException(Exception e)
Invoked when a processing exception occurs.


newLinter

protected abstract AbstractLinter newLinter()
Returns:
the linter to use for js code validation.

process

public void process(Reader reader,
                    Writer writer)
             throws IOException

Specified by:
process in interface ResourcePostProcessor
Throws:
IOException

onLinterException

protected void onLinterException(LinterException e,
                                 Resource resource)
Called when LinterException is thrown. Allows subclasses to re-throw this exception as a RuntimeException or handle it differently. The default implementation simply logs the errors.

Parameters:
e - LinterException which has occurred.
resource - the processed resource which caused the exception.


Copyright © 2008-2012. All Rights Reserved.