freemarker.template
Class CompileableFactoryParameters

java.lang.Object
  extended by freemarker.template.CompileableFactoryParameters

public final class CompileableFactoryParameters
extends java.lang.Object

Parameter class for a Compileable factory. This is a convenience class for passing parameters to a compileable factory to create new instances of compileable objects. Any additional parameters can be added to this parameter class without having to alter the method signature of the processor itself.

This is an immutable class. Calls to any of the withXXX() methods return a new object.

Since:
1.9
Version:
$Id: CompileableFactoryParameters.java 1112 2013-04-12 02:59:25Z run2000 $
Author:
Nicholas Cull

Method Summary
 Cache getCache()
          Get the cache object for this parameter object.
 java.lang.String getEncoding()
          Get the character encoding for this parameter object.
 java.io.InputStream getStream()
          Get the input stream for this parameter object.
static CompileableFactoryParameters newInstance(java.io.InputStream stream)
          Create a new instance of this compileable factory parameter class with the given input stream.
static CompileableFactoryParameters newInstance(java.io.InputStream stream, Cache cache)
          Create a new instance of this compileable factory parameter class with the given input stream and cache to be associated with.
 CompileableFactoryParameters withCache(Cache cache)
          Return a new CompileableFactoryParameters object with the given cache in place of the existing cache.
 CompileableFactoryParameters withEncoding(java.lang.String encoding)
          Return a new CompileableFactoryParameters object with the given character encoding in place of the existing character encoding.
 CompileableFactoryParameters withInputStream(java.io.InputStream stream)
          Return a new CompileableFactoryParameters object with the given input stream in place of the existing input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static CompileableFactoryParameters newInstance(java.io.InputStream stream)
Create a new instance of this compileable factory parameter class with the given input stream.

Parameters:
stream - the input stream to be passed in to the compileable factory
Returns:
a new CompileableFactoryParameters object with the given input stream
Throws:
java.lang.NullPointerException - the input stream is null

newInstance

public static CompileableFactoryParameters newInstance(java.io.InputStream stream,
                                                       Cache cache)
Create a new instance of this compileable factory parameter class with the given input stream and cache to be associated with.

Parameters:
stream - the input stream to be passed in to the compileable factory
cache - the cache the resulting compiled object will be associated with
Returns:
a new CompileableFactoryParameters object with the given input stream
Throws:
java.lang.NullPointerException - the writer is null

withEncoding

public CompileableFactoryParameters withEncoding(java.lang.String encoding)
Return a new CompileableFactoryParameters object with the given character encoding in place of the existing character encoding. This ensures that every CompileableFactoryParameters object is immutable.

Parameters:
encoding - the character encoding for the compileable factory to use in place of the existing character encoding
Returns:
a new CompileableFactoryParameters object with the new character encoding

withCache

public CompileableFactoryParameters withCache(Cache cache)
Return a new CompileableFactoryParameters object with the given cache in place of the existing cache. This ensures that every CompileableFactoryParameters object is immutable.

Parameters:
cache - the cache for the compileable factory to use in place of the existing cache
Returns:
a new CompileableFactoryParameters object with the new cache

withInputStream

public CompileableFactoryParameters withInputStream(java.io.InputStream stream)
Return a new CompileableFactoryParameters object with the given input stream in place of the existing input stream. This ensures that every CompileableFactoryParameters object is immutable.

Parameters:
stream - the input stream for the compileable factory to use in place of the existing input stream
Returns:
a new CompileableFactoryParameters object with the new input stream
Throws:
java.lang.NullPointerException - the input stream is null

getStream

public java.io.InputStream getStream()
Get the input stream for this parameter object.

Returns:
the input stream

getEncoding

public java.lang.String getEncoding()
Get the character encoding for this parameter object.

Returns:
the character encoding

getCache

public Cache getCache()
Get the cache object for this parameter object.

Returns:
the cache object