Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sitemesh
Class Factory  view Factory download Factory.java

java.lang.Object
  extended bycom.sitemesh.Factory

public class Factory
extends java.lang.Object

Factory responsible for creating appropriate instances of implementations. This is a singleton and is obtained through #getInstance(javax.servlet.Config).

Version:
$Revision: 1.7 $

Field Summary
protected  Config config
          ServletConfig or FilterConfig.
protected  DecoratorMapper decoratorMapper
          Instance of DecoratorMapper.
private static Factory instance
           
 
Constructor Summary
protected Factory(Config config)
          Constructor for default implementation of Factory.
 
Method Summary
private  PageParser defaultParser()
          Default PageParser if no other can be determined.
 DecoratorMapper getDecoratorMapper()
          Return instance of DecoratorMapper.
static Factory getInstance(Config config)
          Entry-point for obtaining singleton instance of Factory.
 PageParser getPageParser(java.lang.String contentType)
          Create a PageParser suitable for the given content-type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static Factory instance

config

protected Config config
ServletConfig or FilterConfig.


decoratorMapper

protected DecoratorMapper decoratorMapper
Instance of DecoratorMapper. Because it is thread-safe it can be shared by multiple clients.

Constructor Detail

Factory

protected Factory(Config config)
Constructor for default implementation of Factory. Should never be called by client. Singleton instance should be obtained instead.

Method Detail

getInstance

public static Factory getInstance(Config config)
Entry-point for obtaining singleton instance of Factory.


getDecoratorMapper

public DecoratorMapper getDecoratorMapper()
Return instance of DecoratorMapper.


getPageParser

public PageParser getPageParser(java.lang.String contentType)
Create a PageParser suitable for the given content-type.

For example, if the supplied parameter is text/html a parser shall be returned that can parse HTML accordingly.

Never returns null.


defaultParser

private PageParser defaultParser()
Default PageParser if no other can be determined.