{
Class expressionClass = expression.getValueClass();
if (Image.class.getName().equals(expressionClass.getName()))
{
Image img = (Image) source;
newRenderer = JRImageRenderer.getInstance(img, getOnErrorTypeValue());
}
else if (InputStream.class.getName().equals(expressionClass.getName()))
{
InputStream is = (InputStream) source;
newRenderer = JRImageRenderer.getInstance(is, getOnErrorTypeValue());
}
else if (URL.class.getName().equals(expressionClass.getName()))
{
URL url = (URL) source;
newRenderer = JRImageRenderer.getInstance(url, getOnErrorTypeValue());
}
else if (File.class.getName().equals(expressionClass.getName()))
{
File file = (File) source;
newRenderer = JRImageRenderer.getInstance(file, getOnErrorTypeValue());
}
else if (String.class.getName().equals(expressionClass.getName()))
{
String location = (String) source;
newRenderer =
JRImageRenderer.getInstance(
location,
getOnErrorTypeValue(),
isLazy(),
filler.reportClassLoader,
filler.urlHandlerFactory,
filler.fileResolver
);
}
else if (JRRenderable.class.getName().equals(expressionClass.getName()))
{
newRenderer = (JRRenderable) source;
}
if (isUsingCache())
{
JRPrintImage img = new JRTemplatePrintImage(getJRTemplateImage());
img.setRenderer(newRenderer);
filler.fillContext.registerLoadedImage(source, img);
}
}
}