ro.isdc.wro.model.resource.processor.decorator
Class AbstractProcessorDecoratorSupport<T>

java.lang.Object
  extended by ro.isdc.wro.util.AbstractDecorator<T>
      extended by ro.isdc.wro.model.resource.processor.decorator.AbstractProcessorDecoratorSupport<T>
All Implemented Interfaces:
ImportAware, MinimizeAware, ResourcePostProcessor, ResourcePreProcessor, SupportAware, SupportedResourceTypeAware, ObjectDecorator<T>
Direct Known Subclasses:
ProcessorDecorator

public abstract class AbstractProcessorDecoratorSupport<T>
extends AbstractDecorator<T>
implements ResourcePreProcessor, ResourcePostProcessor, SupportedResourceTypeAware, MinimizeAware, SupportAware, ImportAware

Hides details common to all processors decorators, like ability to identify if a processor is minimize aware

Since:
1.4.6
Author:
Alex Objelean

Constructor Summary
AbstractProcessorDecoratorSupport(T decorated)
           
 
Method Summary
 SupportedResourceType getSupportedResourceType()
          This method is final, because it intends to preserve the getSupportedResourceType flag of the decorated processor.
protected  SupportedResourceType getSupportedResourceTypeInternal()
          Allow subclass override the way getSupportedResourceType is used.
 ResourceType[] getSupportedResourceTypes()
           
 boolean isImportAware()
          
 boolean isMinimize()
          This method is final, because it intends to preserve the minimize flag of the decorated processor.
protected  boolean isMinimizeInternal()
          Allow subclass override the way isMinimized is used.
 boolean isSupported()
          
 void process(Reader reader, Writer writer)
          Perform actual resource processing.
 
Methods inherited from class ro.isdc.wro.util.AbstractDecorator
getDecoratedObject, getOriginalDecoratedObject, getOriginalDecoratedObject, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ro.isdc.wro.model.resource.processor.ResourcePreProcessor
process
 

Constructor Detail

AbstractProcessorDecoratorSupport

public AbstractProcessorDecoratorSupport(T decorated)
Parameters:
the - decorated processor. The type of the returned object is Object because we don't really care and we need it only to check if the processor is minimize aware and get its supported type. This "hack" will e removed in 1.5.0.
Method Detail

getSupportedResourceType

public final SupportedResourceType getSupportedResourceType()
This method is final, because it intends to preserve the getSupportedResourceType flag of the decorated processor. You still can override this behavior by implementing getSupportedResourceTypeInternal() on your own risk.

Specified by:
getSupportedResourceType in interface SupportedResourceTypeAware
Returns:
the SupportedResourceType annotation of the decorated processor if one exist.

getSupportedResourceTypeInternal

protected SupportedResourceType getSupportedResourceTypeInternal()
Allow subclass override the way getSupportedResourceType is used.


isMinimize

public final boolean isMinimize()
This method is final, because it intends to preserve the minimize flag of the decorated processor. You still can override this behavior by implementing isMinimizeInternal() on your own risk.

Specified by:
isMinimize in interface MinimizeAware
Returns:
true if the processor implementing this method performs some kind of minification.

isMinimizeInternal

protected boolean isMinimizeInternal()
Allow subclass override the way isMinimized is used.


isSupported

public boolean isSupported()

Specified by:
isSupported in interface SupportAware
Returns:
true if the implementor of this interface is supported.

isImportAware

public boolean isImportAware()

Specified by:
isImportAware in interface ImportAware
Returns:
flag indicating if the implementor of this interface should process also imported (referred by @import directive) resources.

getSupportedResourceTypes

public final ResourceType[] getSupportedResourceTypes()
Returns:
the array of supported resources the processor can process.

process

public final void process(Reader reader,
                          Writer writer)
                   throws IOException
Perform actual resource processing. The content to be processed is read from source Reader and is written to destination Writer. It is the client responsibility to close both: Reader and writer.

Specified by:
process in interface ResourcePostProcessor
Parameters:
reader - source stream.
writer - destination stream.
Throws:
IOException


Copyright © 2008-2013. All Rights Reserved.