org.got5.tapestry5.jquery.services.impl.JavaScriptFilesConfigurationImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tapestry5-jquery Show documentation
Show all versions of tapestry5-jquery Show documentation
Tapestry Components Library
package org.got5.tapestry5.jquery.services.impl;
import java.util.Map;
import org.apache.tapestry5.Asset;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.services.AssetSource;
import org.got5.tapestry5.jquery.services.JavaScriptFilesConfiguration;
public class JavaScriptFilesConfigurationImpl implements
JavaScriptFilesConfiguration {
private Map javaScriptFilesConfiguration;
private AssetSource as;
public JavaScriptFilesConfigurationImpl(Map javaScriptFilesConfiguration, AssetSource as) {
super();
this.javaScriptFilesConfiguration = javaScriptFilesConfiguration;
this.as = as;
}
public Asset getAsset(Asset original) {
if(javaScriptFilesConfiguration.containsKey(original.getResource().getFile())) {
String assetPath = javaScriptFilesConfiguration.get(original.getResource().getFile());
return InternalUtils.isBlank(assetPath) ? null : this.as.getExpandedAsset(assetPath);
}
return original;
}
}