Class SmartWroModelFactory

java.lang.Object
ro.isdc.wro.model.factory.AbstractWroModelFactory
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 Details

  • Constructor Details

    • SmartWroModelFactory

      public SmartWroModelFactory()
  • Method Details

    • 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
    • getModelResourceAsStream

      protected InputStream getModelResourceAsStream() throws IOException
      Overrides:
      getModelResourceAsStream in class AbstractWroModelFactory
      Throws:
      IOException