Skip to content

Commit

Permalink
Fixed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Apr 23, 2014
1 parent 601a2af commit f50e7c8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
Expand Up @@ -10,15 +10,15 @@

/**
* Creates a {@link TemplateProcessor} based on a {@link Template}
*
*
* @author <a href="ggastald@redhat.com">George Gastaldi</a>
*/
public interface TemplateProcessorFactory
{
/**
* Create a {@link TemplateProcessor} for the supplied {@link Template}. The created TemplateProcessor is associated
* with a template engine, and can be provided with a data model to eventually produce some output.
*
*
* @param template The template for which the processor is to be created
* @return A {@link TemplateProcessor} instance
*/
Expand All @@ -27,11 +27,11 @@ public interface TemplateProcessorFactory
/**
* Create a {@link TemplateProcessor} for the supplied {@link Resource}. The created TemplateProcessor is associated
* with a template engine, and can be provided with a data model to eventually produce some output.
*
*
* @deprecated Deprecated after Forge 2.1.1. Use the method requiring {@link Template} instances instead.
* @param template The template for which the processor is to be created
* @return A {@link TemplateProcessor} instance
*/
@Deprecated
TemplateProcessor fromTemplate(Resource template);
TemplateProcessor fromTemplate(Resource<?> template);
}
Expand Up @@ -17,8 +17,6 @@
import org.jboss.forge.addon.templates.Template;
import org.jboss.forge.addon.templates.TemplateGenerator;

import freemarker.cache.TemplateCache;
import freemarker.cache.TemplateLoader;
import freemarker.template.TemplateException;

/**
Expand Down
Expand Up @@ -15,7 +15,7 @@
import org.jboss.forge.furnace.util.Assert;

/**
*
*
* @author <a href="ggastald@redhat.com">George Gastaldi</a>
*/
@Singleton
Expand All @@ -39,17 +39,19 @@ public TemplateProcessor fromTemplate(Template template)
throw new IllegalStateException("No generator found for [" + template + "]");
}

@Override
public TemplateProcessor fromTemplate(Resource template) {
Assert.notNull(template, "Template resource cannot be null");
Assert.isTrue(template.exists(), "Template does not exist: " + template);
for (TemplateGenerator generator : generators)
{
if (generator.handles(template))
{
return new TemplateProcessorImpl(generator, template);
}
}
throw new IllegalStateException("No generator found for [" + template + "]");
}
@SuppressWarnings("deprecation")
@Override
public TemplateProcessor fromTemplate(Resource<?> template)
{
Assert.notNull(template, "Template resource cannot be null");
Assert.isTrue(template.exists(), "Template does not exist: " + template);
for (TemplateGenerator generator : generators)
{
if (generator.handles(template))
{
return new TemplateProcessorImpl(generator, template);
}
}
throw new IllegalStateException("No generator found for [" + template + "]");
}
}
Expand Up @@ -15,14 +15,14 @@

/**
* {@link TemplateProcessor} implementation
*
*
* @author <a href="ggastald@redhat.com">George Gastaldi</a>
*/
public class TemplateProcessorImpl implements TemplateProcessor
{
private final TemplateGenerator generator;
private Template template;
private Resource resource;
private Resource<?> resource;

TemplateProcessorImpl(TemplateGenerator generator, Template template)
{
Expand All @@ -34,7 +34,7 @@ public class TemplateProcessorImpl implements TemplateProcessor
/**
* @deprecated Deprecated after Forge 2.1.1. Use the {@link Template} based constructor instead.
*/
TemplateProcessorImpl(TemplateGenerator generator, Resource resource)
TemplateProcessorImpl(TemplateGenerator generator, Resource<?> resource)
{
super();
this.generator = generator;
Expand All @@ -49,6 +49,7 @@ public String process(Object dataModel) throws IOException
return writer.toString();
}

@SuppressWarnings("deprecation")
@Override
public void process(Object dataModel, Writer output) throws IOException
{
Expand Down

0 comments on commit f50e7c8

Please sign in to comment.