Package org.apache.wicket.resource
Class CompositeJavaScriptCompressor
- java.lang.Object
-
- org.apache.wicket.resource.CompositeJavaScriptCompressor
-
- All Implemented Interfaces:
IJavaScriptCompressor
,IScopeAwareTextResourceProcessor
,ITextResourceCompressor
public class CompositeJavaScriptCompressor extends Object implements IScopeAwareTextResourceProcessor, IJavaScriptCompressor
Used to apply severalIJavaScriptCompressor
to the javascript compression.
Usage:CompositeJavaScriptCompressor compositeJavaScriptCompressor = new CompositeJavaScriptCompressor(); compositeJavaScriptCompressor.add(new MyJavaScriptCompressor()); compositeJavaScriptCompressor.add(new AnotherJavaScriptCompressor()); this.getResourceSettings().setJavaScriptCompressor(compositeJavaScriptCompressor);
The compressors can also be given as constructor arguments.- Since:
- 6.20.0
- Author:
- Tobias Soloschenko
-
-
Constructor Summary
Constructors Constructor Description CompositeJavaScriptCompressor(IJavaScriptCompressor... compressors)
Initializes the composite javascript compressor with the givenIJavaScriptCompressor
(s)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompositeJavaScriptCompressor
add(IJavaScriptCompressor compressor)
Adds a IJavaScriptCompressor to the list of delegates.String
compress(String original)
Remove comments and white spaces from the text resourceString
process(String input, Class<?> scope, String name)
Compresses the given original content in the order of compressors.
-
-
-
Constructor Detail
-
CompositeJavaScriptCompressor
public CompositeJavaScriptCompressor(IJavaScriptCompressor... compressors)
Initializes the composite javascript compressor with the givenIJavaScriptCompressor
(s)- Parameters:
compressors
- TheIJavaScriptCompressor
(s) this composite javascript compressor is initialized with
-
-
Method Detail
-
process
public String process(String input, Class<?> scope, String name)
Compresses the given original content in the order of compressors. If no compressor has been given the original content is going to be returned.- Specified by:
process
in interfaceIScopeAwareTextResourceProcessor
- Parameters:
input
- The original input to processscope
- The scope class of the package resourcename
- The name of the package resource- Returns:
- The processed input
-
compress
public String compress(String original)
Description copied from interface:ITextResourceCompressor
Remove comments and white spaces from the text resource- Specified by:
compress
in interfaceITextResourceCompressor
- Returns:
- compressed text resource
-
add
public CompositeJavaScriptCompressor add(IJavaScriptCompressor compressor)
Adds a IJavaScriptCompressor to the list of delegates.- Returns:
this
instance, for chaining
-
-