ro.isdc.wro.extensions.model.factory
Class SmartWroModelFactory

java.lang.Object
  extended by ro.isdc.wro.model.factory.AbstractWroModelFactory
      extended by ro.isdc.wro.extensions.model.factory.SmartWroModelFactory
All Implemented Interfaces:
WroModelFactory, ObjectFactory<WroModel>

public class SmartWroModelFactory
extends AbstractWroModelFactory

When used, this factory will make it possible to migrate easily from xml to groovy (or json) DSL seamlessly.

Since:
1.4.0
Author:
Alex Objelean

Field Summary
static String ALIAS
          Alias for this model factory used by provider.
 
Constructor Summary
SmartWroModelFactory()
           
 
Method Summary
 WroModel create()
          
static SmartWroModelFactory createFromStandaloneContext(StandaloneContext context)
          Use this factory method when you want to use the SmartWroModelFactory in standalone (maven plugin) context.
protected  String getClassName(Class<? extends WroModelFactory> factoryClass)
           
protected  String getDefaultModelFilename()
          
protected  InputStream getModelResourceAsStream()
          Override this method, in order to provide different xml definition file name.
protected  List<WroModelFactory> newWroModelFactoryFactoryList()
           
 SmartWroModelFactory setAutoDetectWroFile(boolean autoDetectWroFile)
          In order to keep backward compatibility for building the model .
 SmartWroModelFactory setFactoryList(List<WroModelFactory> factoryList)
           
 SmartWroModelFactory setWroFile(File wroFile)
          The file to use for creating model.
 
Methods inherited from class ro.isdc.wro.model.factory.AbstractWroModelFactory
destroy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIAS

public static final String ALIAS
Alias for this model factory used by provider.

See Also:
Constant Field Values
Constructor Detail

SmartWroModelFactory

public SmartWroModelFactory()
Method Detail

createFromStandaloneContext

public static SmartWroModelFactory createFromStandaloneContext(StandaloneContext context)
Use this factory method when you want to use the SmartWroModelFactory in standalone (maven plugin) context. The autoDetect flag is set to true if the wroFile path is the same as the default wro file name.


setWroFile

public SmartWroModelFactory setWroFile(File wroFile)
The file to use for creating model. It is not required to set this field, but if you set, do not set a null object.

Parameters:
wroFile - the wroFile to set

newWroModelFactoryFactoryList

protected List<WroModelFactory> newWroModelFactoryFactoryList()
Returns:
default list of factories to be used by SmartWroModelFactory.

create

public WroModel create()


getClassName

protected String getClassName(Class<? extends WroModelFactory> factoryClass)
Returns:
string representation of the factory name.

setFactoryList

public SmartWroModelFactory setFactoryList(List<WroModelFactory> factoryList)
Parameters:
factoryList - the factoryList to set

setAutoDetectWroFile

public SmartWroModelFactory setAutoDetectWroFile(boolean autoDetectWroFile)
In order to keep backward compatibility for building the model . The idea is if this field is false, then the exact file will be used to create the model, otherwise, wro model file is auto-detected based on the parent folder where the wroFile is located.

Parameters:
autoDetectWroFile - the autoDetectWroFile to set

getDefaultModelFilename

protected String getDefaultModelFilename()

Specified by:
getDefaultModelFilename in class AbstractWroModelFactory
Returns:
the default name of the file describing the wro model.

getModelResourceAsStream

protected InputStream getModelResourceAsStream()
                                        throws IOException
Override this method, in order to provide different xml definition file name.

Overrides:
getModelResourceAsStream in class AbstractWroModelFactory
Returns:
stream of the xml representation of the model.
Throws:
IOException - if the stream couldn't be read.


Copyright © 2008-2013. All Rights Reserved.