Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-2486

Refactor the non-trivial BindingFactory implementations into services


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.13
    • Fix Version/s: 5.0.15
    • Component/s: tapestry-core
    • Labels:


      My actual problem:
      I would like to replace BindingConstants.MESSAGE with my own implemention.
      This is currently not possible because MessageBindingFactory is not IOC Service. ( I could decorateComponentMessageSsource etc. but this is not enough for me, because i need access to the ComponentResources )

      General Solution :
      Make MessageBindingFactory a IOC service then I could override with contributeAliasOverrides(...)
      This may also make sence for other objects , which are currently instatiated with "new" in TapestryModule.java

      http://tapestry.apache.org/tapestry5/tapestry-ioc/overview.html says:
      "The problem with new is that it rigidly connects one implementation to another implementation. Let's follow a progression that reflects how a lot of projects get written. It will show that in the real world, new is not as simple as it first seems."

      Another soultion:

      Allow MappedConfiguration.add to overwrite serviceId's ( with warning ).

      -------------------------------------- instantiotion of MessageBindingFactory with "new" -----------------------------
      public static void contributeBindingSource(MappedConfiguration<String, BindingFactory> configuration,

      BindingFactory propBindingFactory,

      ObjectLocator locator)

      { configuration.add(BindingConstants.LITERAL, new LiteralBindingFactory()); configuration.add(BindingConstants.PROP, propBindingFactory); configuration.add(BindingConstants.COMPONENT, new ComponentBindingFactory()); configuration.add(BindingConstants.MESSAGE, new MessageBindingFactory()); configuration.add(BindingConstants.VALIDATE, locator.autobuild(ValidateBindingFactory.class)); configuration.add(BindingConstants.TRANSLATE, locator.autobuild(TranslateBindingFactory.class)); configuration.add(BindingConstants.BLOCK, new BlockBindingFactory()); configuration.add(BindingConstants.ASSET, locator.autobuild(AssetBindingFactory.class)); configuration.add(BindingConstants.VAR, new RenderVariableBindingFactory()); configuration.add(BindingConstants.NULLFIELDSTRATEGY, locator.autobuild(NullFieldStrategyBindingFactory.class)); }




            • Assignee:
              hlship Howard M. Lewis Ship
              fritz.pro Fritz Pröbstle
            • Votes:
              1 Vote for this issue
              2 Start watching this issue


              • Created: